Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

creating a component somewhere else.

Thread view: 
atilagunes@gmail.com - 31 Aug 2006 10:15 GMT
Hi,

i'll try to tell you what i need to learn..

I have a special panel class extends from JPanel, i'm calling this
class from my application class which runs main JFrame and i send image
list to my panel class. it creates buttons with images as icon and it
assings handler for mouse clicking to these buttons.. i want to write a
code for this listener. when pushing to one of these buttons, it will
create a jInternalFrame and image will be showed as thumpnails in this
jInternalFrame. .. this JInternal frame will be out of bounds of JPanel
and will be undependent from Jpanel. it will belong to main JFrame..

i wrote a method in main application to create JInternalFrame but i
cant reach it from JPanel class.. what should i do, can you give me
some hints ? at least, can you write some words for googling..

Thanks in advance.
Atila Gunes
Oliver Wong - 31 Aug 2006 17:14 GMT
> Hi,
>
[quoted text clipped - 12 lines]
> cant reach it from JPanel class.. what should i do, can you give me
> some hints ? at least, can you write some words for googling..

   If I understand correctly, you want to create an instance of
JInternalFrame (call it I for Internal) in your action listener (call it L
for Listener), and then have this instance be visible from some JFrame (call
it F for Frame) than the listener L.

   If you can pass an instance of F to L, then you could add a field to F
to store the instance of I, and add some setters and getters. Then, when the
listener code in L executes, it calls the setter on F to pass a reference to
I.

<pseudoCode>
class F extends JFrame {
 private JInternalFrame myInternalFrame;

 public void setInternalFrame(JInternalFrame value) {
   this.myInternalFrame = value;
 }
}

class L implements SomeListener {
 public final F myF;

 public L(F myF) {
   this.myF = myF;
 }

 public void fireEvent() {
   myF.setInternalFrame(new JInternalFrame());
 }
}
</pseudoCode>

   - Oliver


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.