Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JInternalFrame TitleBar Modify

 
Satheesh Thekku Veethil
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello
I have a need for a JInternalFrame to have a customized look. It should have a small button which toggles between minimize and maximize. So basically i want to modify the titlebar. Further during minimize, I don't want the Internal frame to become an Icon. Rather only the title bar should remain at the same place.
Need some suggestions!!!
 
Sudharsan Govindarajan
Ranch Hand
Posts: 319
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
If u don't like the Metal L&F of the JInternalFrame, change it to some other L&F (like motif/windows). If u r still not satisfied, implement your own L&F.
Reg. the behavior during minimize, i think we can't help it.
 
Satheesh Thekku Veethil
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the response!
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can override minimization behavior by writing your own DesktopManager class and setting it on the JDesktopPane your JInternalFrames are on...

You may have to actually modify DesktopManager, JInternalFrame, and JDesktop to get the behavior you want...

On a previous project I made a JDesktopPane with a taskbar like windows, and minimizing JInternalFrames actually just called setVisible( false ) on them...

I will see if I can find the code... perhaps it will help you do what you want...
 
Satheesh Thekku Veethil
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nathan
Thanks for the info. If you gimme a sample code, it would be really helpful.
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK... looks like what I did was set a DesktopManager like the following on my JDesktopPane...



I added a property to my JDesktopPane also, I called it "OPEN_FRAMES_PROPERTY" and it returned an array of Objects... (this could be the frames themselves, or just the names of frames, depending on what you need to do...)

Then I created a TaskBar class that was a PropertyChangeListener to the JDesktopPane and got events whenever a frame was added or removed. When I got an event, I would pass the actionCommand( the name of the button and the name of the frame ) to a method like the following...

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic