0

I have written many simple GUIs, they worked fine. However as a beginner I always think that my way of writing user interfaces is not very good practice.

Is it proper practice if one uses more panels to get the desired interface? Also is the use of the setBounds() method good?

mhsjlw
  • 322
  • 3
  • 16
Ahmad
  • 21
  • 8

1 Answers1

0
  1. The less sub-components you use, the more responsive your UI is going to be. Simply because it has less things to deal with.

  2. I would not recommend using 'setBounds` as it is creates inflexible UI in most cases. I would encourage you to start using layouts such as BorderLayout, FlowLayout etc. The most versatile of them is MigLayout

Here is more general information about Swing layouts: https://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html

Eugene Ryzhikov
  • 17,131
  • 3
  • 38
  • 60