aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Click to open another window, what is the problem with my ActionListen? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Click to open another window, what is the problem with my ActionListen?" Watch "Click to open another window, what is the problem with my ActionListen?" New topic
Author

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

Beginner Lady
Greenhorn

Joined: Dec 12, 2008
Posts: 1
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

Joined: Oct 27, 2005
Posts: 19762
    
  20

"Beginner Lady",

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

Thank you,

Rob


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4658
    
    5

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 ]

luck, db
There are no new questions, but there may be new answers.
 
Don't get me started about those stupid light bulbs.
 
subject: Click to open another window, what is the problem with my ActionListen?