Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

AWT GUI frames differ widely in size between PC screen sizes

Java NeophyteJan 1 2019 — edited Jan 10 2019

I just finished a Java AWT class at the local college where the professor stayed away from the GUI frame layout code. As a student I went with his assignments and didn't give this another thought. I then wrote a small app that uses Java GUI and it works great on one PC (24" screen)  but on a smaller screened PC (14")  the frames are very small, too small. I thought that defining GUI frames and their components in pixels would take care of this but apparently not. Here is a small snippet of a frame def:

// FRAME components

    

  this.setSize(800,400);                   // <-- Frame size

  this.setLayout(null);

  this.setVisible(true);

  this.setTitle("GPMain");

  this.setBackground(Color.LIGHT_GRAY);

Is there a straightforward way to port apps over to other PC's whose screens are much smaller (24" down to 14") and have the frames compensate for the difference in screen size? The smaller screen's frames are way to small to be useful.

Many thanks from a newbie...

Comments

Processing

Post Details

Added on Jan 1 2019
1 comment
266 views