File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes JList Selection & Main Execution Thread Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "JList Selection & Main Execution Thread" Watch "JList Selection & Main Execution Thread" New topic

JList Selection & Main Execution Thread

henri henri
Ranch Hand

Joined: Oct 03, 2005
Posts: 115
First of all, I am working with a JList and an InternalFrameListener for a JInternalFrame.

My JList has to serve two functions. If the JInteralFrame using the method below is closed, a selection made in the JList will open an undecorated JFrame containg information about a specific actor. If the JInternalFrame is open, this function is foregone and the selection made will go into the text box meant for that item and the JFrame previously mentioned will not appear. I am trying to detect when the JInternalFrame is open or closed by using a boolean flag.
The flag used in the method below works for the method clearText() which clears all text in every text box once the window is closed. So I know it works. The boolean is a static member and is therfore expected to be used in the main class with dot notation to test for whether the JInternalFrame is open or closed.
I used it as such if(AddTitleFrame.isClosed) doSomething(); // in main class

It doesn't work.

henri henri
Ranch Hand

Joined: Oct 03, 2005
Posts: 115

This screenshot can better illustrates what exactly I am trying to do.
The undecorated JFrame should appear if the JInternalFrame is closed after clicking on an item in a JList that you don't see because it is behind the CardPanel on the right where you see the 26 buttons.
Ilja Preuss

Joined: Jul 11, 2001
Posts: 14112
What do you mean with "it doesn't work"? What is not happening that you did expect to happen, in detail?

The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
henri henri
Ranch Hand

Joined: Oct 03, 2005
Posts: 115

Thank you for your interest in my problem.
I have the above code in my JInternalFrame (AddTitleFrame) class.
isClosed is a static class member with default access.
it is initially declared false.

I try to use it in my main class whose visual representation you can see if you follow the above link. The boolean flag is what does not work.
I want it to work so that if the JInternalFrame is closed, when a user clicks on an actor name in the JList to the right of the visual guide, the undecorated actor JFrame will appear. If the JInternalFrame is open then the JFrame containg the ActorBean information will not open if an actor name in the list is click. It is a question of notification, but the boolean does not work in this case. It has something to do with a thread I was told. I have tried everything!!

I agree. Here's the link:
subject: JList Selection & Main Execution Thread
It's not a secret anymore!