Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Action Listeners  RSS feed

 
Marvin Hunkin
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi. got a problem. doing a eries of classes, and doing a gui. adding listeners. and tried googling, and looked through a few sites, and came across the forum, in my google search. will post the code. but when i try to compile , in the command prompt, says it cannot find it. am i stupid or what! looked at my previous code projects and examples. read the documentation. but cannot seem to find an answer to my problem. using the action command if then else... and then adding the variable from another class to the JOptionPane.showMessageDialog. can any one help me out. maybe it is so simple. i will show you the code.
if(e.ActionCommand().equals("btnName"))
{
JOptionPane.showMessageDialog(null, "My Name is: " + txtName() + " ");
System.exit(0);
btnName.setText("Show Name");
}
any help? how to get this to compile. any help. thanks Marvin. ps: any aussies on this forum.
 
Tushar Goel
Ranch Hand
Posts: 934
4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Marvin, What error you are getting while compiling?

also please use code tags.
 
Nam Ha Minh
Ranch Hand
Posts: 512
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Marvin Hunkin wrote:
if(e.ActionCommand().equals("btnName"))
{
JOptionPane.showMessageDialog(null, "My Name is: " + txtName() + " ");
System.exit(0);
btnName.setText("Show Name");
}



Hi, just one point: doing something after existing the JVM is meaningless.
 
Paweł Baczyński
Bartender
Posts: 1997
42
Firefox Browser IntelliJ IDE Java Linux Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nam Ha Minh wrote:
Marvin Hunkin wrote:
if(e.ActionCommand().equals("btnName"))
{
JOptionPane.showMessageDialog(null, "My Name is: " + txtName() + " ");
System.exit(0);
btnName.setText("Show Name");
}



Hi, just one point: doing something after existing the JVM is meaningless.

I once saw one post where the guy thought that System.exit is for closing JOptionPanes. Is this the case?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!