• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Scott Selikoff
Bartenders:
  • Piet Souris
  • Jj Roberts
  • fred rosenberger

How to Disable Minimize button in JFrame ? - URGENT

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to disable the minimize button and stop it from going to the windows taskbar.
Is there anyway I can do it ??
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if its a JInternalFrame: setIconable(false);
if its a JFrame:
addWindowListener(new WindowAdapert()
{
public void windowIconified(WindowEvent e)
{
// reopen
}
});
unfortunately, there is no event to notify you that the frame is going to be iconified. you should consider using an JInternalFrame (if its not the main window of your app) or a JDialog.
chantal
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I think, setting the property of JFrame, setResizable(false); should do it

JFrame f = new JFrame();
f.setResizable(false);
Cheers
George Justin
 
Ranch Hand
Posts: 1492
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
George,
You can't remove the window decorations from within Java on JFrame because the underlaying OS draws the frame.
Resizable just stops a user from enlarging or shrinking the frame. It doesn't affect OS operations at all (i.e., iconification, closing, etc).
Regards,
Manfred.
 
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You could make it a JWindow... it doesn't have any window decorations at all, so it can't be minimized...

-Nate
 
Pratik Khetia
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nathan Pruett:
You could make it a JWindow... it doesn't have any window decorations at all, so it can't be minimized...

-Nate



But I can't even close that window. It doesn't show anything like no close button. I can not even move that window.
Could you tell me how to do that ??
Pratik
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Make a graphic for a close button, load it as an imageicon, and add it to a JButton. Put that JButton in the upper right hand corner, and in it's actionListener that closes the window or exits the program. Moving the window is a bit more of a problem... you'll either have to add a component that listens for the movement (like have a JPanel that listens for mousePressed events, and any mousePressed event in it lets you move the frame) or have the whole frame listen for the movement. I personally think that a special component is better, because you can change it's color or something to show that it's seperate from the display area.

The following code is a bit crude, but it illustrates these ideas:



-Nate
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic