Scusa ma a me questa funziona (ho solo cambiato nome alla classe... chiamarla Frame con una classe Frame che già esiste proprio no...)
codice:import java.awt.*; import javax.swing.*; public class MyFrame extends JFrame{ // costruttore public MyFrame() { super(); this.setTitle("prova"); // this.steLocaton(300,300); //si aspetta due int // toolkit per interrogare la scheda grafica per sapere i pixel Toolkit tk = Toolkit.getDefaultToolkit(); // abbiamo tre classi molto utili point(con due cassetti int x e y) e // dimension(heigth,width) e rectangle(tutti e 4 i cassatte) Dimension dim = tk.getScreenSize(); System.out.println(dim); this.setSize(dim.width / 2, dim.height / 2); this.setLocation(dim.width / 4, dim.height / 4); this.getContentPane().setBackground(Color.cyan); this.setVisible(true); // this.setExtendedState(JFrame.MAXIMIZED_BOTH);// MAXIMIDE_BOTH//E DOPO // SET VISIBLE this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // OPPURE: EXIT_ON_CLOSE,HIDE_ON_CLOSE, DISPOSE_ON_CLOSE,distrugge // this.setResizable(false);//non la fa modificare } /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub new MyFrame(); } }

Rispondi quotando