Tem como um botão de um JDialog chamar outro JDialog??
JDialog chamando outro JDialog
2 Respostas
Da sim, cara!
Da uma olhada:
package testes;
import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JFrame;
public class Teste10 extends JFrame implements ActionListener {
/**
*
*/
private static final long serialVersionUID = 4884940064914957907L;
private Button botao;
private static int num;
public Teste10() {
this.botao = new Button("Ok");
this.botao.setBounds(10, 10, 100, 25);
this.botao.addActionListener(this);
this.getContentPane().add(this.botao);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setBounds(10, 10, 150, 100);
this.setLayout(null);
}
public Button getBotao() {
return botao;
}
public void setBotao(Button botao) {
this.botao = botao;
}
public static void main(String[] args) {
new Teste10().setVisible(true);
}
public void actionPerformed(ActionEvent e) {
getDialog();
}
private JDialog getDialog(){
JDialog dialog = new JDialog(this, false);
dialog.setTitle("Dialog " + num);
dialog.setBounds(10, 10, 200, 100);
JButton bot = new JButton("Outro JDialog");
bot.setBounds(10, 10, 150, 25);
bot.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
num++;
getDialog();
}
});
dialog.add(bot);
dialog.setLayout(null);
dialog.setVisible(true);
return dialog;
}
}
Não sei se era isso que vc queria!
[]'s
intao eu preciso por exemplo um cadastro de cliente JDialog tenha um botao e chame um outro Jdialog q seria a consulta cliente tambem JDialog
Criado 24 de novembro de 2008
Ultima resposta 26 de nov. de 2008
Respostas 2
Participantes 2