Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

When calling another class, leaving the current class

 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
For example.



User clicks on the button and exit the current class and enter into a new class.
How to do this ?


Thanks a lot!
 
Darryl Burke
Bartender
Posts: 5126
11
Java Netbeans IDE Opera
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
User clicks on the button and exit the current class and enter into a new class.
How to do this ?

Your question doesn't really make sense to me, but I have one comment: drop the NetBeans visual designer -- it's not a beginners' tool, despite what Oracle would have you believe -- and learn to code Swing GUIs by hand. This tutorial (omitting the second topic in the trail) will get you started.

You might get better help if you describe what exactly you want to do -- not how you hope to do it.
 
Vishal Hegde
Ranch Hand
Posts: 1077
Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If a method is calling other method in other class it goes to that class method and comes back to the original class...

 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I can not understand.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15281
39
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gustavo, can you explain more clearly exactly what you want to know?
 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alright.
Well, I have an class initial that contains buttons.
For example: Click here!
When the user press the button Click here, will take him to another class, leaving the current class.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gustavo Hackum wrote:Alright.
Well, I have an class initial that contains buttons.
For example: Click here!
When the user press the button Click here, will take him to another class, leaving the current class.


Well, yes, whenever you call a method, you temporarily leave the execution of the calling method's code. When the called method completes, we pick up where we left off in the caller. If the called method is in another class, the same thing happens.

I have no idea what question you're trying to ask, however.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Likes 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gustavo Hackum wrote:When the user press the button Click here, will take him to another class, leaving the current class.


Do you mean another class or another window?
 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want that exiting the current window, and enter in other window.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I want that exiting the current window, and enter in other window.

appears you are 'extending' JFrame for both windows, so, in your actionListener it would be something like this

new Window2().setVisible(true);
Window1.this.dispose();

however, if your intention is to return to Window1, Window2 should be a modal JDialog,
meaning you cannot access Window1 until Window2 is dispose()'d
 
Gustavo Siqueira
Ranch Hand
Posts: 97
C++ Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!
The problem was solved!
Thanks a lot the all!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic