JFrame Mittig Popicieren
public class MyFrame {
public MyFrame(String title) {
JFrame frame = new JFrame(title);
frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
int windowWidth = 800; //Breite des Programmfensters in Pixel
int windowHeight = 600; //Höhe des Programmfensters in Pixel
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); //Bildschirmdimensionen in Pixeln holen
frame.setBounds((screenSize.width-windowWidth)/2, (screenSize.height-windowHeight)/2, windowWidth, windowHeight);
frame.setVisible(true);
}
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new MyFrame("Byte-Welt.net");
}
});
}
}
Splendid Skunk