Merge branch (#23) 'devShowFieldNumbers'
commit
043e8b5090
|
|
@ -37,6 +37,7 @@ import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
import javax.swing.JTextArea;
|
import javax.swing.JTextArea;
|
||||||
|
import javax.swing.SwingConstants;
|
||||||
|
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
@ -210,23 +211,57 @@ public class SpielFrame extends JFrame {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the default background color for the buttons in the grid.
|
* Sets the default background color for the buttons in the grid.
|
||||||
*/
|
*/
|
||||||
private void setDefaultBackground() {
|
private void setDefaultBackground() {
|
||||||
for (int i = 0; i < 64; i++) {
|
int counter = 8;
|
||||||
JButton b = buttons.get(i);
|
for (int i = 0; i < 64; i++) {
|
||||||
if ((i / 8 + i % 8) % 2 == 0) {
|
JButton b = buttons.get(i);
|
||||||
// logger.info("Helles Feld erstellt." + i);
|
if ((i / 8 + i % 8) % 2 == 0) {
|
||||||
b.setBackground(new Color(90, 90, 90));
|
// logger.info("Helles Feld erstellt." + i);
|
||||||
} else {
|
b.setBackground(new Color(90, 90, 90));
|
||||||
// logger.info("Dunkles Feld erstellt." + i);
|
|
||||||
b.setBackground(new Color(65, 65, 65));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
|
} else {
|
||||||
|
// logger.info("Dunkles Feld erstellt." + i);
|
||||||
|
b.setBackground(new Color(65, 65, 65));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(i % 8 == 0) {
|
||||||
|
b.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
b.setVerticalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
|
b.setHorizontalTextPosition(SwingConstants.LEFT); // Text rechts vom Icon
|
||||||
|
b.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||||
|
|
||||||
|
b.setIconTextGap(5);
|
||||||
|
|
||||||
|
b.setText(String.valueOf(counter)+b.getText());
|
||||||
|
counter--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
char buchstabe = 'a';
|
||||||
|
for(int j=0;j<8;j++) {
|
||||||
|
JButton button = buttons.get(mirrowedGrid(j));
|
||||||
|
|
||||||
|
button.setHorizontalAlignment(SwingConstants.CENTER);
|
||||||
|
button.setVerticalAlignment(SwingConstants.CENTER);
|
||||||
|
|
||||||
|
button.setHorizontalTextPosition(SwingConstants.RIGHT); // Text rechts vom Icon
|
||||||
|
button.setVerticalTextPosition(SwingConstants.BOTTOM);
|
||||||
|
|
||||||
|
button.setIconTextGap(5);
|
||||||
|
|
||||||
|
button.setText(String.valueOf(buchstabe));
|
||||||
|
buchstabe++;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
/**
|
||||||
* Sets the to default buttons
|
* Sets the to default buttons
|
||||||
*/
|
*/
|
||||||
public void setDefaultButtons() {
|
public void setDefaultButtons() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue