Visualizzazione dei risultati da 1 a 5 su 5

Discussione: [java] applet e swing

  1. #1

    [java] applet e swing

    Ciao a tutti sapete farmi un piccolo esempio di applet che utilizza swing per visualizzare, ad esempio, una label?
    Ciao

  2. #2
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    18
    ciao,

    ho visto ora che avevi aperto una discussione con lo stesso quesito che mi hai lanciato in quella di ambretta.

    Un esempio semplice di swing è l'input da utente di una stringa da impostare come titolo del frame aperto.


    se vuoi anche il codice fammi sapere.

  3. #3
    Sul mio sito trovi un'applet scritta intermanete utilizzando il pakage javax.swing. Se vuoi visitalo, così io mi faccio anche un po' di pubblicità.


    Ciao ciao.

    Denis

  4. #4
    ed il sorgente per risolvere il mio quesito?
    Grazie

  5. #5
    Di seguito la classe "java"

    _____________________
    /*
    * JApplet.java
    *
    * Created on 22 ottobre 2002, 19.26
    */

    /**
    *
    * @author denis76
    */
    public class JApplet extends javax.swing.JApplet {

    /** Creates new form JApplet */
    public JApplet() {
    initComponents();
    }

    /** This method is called from within the constructor to
    * initialize the form.
    * WARNING: Do NOT modify this code. The content of this method is
    * always regenerated by the Form Editor.
    */
    private void initComponents() {
    jLabel1 = new javax.swing.JLabel();
    jButton1 = new javax.swing.JButton();

    jLabel1.setText("jLabel1");
    getContentPane().add(jLabel1, java.awt.BorderLayout.CENTER);

    jButton1.setText("Clicca qua");
    jButton1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jButton1ActionPerformed(evt);
    }
    });

    getContentPane().add(jButton1, java.awt.BorderLayout.NORTH);

    }

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
    jOPInformazioni= new javax.swing.JOptionPane();
    jOPInformazioni.showMessageDialog(null, "Eccomi qua!");
    jLabel1.setText("Sono una javax.swing.JLabel!!!!!!!!");
    }

    private javax.swing.JOptionPane jOPInformazioni;
    // Variables declaration - do not modify
    private javax.swing.JLabel jLabel1;
    private javax.swing.JButton jButton1;
    // End of variables declaration

    }
    ________________
    //
    //
    //
    //
    // Ora la pagina "html"
    _________________<html>
    <head>
    <title>Applet HTML Page</title>
    </head>
    <body>

    <h3><hr WIDTH="100%">Applet HTML Page<hr WIDTH="100%"></h3>




    <applet code="JApplet.class" width=350 height=200></applet>
    </p>

    <hr WIDTH="100%"><font SIZE=-1>Generated by NetBeans IDE</font>

    </body>
    </html>
    ___________

    Se la classe, dopo compilazione, nn ti funziona nel tuo Browser, nel mio sito trovi la spiegazione.
    Ciao ciao.

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.