|
import java.awt. *;
import java.awt.event. *;
import java.io. *;
import javax.swing. *;
import javax.swing.text. *;
// Simple text editor implements ActionListener
public class edit extends JFrame implements ActionListener {
JTextPane textPane = new JTextPane (); // Text pane, edit window
Ranch
JFileChooser filechooser = new JFileChooser (); // File selector
public edit () {// Constructor
super ("Simple text editor");
JMenuBar menubar = new JMenuBar ();
Container container = getContentPane (); // Get the container
Ranch
container.add (textPane, BorderLayout.CENTER); // Add text pane
container.add (menubar, BorderLayout.NORTH); // Add status bar
setSize (330, 200); // Set window size
setVisible (true); // Set window visible
setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE); // Exit the program when the window is closed
JMenu menuFile = new JMenu ("File"); // Instantiate the menu
JMenu menuEdit = new JMenu ("Edit");
JMenu menuAbout = new JMenu ("Help");
JMenuItem menu1 = new JMenuItem ("New");
menu1.addActionListener (this);
menuFile.add (menu1);
Ranch
menubar.add (menuFile); // Add menu
menubar.add (menuEdit);
menubar.add (menuAbout);
Ranch
Ranch
}
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
public void actionPerformed (Action e) {
Ranch
Ranch
Ranch
Ranch
Ranch
}
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
Ranch
public static void main (String [] args) {
new edit ();
}
Ranch
}
What's wrong with this code?
The old compiler prompts me to edit shoule bu decelared abstract |
|