aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes There should no close and minimize button on the frame what i have to do? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "There should no close and minimize button on the frame what i have to do?" Watch "There should no close and minimize button on the frame what i have to do?" New topic
Author

There should no close and minimize button on the frame what i have to do?

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
Dear ranchar i have a code as follow


By the above code we know that when above code will execute we will get a farme window with 3 Button(Minimize,Restore, and close) button on upper right corner of the frame by the way i want that , those three button shoude not be prsent on the frame for that case what i have to do kindly solve this problem.

Regard

Arun
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
did you really need to post this same/similar question about 15 times?

anyway, set the frame to the defaultLookAndFeel, then recursively iterate the
frame's components looking for the buttons, and remove them.
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

Originally posted by Michael Dunn:
did you really need to post this same/similar question about 15 times?


Nope, he sure didn't.

Arun, please don't post the same question more than once. See here for an explanation of why I just deleted the other copies of this thread.


[Jess in Action][AskingGoodQuestions]
Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
Well sir but how will i recursivly iterate the frame to search for button.

"I have posted my question many time because i haven't got my answer" what's wrong with my question In my software my requrment is that when the program will execute the minimise,maximise and store button of frame shoude not work but i havn't got answer still.
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> "I have posted my question many time because i haven't got my answer"

all within a short period of time.
if it's that urgent - pay someone for immediate service (try rent-a-coder etc)

this works on 1.4.0_01, but may need tweaking in later versions

Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Arun Maalik:
farme window with 3 Button(Minimize,Restore, and close) button on upper right corner of the frame by the way i want that , those three button shoude not be prsent on the frame


You may want to try MyFrame.setUndecorated(true).

To that you can add something like MyFrame.getRootPane().setWindowDecorationStyle(JRootPane.PLAIN_DIALOG), though that is merely a hint. Some Look and Feels ignore it.


Let me reiterate what others have said about multiple posts. Post only once and wait at least a couple of days before creating another thread. Multiple posts are rude, plus they give a powerful disincentive to experts who could otherwise help you.
[ January 11, 2007: Message edited by: Brian Cole ]

bitguru blog
Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
Thanks for the code But see i just wanted to know that as like this

Frame.setDefaultCloseOpertaion(Frame.DO_NOTHING_ON_CLOSE);

the above method is used for the purpose that if anybody will click on close Button nothing will happen okay fine. Now i just wanted to know that is is there any other method so that i can perform the same operation on Minimize,and Restore Button like
Frame.setDefaultMinimizeOperation(Frame.DO_NOTHING_ON_MINIMZE)//But it is not a function
so i am asking that is there any such types of function

Still i am wating for this answer

By the way Thank to javaRanch
Brian Cole
Author
Ranch Hand

Joined: Sep 20, 2005
Posts: 862
Originally posted by Arun Maalik:
Now i just wanted to know that is is there any other method so that i can perform the same operation on Minimize,and Restore Button like
Frame.setDefaultMinimizeOperation(Frame.DO_NOTHING_ON_MINIMZE)//But it is not a function
so i am asking that is there any such types of function

Still i am wating for this answer


Here's your answer: No. No such methods exist.

But if you do what I suggested above then your frame won't have minimize or restore buttons. Did you try it?

(If your LnF doesn't support the hint, it won't have a close box or a border either. The Metal LnF supports the hint, but the current Mac LnF doesn't. I haven't tested any others.)
[ January 11, 2007: Message edited by: Brian Cole ]
Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
Now i am realy happy finaly i got answer thanks to you pepole that "no such method" basicaly i was willing to know that is such types of method or not.

I tested your code that working problem is in main method that you can not instatiate new Runnable() which you are passing in a function of main like
SwingUtilities.invokeLater(new Runnable);//error Runnable is abstract can't instatiated

and
btn.addActionListener(new ActionEvent())//error can't instantiate new ActionEvent.

But any how that code is very big hint for me now i will solved my problem.

Thanks to JAVA RANCH
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> the way i want that , those three button shoude not be prsent on the frame

> Now i just wanted to know that is is there any other method so that i can
> perform the same operation on Minimize,and Restore Button like
> Frame.setDefaultMinimizeOperation(Frame.DO_NOTHING_ON_MINIMZE)

do you really know what you want?
the buttons cannot both 'be there' and 'not be there'

going by the latter statement,if you change this line from the earlier code
comp.getParent().remove(comp);
to
MouseListener[] mls = comp.getMouseListeners();
for(int x =0; x < mls.length; x++) comp.removeMouseListener(mls[x]);

and also remove setResizabe(false), the buttons will appear, but nothing
will happen if you click on them (1.5.0_05 now), and I would consider this
to be a very bad design - Frame.DO_NOTHING_ON_CLOSE is designed to allow you
to add a windowListener with additional functionality e.g. confirm you want to close

if the above change suits your needs, be aware you can still double-click
the titleBar to maximize the frame - if this is not required you'll have to
look into MetalTitlePane for the modification
[ January 12, 2007: Message edited by: Michael Dunn ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: There should no close and minimize button on the frame what i have to do?