Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Games/Application (Video output, Frame, Graphics Components,Versatility)

  1. #1
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Games/Application (Video output, Frame, Graphics Components,Versatility)

    im about to finish the game project that im writing with this past few months , as of the moment, its working properly and for a few weeks im about to have a project defense on my school, thanks to those people here who helped me alot, thanks so much

    now i want to ask a question that could be usefull in my future developments, especially with this game,
    my game is developed with in component(Frame) JFrame, setting its size , dimensions etc, in common way using its methods,
    my question is about versatility, what would be the best way to make my application's frame versatile, for example:

    no matter what size of screen(monitor) my frame(My application) will have a dimension relatively to it. it will adjust its size, because before this is my major problem, i was developing an application in my 17' inch monitor, everything was fine, but when i deployed it in a smaller size, it looks awful, i just want to have a guideline how can it be possible to my applications to adjust itself (size/dimension/resolution) to what ever type of environment it will be. i was able to do something to compensate with it using the Toolkit, getting the monitors size, subtracting and adding some numbers on the frame

    Maybe the good question will be the ff:
    1.) Is there a better way?
    2.) Classes to be used
    3.) where should i start searching and studying

    sorry for the bad english , i hope you understand my thought, any corrections will be appreciated. thanks


  2. #2
    Forum old-timer
    Join Date
    Nov 2008
    Location
    Faversham, Kent, UK
    Posts
    471
    My Mood
    Mellow
    Thanks
    4
    Thanked 58 Times in 54 Posts

    Default Re: Games/Application (Video output, Frame, Graphics Components,Versatility)

    If you want your app to size correctly according to the screen resolution size (not the same as its physical dimensions), use Toolkit.getScreenSize(), and size your main frame appropriately. If you use suitable layouts for the components within the main frame, they will automatically position and size the components.

  3. The Following User Says Thank You to dlorde For This Useful Post:

    chronoz13 (July 7th, 2011)

  4. #3
    Java kindergarten chronoz13's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    659
    Thanks
    177
    Thanked 30 Times in 28 Posts

    Default Re: Games/Application (Video output, Frame, Graphics Components,Versatility)

    how about the images ive drawn, for example i created 100x50 image and it suits in my LCD, it will be small in a bigger screen..
    i encountered a Graphics Environment/devices classes, will it do some adjustment when my application is run in a wider screen?

  5. #4
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,357
    My Mood
    Hungover
    Thanks
    144
    Thanked 626 Times in 537 Posts

    Default Re: Games/Application (Video output, Frame, Graphics Components,Versatility)

    There is an argument against doing that, actually. Some users aren't going to want you to change your window based on their screen size or resolution- in theory, they have it set up that way because that's how they want it, and it sort-of goes against Java's ideals (in my humble opinion, anyway) to work around them. If a user wants your window to be bigger, the user can either change the screen resolution or the frame size.

    It might even be impossible to fully work around- you can get the screen's resolution, but not its physical size. And without that, you can't know how big your frame actually is.

    That being said, what you could do is look at how your images are being downscaled. Or you could just allow the user to resize the JFrame at will- you might have to do something to keep the proper aspect ratio (or not), but it will give the user the most freedom.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Graphics class NullPointerException Initialize Graphics Class??
    By bglueck in forum What's Wrong With My Code?
    Replies: 7
    Last Post: May 13th, 2011, 11:13 PM
  2. Replies: 2
    Last Post: March 16th, 2011, 06:32 AM
  3. Adding a frame/textarea to an application
    By zincc in forum What's Wrong With My Code?
    Replies: 2
    Last Post: March 5th, 2011, 03:43 PM
  4. 2D Java Applet Games
    By bbr201 in forum Java Theory & Questions
    Replies: 26
    Last Post: August 27th, 2010, 09:12 AM
  5. Help! how would you code these simple games?
    By makarov in forum Java Applets
    Replies: 1
    Last Post: November 14th, 2009, 11:31 AM