Creating the Robot's Window

So how do you start creating the Robot? This project uses Java Swing to present the window you see in Figure 7.1. The main class, RobotProject (called that so as not to conflict with the Java Robot class), extends the Swing JFrame class and implements the ActionListener class to be able to handle events such as button clicks:

					class RobotProject extends JFrame implements ActionListener
{
    .
    .
    .
}

You can find the significant methods of the JFrame class in Table 7.1.

Table 7.1. Significant Methods of the javax.swing.JFrame Class
MethodDoes This
protected JRootPane createRootPane()Called internally in order to create the default rootPane object
protected void frameInit()Called internally to initialize the JFrame object ...

Get Java™ After Hours: 10 Projects You'll Never Do at Work now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.