• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 22781
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic