aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Action Listeners in Card Layout. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Action Listeners in Card Layout." Watch "Action Listeners in Card Layout." New topic
Author

Action Listeners in Card Layout.

Nathaniel Waggoner
Greenhorn

Joined: Mar 21, 2011
Posts: 2
Hi all.

Im working with a multi page GUI. Each page has numerous text entry fields (3-5) for specific pieces of data. Each page also has a number of buttons (confirm, reset, go back etc...).

The program is structured so that the button you click directs you to a specific and unique page. This goes for up to four pages before returning to the title page.

I am using the card layout currently, though I am not tied to it. My question is this:

What is the best way to detect actions within the currently viewed page so that i can direct people to the correct next page? I have the cardLayout aspect working just fine - ie all pages are in the card layout, and viewable if hardCoded to do so, but I'm not sure how to track events in this circumstance. I have seen this code on other forums (Credited to Fubarable on Java Forums):


Code:


The last line is the lline I am interested in, and I am going to play with that a bit and see if I cant apply it to what I am doing. My main problem is that it is "new FirsPanel(firstPanelActionListener)" - does this add both a new instance of FirstPanel and its assoiciate action listener? Curious if anyone else has suggestions?

Thanks,

Nathan.


Nathaniel Waggoner
Greenhorn

Joined: Mar 21, 2011
Posts: 2
Ok sorry for the double post: here is my cardLayout code;::



You may notice that two of the pages follow a different naming convention. I had partners in this project - basically they turned into flakes. In a mighty fit of lazieness im trying to not redo those two pages, because i dont wanna.

How best to handle this??

Thanks guys.

Nathan
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19760
    
  20

Welcome to the Ranch!

Can you please UseCodeTags? You can edit your post to add them.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39818
    
  28
Rob Spoor wrote: . . . Can you please UseCodeTags? . . .
I added the tags to the second post, and we can see how much better it looked, but I left the first post because it lacked indentation.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39818
    
  28
I earlier wrote: . . . I left the first post because it lacked indentation.
The first post seems to be indented now, so I added code tags.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Action Listeners in Card Layout.