Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (576)
games submitted by our members
Games in WIP (498)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Stupid Swing/AWT question..  (Read 1474 times)
0 Members and 1 Guest are viewing this topic.
Offline ArchangelMorph

Senior Newbie




Java games rock!


« Posted 2005-03-18 10:53:49 »

I kno this question is probably very noobish but i'm stuck and i need to figure out how to make my application start-up maximised (covering the whole screen, not windowed..)?

Is it a method of the JFrame class or the Frame class?

Can anybody help me please!!

- ArchangelMorph -
Offline CaptainJester

JGO Knight


Medals: 12
Projects: 2


Make it work; make it better.


« Reply #1 - Posted 2005-03-18 11:01:56 »

There is no easy way with Java.  Since that is not cross-platform behaviour, it was not built into the API.  You would have to use:

GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDisplayMode()

This will return a DisplayMode object which has the width, height, bits per pixel and refresh rate of the current screen settings.  You can then set your JFrame to the size of the entire window.

Offline ArchangelMorph

Senior Newbie




Java games rock!


« Reply #2 - Posted 2005-03-18 11:09:35 »

Oops I don't think I was very clear in my question:

I don't mean "Full-screen" as in the kinda full-screen u'd be looking at if you was making a game fior example,

I mean not windowed by default, like when u click on the little 'maximise' button in the top-right-hand-corner of a windows application and it can either make it 'maximised', 'windowed' or send it to the bar at the bottom..

Like I said, noobish question.. Embarrassed

Hope someone can help?

- ArchangelMorph -
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #3 - Posted 2005-03-18 11:21:32 »

on a JFrame  : setExtentedState(JFrame.MAXIMIZED_BOTH);

Lilian

Offline ArchangelMorph

Senior Newbie




Java games rock!


« Reply #4 - Posted 2005-03-18 11:24:08 »

I love u man!!!!!!

Thanx sooooo much!!

Grin Grin Grin

- ArchangelMorph -
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #5 - Posted 2005-03-18 11:37:30 »

Your're welcome... but let's just stay friends ;-)

Lilian

Offline ArchangelMorph

Senior Newbie




Java games rock!


« Reply #6 - Posted 2005-03-18 11:43:30 »

Also if i wanna change the ImageIcon for the JFrame once it's been iconised then what method do I call?


- ArchangelMorph -
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #7 - Posted 2005-03-18 12:16:33 »

well, add a windowListener (or a windowStateListener) to the frame, and
setIconImage() on state change.

You'd better have a look at the java tutorial on www.java.sun.com

Lilian

Offline ArchangelMorph

Senior Newbie




Java games rock!


« Reply #8 - Posted 2005-03-18 12:25:22 »

I've just been taking a look now and it seems as though the setIconImage() method takes in an Image object..

does this mean I can still use my ImageIcon object with the method or do I have to create a seperate Image object?

If so then how do I use the Image class to reference an Image file such as a Gif or BMP?

Is it the same as using an ImageIcon or do I have to do it a different way?

I've tried to figure it out looking at the methods/consructors etc.. of the Image class but I can't seem to make head's or tails of any of it..

(I'm sorry I must apologise at my lack of knowledge of GUI programming in Java.. I'm very new to the whole thing so..)

- ArchangelMorph -
Offline c_lilian

Senior Member


Projects: 1


Java games will probably rock someday...


« Reply #9 - Posted 2005-03-18 12:30:52 »

ImageIcon icon;
Image i = icon.getImage(); and that's it !

Lilian

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ArchangelMorph

Senior Newbie




Java games rock!


« Reply #10 - Posted 2005-03-18 17:23:14 »

Ur such a god-send!!

Thanks soo much!!

- ArchangelMorph -
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (16 views)
2014-04-15 18:08:23

BurntPizza (14 views)
2014-04-15 03:46:01

UprightPath (27 views)
2014-04-14 17:39:50

UprightPath (12 views)
2014-04-14 17:35:47

Porlus (29 views)
2014-04-14 15:48:38

tom_mai78101 (51 views)
2014-04-10 04:04:31

BurntPizza (110 views)
2014-04-08 23:06:04

tom_mai78101 (211 views)
2014-04-05 13:34:39

trollwarrior1 (180 views)
2014-04-04 12:06:45

CJLetsGame (185 views)
2014-04-01 02:16:10
List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:05:20
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!