Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package notesapplication;
- import java.awt.BorderLayout;
- import java.awt.Dimension;
- import java.awt.event.ActionEvent;
- import java.sql.SQLException;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JMenu;
- import javax.swing.JMenuBar;
- import javax.swing.JMenuItem;
- import javax.swing.JOptionPane;
- public class NotesApplication extends JFrame {
- public NotesApplication() {
- setTitle("Notes");
- setLayout(new BorderLayout());
- JMenuBar menubar = new JMenuBar();
- setJMenuBar(menubar);
- JMenu fileMenu = new JMenu("file");
- menubar.add(fileMenu);
- JMenuItem exitMenuItem = new JMenuItem("exit");
- fileMenu.add(exitMenuItem);
- exitMenuItem.addActionListener((ActionEvent e) -> {
- System.exit(0);
- });
- JMenu setupMenu = new JMenu("setup");
- menubar.add(setupMenu);
- JMenuItem userMenuItem = new JMenuItem("user");
- setupMenu.add(userMenuItem);
- userMenuItem.addActionListener((ActionEvent e) -> {
- UsersDialog dialog;
- try {
- dialog = new UsersDialog();
- dialog.setVisible(true);
- } catch (SQLException ex) {
- JOptionPane.showMessageDialog(this, ex.getMessage());
- }
- });
- JMenuItem setupMenuItem = new JMenuItem("setup");
- JLabel label = new JLabel("Notes Application", JLabel.CENTER);
- label.setPreferredSize(new Dimension(500, 500));
- add(label, BorderLayout.CENTER);
- pack();
- setDefaultCloseOperation(EXIT_ON_CLOSE);
- }
- public static void main(String[] args) {
- new NotesApplication().setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement