kleine Ergänzungen
parent
dd5e7382bd
commit
5bc6d9c7d8
|
|
@ -23,6 +23,7 @@ import javax.swing.JFileChooser;
|
||||||
import java.awt.BorderLayout;
|
import java.awt.BorderLayout;
|
||||||
import java.awt.Component;
|
import java.awt.Component;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
|
import java.awt.Graphics;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
|
|
||||||
public class MainFrame extends JFrame {
|
public class MainFrame extends JFrame {
|
||||||
|
|
@ -61,8 +62,8 @@ public class MainFrame extends JFrame {
|
||||||
setBounds(100, 100, 500, 500);
|
setBounds(100, 100, 500, 500);
|
||||||
|
|
||||||
contentPane = new JPanel();
|
contentPane = new JPanel();
|
||||||
contentPane.setBackground(Color.GRAY);
|
contentPane.setBackground(new Color(90, 90, 90));
|
||||||
contentPane.setForeground(Color.GRAY);
|
contentPane.setForeground(Color.BLACK);
|
||||||
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||||
|
|
||||||
setContentPane(contentPane);
|
setContentPane(contentPane);
|
||||||
|
|
@ -72,6 +73,7 @@ public class MainFrame extends JFrame {
|
||||||
contentPane.add(Box.createVerticalStrut(10));
|
contentPane.add(Box.createVerticalStrut(10));
|
||||||
|
|
||||||
JLabel lblNewLabel = new JLabel("Schach");
|
JLabel lblNewLabel = new JLabel("Schach");
|
||||||
|
lblNewLabel.setForeground(Color.BLACK);
|
||||||
lblNewLabel.setFont(new Font("Serif", Font.BOLD, 60));
|
lblNewLabel.setFont(new Font("Serif", Font.BOLD, 60));
|
||||||
lblNewLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
lblNewLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
contentPane.add(lblNewLabel);
|
contentPane.add(lblNewLabel);
|
||||||
|
|
@ -86,6 +88,7 @@ public class MainFrame extends JFrame {
|
||||||
contentPane.add(Box.createVerticalStrut(75));
|
contentPane.add(Box.createVerticalStrut(75));
|
||||||
|
|
||||||
JButton btnNewButton = new JButton("Neues Spiel starten");
|
JButton btnNewButton = new JButton("Neues Spiel starten");
|
||||||
|
|
||||||
btnNewButton.setBackground(Color.LIGHT_GRAY);
|
btnNewButton.setBackground(Color.LIGHT_GRAY);
|
||||||
btnNewButton.setForeground(Color.BLACK);
|
btnNewButton.setForeground(Color.BLACK);
|
||||||
btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 16));
|
btnNewButton.setFont(new Font("Tahoma", Font.BOLD, 16));
|
||||||
|
|
@ -106,25 +109,27 @@ public class MainFrame extends JFrame {
|
||||||
contentPane.add(Box.createVerticalStrut(15));
|
contentPane.add(Box.createVerticalStrut(15));
|
||||||
|
|
||||||
JButton btnNewButton_1 = new JButton("Vergangenes Spiel laden");
|
JButton btnNewButton_1 = new JButton("Vergangenes Spiel laden");
|
||||||
|
|
||||||
btnNewButton_1.setBackground(Color.LIGHT_GRAY);
|
btnNewButton_1.setBackground(Color.LIGHT_GRAY);
|
||||||
btnNewButton_1.setForeground(Color.BLACK);
|
btnNewButton_1.setForeground(Color.BLACK);
|
||||||
btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 16));
|
btnNewButton_1.setFont(new Font("Tahoma", Font.BOLD, 16));
|
||||||
btnNewButton_1.setAlignmentX(Component.CENTER_ALIGNMENT);
|
btnNewButton_1.setAlignmentX(Component.CENTER_ALIGNMENT);
|
||||||
btnNewButton_1.addActionListener(new ActionListener() {
|
btnNewButton_1.addActionListener(new ActionListener() {
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
JFileChooser dateiWaehler = new JFileChooser();
|
JFileChooser dateiWaehler = new JFileChooser();
|
||||||
JFrame jfFile = new JFrame();
|
JFrame jfFile = new JFrame();
|
||||||
int auswahl = dateiWaehler.showOpenDialog(jfFile);
|
int auswahl = dateiWaehler.showOpenDialog(jfFile);
|
||||||
|
|
||||||
if (auswahl == JFileChooser.APPROVE_OPTION) {
|
if (auswahl == JFileChooser.APPROVE_OPTION) {
|
||||||
File ausgewaehlteDatei = dateiWaehler.getSelectedFile();
|
File ausgewaehlteDatei = dateiWaehler.getSelectedFile();
|
||||||
JOptionPane.showMessageDialog(jfFile,"Gewählte Datei:\n" + ausgewaehlteDatei.getAbsolutePath());
|
JOptionPane.showMessageDialog(jfFile, "Gewählte Datei:\n" + ausgewaehlteDatei.getAbsolutePath());
|
||||||
|
|
||||||
//Uebergabe zu Logik zum extrahieren der Daten
|
// Uebergabe zu Logik zum extrahieren der Daten
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -133,6 +138,7 @@ public class MainFrame extends JFrame {
|
||||||
contentPane.add(Box.createVerticalStrut(15));
|
contentPane.add(Box.createVerticalStrut(15));
|
||||||
|
|
||||||
JButton btnNewButton_2 = new JButton("Spiel beenden");
|
JButton btnNewButton_2 = new JButton("Spiel beenden");
|
||||||
|
|
||||||
btnNewButton_2.setBackground(Color.LIGHT_GRAY);
|
btnNewButton_2.setBackground(Color.LIGHT_GRAY);
|
||||||
btnNewButton_2.setForeground(Color.BLACK);
|
btnNewButton_2.setForeground(Color.BLACK);
|
||||||
btnNewButton_2.setFont(new Font("Tahoma", Font.BOLD, 16));
|
btnNewButton_2.setFont(new Font("Tahoma", Font.BOLD, 16));
|
||||||
|
|
|
||||||
|
|
@ -50,6 +50,7 @@ public class SpielFrame extends JFrame {
|
||||||
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
setBounds(100, 100, 1920, 1080);
|
setBounds(100, 100, 1920, 1080);
|
||||||
setTitle("Spiel");
|
setTitle("Spiel");
|
||||||
|
setAlwaysOnTop(true);
|
||||||
|
|
||||||
JPanel contentPane = new JPanel();
|
JPanel contentPane = new JPanel();
|
||||||
contentPane.setLayout(new BorderLayout());
|
contentPane.setLayout(new BorderLayout());
|
||||||
|
|
@ -87,6 +88,7 @@ public class SpielFrame extends JFrame {
|
||||||
logger.info("Dunkles Feld erstellt."+i);
|
logger.info("Dunkles Feld erstellt."+i);
|
||||||
b.setBackground(new Color(65, 65, 65));
|
b.setBackground(new Color(65, 65, 65));
|
||||||
}
|
}
|
||||||
|
|
||||||
b.setForeground(Color.WHITE);
|
b.setForeground(Color.WHITE);
|
||||||
b.setBorderPainted(false);
|
b.setBorderPainted(false);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue