A 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.

Every major Java IDE has visual tools to help you design a GUI interface. With any of these tools, you drag components from a palette onto a frame. (The components include buttons, text fields, and other goodies.) Using the mouse, you can move and resize each component. As you design the frame visually, the tools creates the frame’s code automatically. Each component on the frame has a little spreadsheet showing the component’s properties.

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.

About This Article

This article is from the book:

About the book author:

Dr. Barry Burd holds an M.S. in Computer Science from Rutgers University and a Ph.D. in Mathematics from the University of Illinois. Barry is also the author of Beginning Programming with Java For Dummies, Java for Android For Dummies, and Flutter For Dummies.

This article can be found in the category: