|
error in my internalframe, why?
As far as i know this should display a internalframe when the menuitem doc is clicked but it comes up with a whole list of errors. when i correct them and run it they appear again could someone please tell me why and help me correct it! thanks
import javax.swing.JFrame;
import javax.swing.UIManager;
import javax.swing.JDesktopPane;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionEvent;
public class frame {
private static String doc;
public static void main(String[] args) {
//create the frame
JFrame frame = new JFrame("FrameDemo");
UIManager.LookAndFeelInfo.setPreferredLookAbdFeel(frame.class);
frame.setVisible(true);
//set up esktoppane
JDesktopPane desk = new JDesktopPane();
//construct the menubar and to items
JMenuBar mb = new JMenuBar();
JMenu file = new JMenu("File");
JMenuItem New = new JMenuItem("New");
//Optional: What happens when the frame closes?
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
//Create components and put them in the frame.
frame.add(mb);
frame.add(file);
frame.add(New);
New.addActionListener(frame);
frame.setJMenuBar(mb);
// Size the frame.
frame.pack();
//6. Show it.
frame.setVisible(true);
}
public void actionperformed(ActionEvent e) {
if ("new".equals(e)) {
GetActtionComand();
}
show(fr);
{
}
// make a internal
protected void createFrame() { //illegal start of exspresion
InternalFrame fr = new JInternalFrame("doc");
JDesktopPane d = new JDesktopPane();
fr.setVisable(true);
fr.setSelected(true);
//quit operation
Quit(0);
System.exit(0);
};
}
/**
* GetActtionComand
*/
private void GetActtionComand() {
}
}
|