Cara coloque seus códigos usando a tag [code], facilita para galera te ajudar, existe algum erro de compilação.
proazevedo
Pedrosa:
Cara coloque seus códigos usando a tag [code], facilita para galera te ajudar, existe algum erro de compilação.
Ok, mas como eu coloco Tag code ?
proazevedo
Pedrosa:
Cara coloque seus códigos usando a tag [code], facilita para galera te ajudar, existe algum erro de compilação.
Sou tão iniciante que não sei nem como colcar tag code.
Pedrosa
Ao postar algum código aqui no forum existe um botão code, coloque antes do código e no final e tenha algo assim:
if(x.equals("asd")){
....
}
proazevedo
[quote=Pedrosa]Cara coloque seus códigos usando a tag
,facilitaparagalerateajudar,existealgumerrodecompilação.[/quote][code]packageprojeto1;importTela2_JFrame;publicclassTela1_JFrameextendsjavax.swing.JFrame{/** Creates new form Tela1_JFrame */publicTela1_JFrame(){initComponents();}// <editor-fold defaultstate="collapsed" desc=" Generated Code ">privatevoidinitComponents(){jButton1=newjavax.swing.JButton();jLabel1=newjavax.swing.JLabel();nome=newjavax.swing.JTextField();jButton2=newjavax.swing.JButton();jLabel2=newjavax.swing.JLabel();ender=newjavax.swing.JTextField();setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);jButton1.setText("Tela2");jButton1.addMouseListener(newjava.awt.event.MouseAdapter(){publicvoidmousePressed(java.awt.event.MouseEventevt){jButton1MousePressed(evt);}});jLabel1.setText("Nome :");jButton2.setText("Fim");jButton2.addMouseListener(newjava.awt.event.MouseAdapter(){publicvoidmousePressed(java.awt.event.MouseEventevt){jButton2MousePressed(evt);}});jLabel2.setText("Ender :");org.jdesktop.layout.GroupLayoutlayout=neworg.jdesktop.layout.GroupLayout(getContentPane());getContentPane().setLayout(layout);layout.setHorizontalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(30,30,30).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().add(jLabel2).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(ender,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,282,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(layout.createSequentialGroup().add(jButton1).add(15,15,15).add(jButton2)).add(layout.createSequentialGroup().add(jLabel1).addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED).add(nome,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,232,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))).addContainerGap(49,Short.MAX_VALUE)));layout.setVerticalGroup(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING).add(layout.createSequentialGroup().addContainerGap().add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel1).add(nome,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(18,18,18).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jLabel2).add(ender,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE,org.jdesktop.layout.GroupLayout.DEFAULT_SIZE,org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)).add(25,25,25).add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE).add(jButton1).add(jButton2)).addContainerGap(185,Short.MAX_VALUE)));pack();}// </editor-fold>privatevoidjButton1MousePressed(java.awt.event.MouseEventevt){Tela2_JFrame.setVisible(true);// Chamo o outro frame }privatevoidjButton2MousePressed(java.awt.event.MouseEventevt){System.exit(0);// TODO add your handling code here:}/** * @param args the command line arguments */publicstaticvoidmain(Stringargs[]){java.awt.EventQueue.invokeLater(newRunnable(){publicvoidrun(){newTela1_JFrame().setVisible(true);}});}// Variables declaration - do not modifyprivatejavax.swing.JTextFieldender;privatejavax.swing.JButtonjButton1;privatejavax.swing.JButtonjButton2;privatejavax.swing.JLabeljLabel1;privatejavax.swing.JLabeljLabel2;privatejavax.swing.JTextFieldnome;// End of variables declaration}
raikk0n3n
Tenta mudar de evento para ActionEvent e trocar o frame2 por JDialog