Wunsch Buttons
This commit is contained in:
@@ -6,6 +6,8 @@ import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTable;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
|
||||
import de.jaujau.daten.Farbe;
|
||||
import de.jaujau.daten.Spieler;
|
||||
import de.jaujau.daten.Spielerverwaltung;
|
||||
import de.jaujau.daten.Texturenpakete;
|
||||
@@ -53,8 +55,15 @@ public class Dashboard_GUI extends JPanel{
|
||||
private final JPanel info_panel = new JPanel();
|
||||
private final JPanel rechts = new JPanel();
|
||||
private final JPanel mitte = new JPanel();
|
||||
JButton aussetzen = new JButton("Aussetzen");
|
||||
JLabel ablagestapel = new JLabel("");
|
||||
JButton aussetzen = new JButton("Aussetzen");
|
||||
JPanel mitte_unten = new JPanel();
|
||||
JPanel mitte_center = new JPanel();
|
||||
private JPanel mitte_oben = new JPanel();
|
||||
private JButton btnherz = new JButton("Herz");
|
||||
private JButton btnpik = new JButton("Pik");
|
||||
private JButton btnkaro = new JButton("Karo");
|
||||
private JButton btnkreuz = new JButton("Kreuz");
|
||||
|
||||
public Dashboard_GUI(Spiel Spiel, Texturenpakete texturen) {
|
||||
setMinimumSize(new Dimension(1000, 600));
|
||||
@@ -131,23 +140,80 @@ public class Dashboard_GUI extends JPanel{
|
||||
ziehstapel.setIcon(new ImageIcon(texturenpakete.getTextur(32).getScaledInstance(150, 210, Image.SCALE_SMOOTH)));
|
||||
|
||||
spielfeldmitte.add(mitte, BorderLayout.CENTER);
|
||||
mitte.setLayout(null);
|
||||
|
||||
JButton aussetzen = new JButton("Aussetzen");
|
||||
aussetzen.setVisible(false);
|
||||
aussetzen.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
aktuellesSpiel.aussetzen();
|
||||
aussetzen.setVisible(false);
|
||||
}
|
||||
});
|
||||
aussetzen.setBounds(473, 554, 89, 23);
|
||||
mitte.add(aussetzen);
|
||||
mitte.setLayout(new BorderLayout(0, 0));
|
||||
mitte_unten.setVisible(false);
|
||||
mitte_unten.setPreferredSize(new Dimension(150, 50));
|
||||
mitte_unten.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 5));
|
||||
btnherz.setVisible(false);
|
||||
|
||||
|
||||
mitte_unten.add(btnherz);
|
||||
mitte_unten.add(aussetzen);
|
||||
mitte_center.setLayout(new BorderLayout(0, 0));
|
||||
ablagestapel.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
ablagestapel.setHorizontalTextPosition(SwingConstants.CENTER);
|
||||
ablagestapel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||
|
||||
|
||||
ablagestapel.setIcon(new ImageIcon(texturenpakete.getTextur(32).getScaledInstance(150, 210, Image.SCALE_SMOOTH)));
|
||||
ablagestapel.setBounds(398, 85, 268, 401);
|
||||
mitte.add(ablagestapel);
|
||||
mitte_center.add(ablagestapel, BorderLayout.CENTER);
|
||||
|
||||
|
||||
mitte.add(mitte_center);
|
||||
|
||||
//Wunschfarben Button Listener
|
||||
|
||||
mitte.add(mitte_unten, BorderLayout.SOUTH);
|
||||
btnpik.setVisible(false);
|
||||
btnpik.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
aktuellesSpiel.getKartensatz().SetWunschfarbe(Farbe.PIK);
|
||||
btnpik.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
mitte_unten.add(btnpik);
|
||||
btnkaro.setVisible(false);
|
||||
btnkaro.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
aktuellesSpiel.getKartensatz().SetWunschfarbe(Farbe.KARO);
|
||||
btnkaro.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
mitte_unten.add(btnkaro);
|
||||
btnkreuz.setVisible(false);
|
||||
btnkreuz.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
aktuellesSpiel.getKartensatz().SetWunschfarbe(Farbe.KREUZ);
|
||||
btnkreuz.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
btnherz.addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseClicked(MouseEvent e) {
|
||||
aktuellesSpiel.getKartensatz().SetWunschfarbe(Farbe.HERZ);
|
||||
btnherz.setVisible(false);
|
||||
}
|
||||
});
|
||||
|
||||
mitte_unten.add(btnkreuz);
|
||||
mitte_oben.setPreferredSize(new Dimension(150, 50));
|
||||
|
||||
mitte.add(mitte_oben, BorderLayout.NORTH);
|
||||
mitte_oben.setLayout(new BorderLayout(0, 0));
|
||||
panelCont.add(start, "3");
|
||||
start.setLayout(new BorderLayout(0, 0));
|
||||
panel.setPreferredSize(new Dimension(10, 30));
|
||||
@@ -268,6 +334,15 @@ public class Dashboard_GUI extends JPanel{
|
||||
|
||||
|
||||
public void aktualisiereAblage(){
|
||||
int sum = 0;
|
||||
synchronized (this) {
|
||||
int i = 0;
|
||||
while (i < 100000) {
|
||||
sum += i;
|
||||
i++;
|
||||
}
|
||||
notify();
|
||||
}
|
||||
ablagestapel.setIcon(new ImageIcon(texturenpakete.getTextur(aktuellesSpiel.getKartensatz().getletzteKarte()).getScaledInstance(150, 210, Image.SCALE_SMOOTH)));
|
||||
ablagestapel.revalidate();
|
||||
ablagestapel.repaint();
|
||||
@@ -290,8 +365,8 @@ public class Dashboard_GUI extends JPanel{
|
||||
}
|
||||
|
||||
|
||||
public void aussetzen(boolean status) {
|
||||
aussetzen.setVisible(status);
|
||||
public void aussetzen() {
|
||||
aussetzen.setVisible(true);
|
||||
}
|
||||
|
||||
public void aktualisiereGUI(){
|
||||
@@ -299,6 +374,13 @@ public class Dashboard_GUI extends JPanel{
|
||||
aktualisiereAblage();
|
||||
aktualisiereHand();
|
||||
}
|
||||
|
||||
public void showbtn(){
|
||||
btnpik.setVisible(true);
|
||||
btnherz.setVisible(true);
|
||||
btnkaro.setVisible(true);
|
||||
btnkreuz.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user