Manually Positioning Buttons in a Java Applet

You can use Java’s layout managers to maintain the relative position of objects in an applet without manually repositioning them as the applet’s size changes. However, you may occasionally want to stipulate absolute layout coordinates for objects such as buttons or other menu-related components. To do so, you must use the statement:

 SetLayout(null); 

Place the code where you would ordinarily specify the name of the layout manager. If you proceed without a layout manager, you also have to use the add and reshape methods to add, position, and size the component.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

Recent Articles: