Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Swing / AWT / SWT and the fly likes When calling another class, leaving the current class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "When calling another class, leaving the current class" Watch "When calling another class, leaving the current class" New topic
Author

When calling another class, leaving the current class

Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

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

Joined: May 03, 2008
Posts: 4523
    
    5

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.


luck, db
There are no new questions, but there may be new answers.
Vishal Hegde
Ranch Hand

Joined: Aug 01, 2009
Posts: 1050

If a method is calling other method in other class it goes to that class method and comes back to the original class...



http://www.lifesbizzare.blogspot.com || OCJP:81%
Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

I can not understand.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13872
    
  10

Gustavo, can you explain more clearly exactly what you want to know?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

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

Joined: Jan 03, 2004
Posts: 6109
    
    6

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

Joined: Dec 28, 2007
Posts: 2246

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?


Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
Gustavo Siqueira
Ranch Hand

Joined: Jun 15, 2011
Posts: 97

I want that exiting the current window, and enter in other window.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> 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

Joined: Jun 15, 2011
Posts: 97

Hello!
The problem was solved!
Thanks a lot the all!
 
 
subject: When calling another class, leaving the current class
 
Similar Threads
where its going wrong ?
package???
Inner classes in static context
Is a monitor the same thing as a lock?