Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Click to open another window, what is the problem with my ActionListen?

 
Beginner Lady
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everybody,

I think that my question is simple, but I've tried a lot to know the problem! �
I hope that somebody can help me..

I am using NetBeans IDE 6.1. I have 2 swing JFrames, Window1 and Window2. The first one contains a button which supposes to open the other JFrame whenever it is clicked.

I have used the ActionListener, but the other window is not opened, nothing happens, and no error!

I have a very big code, but this is an example of what I need:

I put the code of Window1, because I didn't change anything in Window2 . Also, I didn't put the code of the interface design itself, just to make the code simpler.



What is wrong with my code? no window is opened!
If I can do it in another way, let me know. I just want the window to be opened in anyway.. I've read many tutorials about this, but all of them are making both windows in the same class, not in separated classes as mine.. In my case, I have to separate them..


I am waiting your help.. Thank you in advance!
 
Rob Spoor
Sheriff
Pie
Posts: 20511
54
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Beginner Lady",

you probably missed our naming policy. Can you please change your name so it doesn't violate the policy?

Thank you,

Rob
 
Darryl Burke
Bartender
Posts: 5125
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you think this does?


I suggest you spend some more time with basics before you get into GUIs and use IDEs that autogenerate code you haven't a clue about.

edit The ActionListener is also never added to the button. Following a NetBeans naming convention doesn't automagically run code.

Here's a good learning resource: The Java� Tutorials: Creating a GUI with JFC/Swing
[ December 12, 2008: Message edited by: Darryl Burke ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic