Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Minimize and Maximize button in JDialog

 
chithra rasavelu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I need to add minimize and maximize button in the titlebar of JDialog. Is there a way to do this?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
where are you going to minimize it to?
 
chithra rasavelu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to minimize it to the parent window which is a frame.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
so, it's going to sit as a tiny icon, somewhere on the frame?
then click the icon to restore?

if that's what you're trying, one way might be:
set the dialog as undecorated,
build your own titleBar, adding min/max(restore)/X buttons
add the titleBar at borderLayout.NORTH of the dialog
add a motionListener to the titlebar, so the dialog can be dragged to a new location
add a border to the dialog
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think what you actually need is JDesktopPane and JInternalFrame.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic