• 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
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Navigating between two JFrame in Java Swing

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys!

Right now I am trying to open a new JFrame as soon as I hit the corresponding button on my current active GUI.But somehow, the Frame won´t be displayed,just the titlebar without title and all the components. If I start the class/JFrame solely,it displays perfectly.Just in combination with the "main" GUI, I just won´t get the second GUI to display correctly.

Here´s what I got so far:



So THIS is the class/frame I want to call in my actionPerformed-method in my Main Class, called MyFrame(). Of course this class right here also has a actionPerformed()-method for its buttons and two other methods which are not important for navigation purposes.
Can anyone help?I don´t know,how to properly open this frame!?

What I tried so far is something like this inside the actionPerformed()-method of the MyFrame-class:


But that just won´t do the trick...

Greetings,

Randy
 
Marshal
Posts: 76860
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why are you using two frames? Why are you not using a dialogue?
 
Randy Miller
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ritchie!

Pretty simple: Cause the main frame doesn´t have anything to do with the second frame I want to open ;)
Functionally that is ;)
I just want to keep these two frames pretty much non-depending on each other ;)
And I think, a simple dialog wouldn´t do the trick for me ;)
But if you got an easier idea,just fire it at me ;)
 
Campbell Ritchie
Marshal
Posts: 76860
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That sounds like two independent apps to me.
 
Randy Miller
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is,sort of ;)
The additional frame adds new functions to the main frame ;)
And of course,the second frame does some calculating(better say parsing),which means,a normal user dialog wouldn´t be enough to do the trick,right?
Now,how can I get this stuff to work?
 
Campbell Ritchie
Marshal
Posts: 76860
366
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You oughtn’t to be parsing in a Frame. A Frame is a display, and you should have a separate parser class.
 
Randy Miller
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys!

Thanks for your help so far ;)
I solved the problem already
Wasn´t too hard though ;)
Just like you suggested,I seperated the logic from my frame and just used the frame for displaying purposes.
And now,finally,the navigation works just like a machine ;)
Thanks to all of you
 
Campbell Ritchie
Marshal
Posts: 76860
366
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well done
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic