Risultati da 1 a 3 di 3

Discussione: java - dubbio estendere JFrame

  1. #1
    New Member
    Data Registrazione
    30-01-2008
    Messaggi
    44

    java - dubbio estendere JFrame

    ciao
    sto cercando di imparando ad usare java swing , perciò vorrei fare una schermata con JFrame ,ecc. ecc. ;
    una classe che bisogna fare deve sempre estende JFrame o c'è qualche altra tecnica ?
    grazie

    ciao

  2. #2
    Software Zone Maniac
    Cucciolo a vita
    L'avatar di MaStErYuRi
    Data Registrazione
    30-05-2004
    Località
    Caserta
    Messaggi
    2.931
    Non necessariamente
    Ad esempio:
    Codice:
    import javax.swing.*;        
     
    public class HelloWorldSwing {
        /**
         * Create the GUI and show it.  For thread safety,
         * this method should be invoked from the
         * event-dispatching thread.
         */
        private static void createAndShowGUI() {
            //Create and set up the window.
            JFrame frame = new JFrame("HelloWorldSwing");
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     
            //Add the ubiquitous "Hello World" label.
            JLabel label = new JLabel("Hello World");
            frame.getContentPane().add(label);
     
            //Display the window.
            frame.pack();
            frame.setVisible(true);
        }
     
        public static void main(String[] args) {
            //Schedule a job for the event-dispatching thread:
            //creating and showing this application's GUI.
            javax.swing.SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    createAndShowGUI();
                }
            });
        }
    }
    fonte

    PS Ti consiglio di seguire i tutorial ufficiali, gli esempi sono molto esplicativi, a me sono stati utili.
    http://docs.oracle.com/javase/tutorial/uiswing/TOC.html


  3. #3
    New Member
    Data Registrazione
    30-01-2008
    Messaggi
    44
    ok
    grazie mille

Segnalibri

Permessi di Scrittura

  • Tu non puoi inviare nuove discussioni
  • Tu non puoi inviare risposte
  • Tu non puoi inviare allegati
  • Tu non puoi modificare i tuoi messaggi
  •