wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes JFrame covering taskbar in maximized mode.... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JFrame covering taskbar in maximized mode...." Watch "JFrame covering taskbar in maximized mode...." New topic
Author

JFrame covering taskbar in maximized mode....

Manoj Amrutkar
Ranch Hand

Joined: Apr 15, 2006
Posts: 47
Hi,
I am having following problem in my swing gui based application.
When i maximized my JFrame It's covering taskbar. I have found out half the solution. I am using
JFrame.setDefaultLookAndFeelDecorated(true);
in constructor. And when i commented that thing the issue has been solved but only partially. Now the problem is the look and feel of the frame is chaged to window which was motif previously.
So can i get that motif look and feel somewhere else.(If without frame covering taskbar).

Thanks in Advance...

Manoj Amrutkar
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
try this, but the 30 is just a guess at the taskbar height

Manoj Amrutkar
Ranch Hand

Joined: Apr 15, 2006
Posts: 47
Thanks for your response but still it does not solve the problem as soon as i maximize the window the taskbar gets covered up.
After some more r and d i found out this if i do like this
import javax.swing.*;
import java.awt.*;

public class Testing
{
public Testing()
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame();
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setExtendedState(JFrame.MAXIMIZED_BOTH);////<--------covers taskbar
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
f.setSize(d.width, d.height-30);//<---take 30 off the height
f.setVisible(true);
Rectangle r = new Rectangle(0,0,d.width, d.height-30);
f.setMaximizedBounds(r);
}
public static void main(String[] args){new Testing();}
}

that solved my problem but some how the borders of the frame are looking thiker. I anybody has any solution plz suggest it to me

thanks in advance

Manoj Amrutkar
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
> it does not solve the problem as soon as i maximize the window....

if you just want the frame to be at either maximized-30, or iconified,
change
f.setSize(d.width, d.height-30);
Rectangle r = new Rectangle(0,0,d.width, d.height-30);
f.setMaximizedBounds(r);
f.setVisible(true);

to
f.setSize(d.width, d.height-30);
f.setResizable(false);//<-----------
f.setVisible(true);

now, all you can do is minimize to task bar or at maximized-30
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JFrame covering taskbar in maximized mode....