Java, Netbeans: What does the GUI look like?

I am new to Java / Netbeans learning how to make a GUI.

I followed this tutorial and I noticed that the "finished" product (the first image in this link) does not look like a graphical interface built using steps.

Why? I mean, when I click the preview button, the GUI looks like a native (good) one. It's just when it is deployed, that it looks all ... mmm ... bad. lol.

Is there a way to make the finished GUI visible? Are these Netbeans settings or Java settings?

Note. I am developing this on Windows.

+4
source share
3 answers

Use the following code to make swing choose a "system" appearance:

String laf = UIManager.getSystemLookAndFeelClassName(); UIManager.setLookAndFeel(laf); 
+10
source

By default, “Look and Feel” is metallic, which is good and good for cross-platform applications.

JDK has 4 built-in "looks" (now so far):

  • com.sun.java.swing.plaf.gtk.GTKLookAndFeel
  • javax.swing.plaf.metal.MetalLookAndFeel
  • com.sun.java.swing.plaf.windows.WindowsLookAndFeel
  • com.sun.java.swing.plaf.motif.MotifLookAndFeel

you can try any of these “looks and sensations” in 1 line, for example code:

 UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); 

NOTE: call / call this method of changing the "appearance" before any GUI implementation or throw some kind of exception

+2
source

This is called "appearance." You can use a different appearance when starting the application or programmatically. For more information, see This Sun tutorial .

+1
source

All Articles