Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / April 2007

Tip: Looking for answers? Try searching our database.

Taskbar hides when Swing GUI gets maximized

Thread view: 
Goofball - 11 Apr 2007 16:46 GMT
When I maximize a JFrame that was created in the application, it hides
the Windows taskbar. I am using default Swing Look and Feel decorated
windows. Anybody knows how the problem can be fixed? Thanks.
Andrew Thompson - 11 Apr 2007 17:15 GMT
>When I maximize a JFrame that was created in the application, it hides
>the Windows taskbar.

Really?  When I run this code on Windows, the
taskbar appears over the top of the bottom part
of the JFrame.

<sscce>
import java.awt.*;
import javax.swing.*;

class FullScreenFrame {
 public static void main(String[] args) {
   JFrame f = new JFrame("Big");
   f.setDefaultCloseOperation(
     JFrame.EXIT_ON_CLOSE);
   f.setExtendedState(Frame.MAXIMIZED_BOTH);
   f.setVisible(true);
 }
}
</sscce>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Real Gagnon - 11 Apr 2007 18:11 GMT
"Goofball" <yuriytkach@gmail.com> wrote in news:1176306362.928077.52620
@e65g2000hsc.googlegroups.com:

> When I maximize a JFrame that was created in the application, it hides
> the Windows taskbar. I am using default Swing Look and Feel decorated
> windows. Anybody knows how the problem can be fixed? Thanks.

Try this :
import java.awt.*;
import javax.swing.*;

public class TestMaxJFrame extends JFrame {
 public TestMaxJFrame() {
  GraphicsEnvironment env =
    GraphicsEnvironment.getLocalGraphicsEnvironment();
  /*
    The next line determines if the taskbar (win) is covered.
  */
  this.setMaximizedBounds
             (env.getMaximumWindowBounds()); // taskbar not covered
  this.setExtendedState(this.getExtendedState() | this.MAXIMIZED_BOTH);
 }

 public static void main(String[] args) {
  JFrame.setDefaultLookAndFeelDecorated(true);
  TestMaxJFrame t = new TestMaxJFrame();
  t.setVisible(true);
 }
}

Bye.
Signature

Real Gagnon  from  Quebec, Canada
* Java, Javascript, VBScript and PowerBuilder code snippets
* http://www.rgagnon.com/howto.html
* http://www.rgagnon.com/bigindex.html



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.