Skip to main content

Posts

Showing posts with the label java frame

Java Code Menu And Menu Items

Java Code Menu And Menu Items import java.awt.*; import java.awt.event.*; import javax.swing.*; import javax.swing.event.*; import java.io.*; import javax.swing.SwingUtilities; import javax.swing.undo.*; class MyMenu1 implements ActionListener { JFrame f; JMenuBar menubar; JMenu menu,submenu; JMenuItem menuitem; JRadioButtonMenuItem rbmt; JCheckBoxMenuItem cbmt; JTextArea ta; DataInputStream dis; JFileChooser fc,fc1; String record=null; JScrollPane sp; protected UndoManager undo; MyMenu1() { f=new JFrame("my notepad"); f.setBounds(0,0,1200,1000); menubar=new JMenuBar(); ta=new JTextArea(); ta.setEditable(true); int v=JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED;int h=JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED; sp=new JScrollPane(ta,v,h); sp.setVerticalScrollBarPolicy(v); sp.setHorizontalScrollBarPolicy(h); sp.setBounds(0,30,1130,750); sp.setVisible(true); f.add(sp); undo=new UndoManager(); //file menu menu=new JMenu("File"); m...