Wątek przeniesiony 2014-07-05 11:05 z Java przez bogdans.

JFrame Design Preview

0

Cześć, mam pytanie, ponieważ przypisałem do przycisku Clear w moim menu GUI czyszczenie tekstu. Gdy odpalam podgląd menu, nic się nie dzieje. Czy to dobrze? Czy ma dziać się dopiero po kompilacji programu?

0

Chyba nie dobrze skoro nie robi tego co byś chciał. Program jest skompilowany w chwili gdy go uruchamiasz. Pokaż ten kod.

0

Usunąłem już jedną klasę (nie umiem się tym posługiwać), ale teraz udaje mi się kompilować kod.

Problem mam natomiast ze zmianą nazwy ramki.

 
public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(lokatowo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(lokatowo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(lokatowo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(lokatowo.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new lokatowo().setVisible(true);
                
            }
        });
    }

Jakby mi ktoś powiedział jak mam zmienić tą nazwę, to byłbym wdzięczny. Próbuję dodać pod new lokatowo().setVisible(true);
lokatowo frame = new lokatowo("My Title"); ale wyskakuje błąd o Stringu.

0

Dodaj w konstruktorze wiersz

setTitle("My Title");

1 użytkowników online, w tym zalogowanych: 0, gości: 1