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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.