Ok, I will give you my experience. I prefer SWT and Eclipse as a whole, simply because it integrates much more beautifully and is so flexible with additional points and much more, but I sometimes understand that this is overkill.
When using swing, I almost always use GridBagLayout if the form is not very simple. This is due to the fact that most of the graphical interfaces that I design or use contain many elements that are not necessarily laid out in a stream or table style. Gridbaglayout offers the ability to draw ui in the java way like + allow resizing if necessary, or you can prevent this from happening.
The specific things I use are:
GridBagConsts.insets = new Insets(2,2,2,2);
This adds an addition to any gridbaglayout cell, which makes it look more like a program developed for Gtk / MS than something that I dumped together.
try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { System.out.println("Error setting native LAF: " + e); }
Customizing the look of the system - I'm not a fan of the fact that the built-in theme (metal) and integration with the system are much more friendly.
This is about him for tough and quick rules. Things I suggest you look at:
Other than that, it is very application specific and you will need to read the overall user interface design. In general, it helps to use built-in controls and tools, that is, those that look like a system. For example, the Java Class Library includes File Choosers: http://java.sun.com/docs/books/tutorial/uiswing/components/filechooser.html , which when installed on an LAF system displays as Windows or Gnome (-ish) . Taking steps to familiarize yourself with each other application will in turn simplify your application.
user257111
source share