moin
ich hab da nen problem:
ich möchte mein hauptfester, welches 1/2 bildschirmgröße groß ist, in der mitte zentrieren ...
nur irgendwie funktioniert das net ...
kann mir da wer helfen ?
hier mein code:
	
	
	
	
	
		
	
			
			ich hab da nen problem:
ich möchte mein hauptfester, welches 1/2 bildschirmgröße groß ist, in der mitte zentrieren ...
nur irgendwie funktioniert das net ...
kann mir da wer helfen ?
hier mein code:
		Code:
	
	package AVS5Host;
import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import java.awt.Rectangle;
import javax.swing.JPanel;
import javax.swing.JFrame;
public class AVS5Host extends JFrame {
	private static final long serialVersionUID = 1L;
	private JPanel jContentPane = null;
	public int mainframe_x=0;
	public int mainframe_y=0;
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				AVS5Host thisClass = new AVS5Host();
				thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				thisClass.setVisible(true);
			}
		});
	}
	/**
	 * This is the default constructor
	 */
	public AVS5Host() {
		super();
		initialize();
	}
	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize() {
		this.mainframe_x=this.getGraphicsConfiguration().getBounds().width;
		this.mainframe_y=this.getGraphicsConfiguration().getBounds().height;
		int x = ((this.mainframe_x/2)-(this.mainframe_x/4));
		int y = ((this.mainframe_y/2)-(this.mainframe_y/4));
		this.setBounds(new Rectangle(x, y, (this.mainframe_x/2), (this.mainframe_y/2)));
		this.setUndecorated(true);
		this.setTitle("AVS 5 - Host");
		this.setContentPane(getJContentPane());
	}
	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane() {
		if (jContentPane == null) {
			jContentPane = new JPanel();
			jContentPane.setLayout(new BorderLayout());
		}
		return jContentPane;
	}
}