Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- class MenuExample {
- JFrame frame;
- MenuExample(){
- frame = new JFrame();
- JMenuBar menuBar = new JMenuBar();
- JMenu file = new JMenu("file");
- JMenu export = new JMenu("Export");
- JMenuItem createFile = new JMenuItem("create");
- JMenuItem png = new JMenuItem("as png");
- JMenuItem jpg = new JMenuItem("as jpg");
- export.add(png);
- export.add(jpg);
- menuBar.add(file);
- file.add(createFile);
- file.add(export);
- frame.setJMenuBar(menuBar);
- frame.setSize(400,400);
- frame.setVisible(true);
- }
- }
- public class GUI{
- public static void main(String[] args){
- new MenuExample();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement