thomas
Posts: 42
Nickname: turbomanic
Registered: Jul, 2002
|
|
Re: how 2 make GUI from application
|
Posted: Aug 19, 2002 5:42 AM
|
|
sorry for the above post there is alot of errors in that programme, major errors.
THE BELOW PROGRAMME WORKS PERFECTLY
import java.awt.event.*; import java.awt.*; public class FileCreator extends Frame implements ActionListener{ MenuBar mb; Menu file; MenuItem close;
public FileCreator(){ setLayout(null); setSize(600,600); mb=new MenuBar(); setMenuBar(mb);//adds menubar to frame file=new Menu("file"); mb.add(file);//adds file to menubar close=new MenuItem("close"); file.add(close);//adds close to menu close.addActionListener(this); show();//shows the frame (window) }//end of constructor
public void actionPerformed(ActionEvent evt){ if(evt.getSource()==close){ dispose();//destroys frame ending programme }//end of if }//end of action performed
public static void main(String [] args){ FileCreator frame=new FileCreator(); }//end of main
}//end of class
SORRY FOR ANY INCONFIENCE
|
|