Pessoal tenho duas classes, uma que e o main e outra que e meu formulario jPanel onde esta a função que estou fazendo.
porem quando mando visualizar diz que ta compilado e ok, porem não aparece na tela. o que falta ?
[code]
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
package principal;
/**
*
-
@author Stetika
*/
public class Main {/**
-
@param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
new exercicio1().setVisible(true);
}
-
@param args the command line arguments
}[/code]
e a classe visual
[code]
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
/*
- exercicio1.java
- Created on 12/03/2009, 11:51:46
*/
package principal;
import javax.swing.JOptionPane;
/**
*
-
@author Stetika
*/
public class exercicio1 extends javax.swing.JPanel {/** Creates new form exercicio1 */
public exercicio1() {
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”)
//
private void initComponents() {jLabel1 = new javax.swing.JLabel();
edtNumero = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();jLabel1.setText(“Informe um Numero do Mes”);
edtNumero.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
edtNumeroActionPerformed(evt);
}
});
edtNumero.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyPressed(java.awt.event.KeyEvent evt) {
edtNumeroKeyPressed(evt);
}
});javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(jLabel2, javax.swing.GroupLayout.DEFAULT_SIZE, 371, Short.MAX_VALUE)
.addContainerGap())
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(131, 131, 131)
.addComponent(edtNumero, javax.swing.GroupLayout.DEFAULT_SIZE, 95, Short.MAX_VALUE)
.addGap(165, 165, 165))
.addGroup(layout.createSequentialGroup()
.addGap(122, 122, 122)
.addComponent(jLabel1, javax.swing.GroupLayout.DEFAULT_SIZE, 147, Short.MAX_VALUE)
.addGap(122, 122, 122))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(23, 23, 23)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(edtNumero, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(19, Short.MAX_VALUE))
);
}//
private void edtNumeroActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
int numero = Integer.parseInt(this.edtNumero.getText());switch(numero){ case 1: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Janeiro"); break; case 2: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Fevereiro"); break; case 3: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Março"); break; case 4: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Abril"); break; case 5: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Maio"); break; case 6: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Junho"); break; case 7: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Julho"); break; case 8: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Agosto"); break; case 9: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Setembro"); break; case 10: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Outubro"); break; case 11: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Novembro"); break; case 12: JOptionPane.showMessageDialog(null, "Mes Digitado foi de Dezembro"); break; default: JOptionPane.showMessageDialog(null, "Mes Invalido"); }
}
private void edtNumeroKeyPressed(java.awt.event.KeyEvent evt) {
// TODO add your handling code here:
}// Variables declaration - do not modify
private javax.swing.JTextField edtNumero;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
// End of variables declaration -
}[/code]