I found the listed program on Roseindia.net. Great site I recommend it. Here is the code:
import javax.swing.*;
import java.awt.event.*;
public class ShowDialogBox{
JFrame frame;
public static void main(String[] args){
ShowDialogBox db = new ShowDialogBox();
}
public ShowDialogBox(){
frame = new JFrame("Show Message Dialog");
JButton button = new JButton("Click Me");
button.addActionListener(n
ew MyAction());
frame.add(button);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOpera
tion(JFram
e.EXIT_ON_
CLOSE);
}
public class MyAction implements ActionListener{
public void actionPerformed(ActionEven
t e){
JOptionPane.showMessageDia
log(frame,
"Roseindia
.net");
}
}
}
I want to display the JOptionPane running it from a Struts Action class. Is this possible sinceI'm afraid I must run in a JFrame or something like that? I want to display informational messages and warnings using is. Any ideas?
Thanks.
Start Free Trial