trabajando independientemente de la resolucionpublic static void Centrate(Container frame){
Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
Dimension frameSize=frame.getSize();
if(frameSize.height>screenSize.height){
frameSize.height=screenSize.height;
}
if(frameSize.width>screenSize.width){
frameSize.width=screenSize.width;
}
frame.setLocation((screenSize.width-frameSize.width)/2,(screenSize.height-frameSize.height)/2);
}
public static void tamañoenprocentaje(Container frame, Double poraltura,Double porancho){
//poner el alto y el ancho en porcentaje de la ventana
poraltura=poraltura/100;
porancho=porancho/100;
frame.setSize((int)(Toolkit.getDefaultToolkit().getScreenSize().getWidth()*porancho),
(int)(Toolkit.getDefaultToolkit().getScreenSize().getHeight()*poraltura));
}
macsimisando Ventanathis.setExtendedState(JFrame.MAXIMIZED_BOTH);