tags:

views:

410

answers:

3

can i disable minimize button in frame?how?(i hav already tried setUndecorated() and setResizable().both didnt work). i m trying to add imags to a panel at a random location which i m able to do) bt wen frame is minimized by clicking at the minimize button (not wen frame minimizes by clicking at the background window) images assemble at the top in a row.

help guys..... thanks

A: 

If you also want to disable the maximize button then you can use a JDialog instead of a JFrame... as far as I know you cannot disable the minimize button in a JFrame. JDialog only has a close button. Hope this helps

pgmura
A: 

i m trying to add imags to a panel at a random location which i m able to do) bt wen frame is minimized by clicking at the minimize button (not wen frame minimizes by clicking at the background window) images assemble at the top in a row.

Well, it sounds like you are adding labels to a panel and using the setLocation() method to position the labels.

The problem is that by default a JPanel uses a FlowLayout so whenever you do anything to the frame like minimize, maximize, iconify or resize the frame the layout manger is invoked and the labels are arranged according the the rules of the layout manager.

If your requirement is to have random positioning, then you need to use a "null layout".

Read the section from the Swing tutorial that explains how Absolute Positioning works for more information and a working example.

camickr
A: 

Use JDialog instead of JFrame it has only the Close button on the top.

Ram