Estou fazendo um applet com muitas janelas. Cada janela é um Jpanel, exceto a principal
que é um japplet. Na hora de instanciar e mandar exibir o jpanel, a partir do japplet, o jpanel não aparece.
Alguém sabe dizer a forma correta de fazer isso ?
Obrigado,
Rafael
public class Interface_de_algoritmo extends javax.swing.JApplet {
/** Initializes the applet Interface_de_algoritmo */
public void init() {
try {
java.awt.EventQueue.invokeAndWait(new Runnable() {
public void run() {
//
//jDesktopPane1.setVisible(false);
//
initComponents();
}
});
} catch (Exception ex) {
ex.printStackTrace();
}
}//init
//Dispara quando o user aperta o botão
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
//Instancia o jpannel
teste3 t=new teste3();
//Exibe o jpannel
t.setVisible(true);
}//Quando user aperta o botao
// Variables declaration - do not modify
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton jButton1;
private javax.swing.JDesktopPane jDesktopPane1;
private javax.swing.JFrame jFrame1;
private javax.swing.JLabel jLabel1;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenu jMenu3;
private javax.swing.JMenu jMenu4;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuBar jMenuBar2;
private javax.swing.JRadioButton jRadioButton1;
private javax.swing.JRadioButton jRadioButton2;
private java.awt.Label label1;
// End of variables declaration
}//class
public class teste3 extends javax.swing.JPanel {
/** Creates new form teste3 */
// private Interface_de_algoritmo idalgo;
public teste3(Interface_de_algoritmo idalgo) {
// this.idalgo=idalgo;
// teste1 t=new teste1();
// t.setVisible(true);
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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
jLabel1.setText("Teste!!!");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 165, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(0, 165, Short.MAX_VALUE)))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(0, 143, Short.MAX_VALUE)
.addComponent(jLabel1)
.addGap(0, 143, Short.MAX_VALUE)))
);
}// </editor-fold>
// Variables declaration - do not modify
private javax.swing.JLabel jLabel1;
// End of variables declaration
}