• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

How to start a JFrame in maximized mode  RSS feed

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to computationally maximize my JFrame (behavior like pressing the windows maximize button (middle one)).
I would have suspected some methods in java.awt.Window, but haven't found anyone.
Have anyone tried this?
Thanks,
Steffen
 
Steffen Foldager
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use java.awt.Frame.setExtendedState()
In myJFrame:
setExtendedState(MAXIMIZED_BOTH);
I used setState, which was "obsolete" (not deprecated) and didn't work.
Gotta stop replying myself....
 
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is new to me, thanks for the tip.
but I have another one, I just found it:
file:///local_home/lib/j2sdk1.4_api/docs/api/java/awt/GraphicsDevice.html#setFullScreenWindow(java.awt.Window)
I have not tried it yet, so I don't know if it works ok. it's new in 1.4 that might explain why it's not that known.
have you worked with GraphicsEnvironment yet?
c
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok, here is the www link :roll:
"http://java.sun.com/j2se/1.4/docs/api/java/awt/GraphicsDevice.html#setFullSreenWindow(java.awt.Window)"
c
 
Steffen Foldager
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi c.
Isn't there a difference between maximized state (Frame is as big as possible, but still with the frame borders visible) and full-screen mode (e.g. DVD-players)?
I haven't used the GraphicsDevice package, but isn't it more graphics-oriented? Maybe it can help me with my }&%##!!! update problems on our splash-screen.
Thanks,
Steffen
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might try this:
[CODE]
import java.awt.*;//Where the Toolkit is located, I think
public class jFileFormat extends JFrame
{
//... Var declarations
//--+-- --+-- --+-- --+-- --+-- --+-- --+-- --+-- --+-- --+-- --+--
public jFileFormat()
{
//CONSTRUCTOR
super("Johns jFileFormat");//The JFrame Title
Toolkit tk = Toolkit.getDefaultToolkit();//see Cay Horstman, p. 273 , Core Java I
Dimension d = tk.getScreenSize(); //Gets the user screen size
int scrnHigh = d.height; //Pulls out the High
int scrnWide = d.width; //Pulls out the Wide
//setSize(scrnWide *9/10, scrnHigh *9/10);//sets screen to 0.9 size
setSize(scrnWide, scrnHigh);//sets screen to FULL size
//setLocation(scrnWide *1/20, scrnHigh *1/20);//CENTER it for 9/10th size
setLocation(0, 0);//
Image icn = tk.getImage("snp_bluT.gif");//Frame Icon
this.setIconImage(icn);//Set Icon
//... CONSTRUCTOR More code
}//~End of CONSTRUCTOR
// ... CLASS code continues
}//~END of CLASS
[!CODE]
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!