• Post Reply Bookmark Topic Watch Topic
  • New Topic

swingset2 demo source?  RSS feed

 
Tony Fabeets
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the swingset2 demo (java swingset demo) the frames don't have all 3 standard minimize/maximize/close buttons. There anywhere to get the swingset2 demo source code, or anyone know how to ommit the close button from a jframe?
 
Joe Ess
Bartender
Posts: 9406
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The frames in question are javax.swing.JInternalFrames. You can control the displayed window decorations with JInternalFrame's methods setMaximizable, setIconifible and setClosable as well as boolean flags in the JInternalFrame constructor. The source code is available by clicking on the tab marked "Source Code" in the upper-left-hand corner of the display as well as in the <java home>/demo/jfc/SwingSet2 if you installed the demos with your JDK.
[ January 13, 2004: Message edited by: Joe Ess ]
 
Tony Fabeets
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
answered my question, but not exactly what i'm looking for. I would like to have something similar to JInternalFrame.closable(false) for a JFrame. the JFrame housed my entire program. want it so the user can only exit the prog via JMenuItem("exit");
[ January 14, 2004: Message edited by: Tony Fabeets ]
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can just call setDefaultCloseOperation( WindowConstants.DO_NOTHING_ON_CLOSE ) on the frame. The button will still be there, but it won't do anything.

If resizing isn't important, you can create a frame with no decorations ( either through setUndecorated( true ) or just use a JWindow ), fill it with a JDesktopPane, and add a JInternalFrame that takes up the whole thing.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!