jwright9
asked on
Java Swing Message Box in a Struts action
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.
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
frame.add(button);
frame.setSize(400, 400);
frame.setVisible(true);
frame.setDefaultCloseOpera
}
public class MyAction implements ActionListener{
public void actionPerformed(ActionEven
JOptionPane.showMessageDia
}
}
}
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER