Amruta
Amruta

Reputation: 469

Swing size issue for different screen resolution

I'm using Java Swing and I want to it to set its JFrame size and the size of inner components size based on Screen resolution. I also want it to be compatible on any device like Tablet, laptop. Any easy solution for this?

Upvotes: 1

Views: 1474

Answers (1)

mKorbel
mKorbel

Reputation: 109815

I also want it to be compatible on any device like Tablet,laptop.Any easy solution for this.

  • Put JScrollPane to JFrame, then put JPanel nested all JComponents to JScrollPane, then all JComponents are accesible for non-standard screens e.g net_books, crazy tablets with two or more Native OS (most of screen in Native OS there is scrolled by default)

I'm using Java Swing and I want to it to set its JFrame size and the size of inner components size based on Screen resolution.

  • This is a job for LayoutManager

  • for really better look is not possible without manage with Font size, basically there are a few screen ratios (4:3, 16:9 ...) with a corresponding pixels (screen) resolutions, rest of then to leave for JScrollPane
  • there is not universal advice, everything depends of your GUI, how JComponents are laid, number of JComponents, its Rectangle on the screen
  • about the arts, make it look nice and good concept, (then nothing complicated)

Upvotes: 3

Related Questions