serialVersionUID
is a number that helps Java avoid version conflicts when you send an object from one place to another. For example, you can send the state of your JFrame
object to another computer’s screen. Then the other computer can check the frame's version number to make sure that no funny business is taking place.So, when would you bother to change a class’s serialVersionUID
number? If version number 1 is nice, is version number 2 even better? The answer is complicated, but the bottom line is, don’t change the serialVersionUID
number unless you make incompatible changes to the class’s code. By “incompatible changes,” this means changes that make it impossible for the receiving computer’s existing code to handle your newly created objects.
For more details about the serialVersionUID
and what constitutes an incompatible code change, check out Oracle.
For example, you can change the text on a button’s face by changing the text entry in the button’s spreadsheet. When you right-click or control-click the picture of a component, you get the option of jumping to the component’s actionPerformed
method. In the actionPerformed
method, you add Java code, such as button.setText("You clicked me!")
. Tools like WindowBuilder, GUI Designer, and GUI Builder make the design of GUI interfaces quicker, more natural, and more intuitive.
Since 1998, Swing has been Java’s primary framework for developing GUI applications. But late in 2011, Oracle added a newer framework — JavaFX — to Java’s core. JavaFX provides a richer set of components than Swing. But for simple applications, JavaFX is more difficult to use. If you’re interested in reading more about JavaFX, visit Oracle's Getting Started with JavaFX page.