SHARE
TWEET

Untitled

Twixx0325 Jun 15th, 2019 51 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package notesapplication;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Dimension;
  5. import java.awt.event.ActionEvent;
  6. import java.awt.event.ActionListener;
  7. import java.sql.SQLException;
  8. import java.util.logging.Level;
  9. import java.util.logging.Logger;
  10. import javax.swing.JFrame;
  11. import javax.swing.JLabel;
  12. import javax.swing.JMenu;
  13. import javax.swing.JMenuBar;
  14. import javax.swing.JMenuItem;
  15. import javax.swing.JOptionPane;
  16.  
  17. public class NotesApplication extends JFrame {
  18.  
  19.     public NotesApplication() {
  20.         setTitle("Notes");
  21.         setLayout(new BorderLayout());
  22.  
  23.         JMenuBar menubar = new JMenuBar();
  24.         setJMenuBar(menubar);
  25.         JMenu fileMenu = new JMenu("File");
  26.         menubar.add(fileMenu);
  27.         JMenuItem exitMenuItem = new JMenuItem("exit");
  28.         fileMenu.add(exitMenuItem);
  29.         exitMenuItem.addActionListener((ActionEvent e) -> {
  30.             System.exit(0);
  31.         });
  32.         JMenu SetupMenu = new JMenu("Setup");
  33.         menubar.add(SetupMenu);
  34.         JMenuItem usersMenuItem = new JMenuItem("Users");
  35.         SetupMenu.add(usersMenuItem);
  36.  
  37.         usersMenuItem.addActionListener((ActionEvent e) -> {
  38.             try {
  39.             UserDialog dialog;
  40.                 dialog = new UserDialog();
  41.             } catch (SQLException ex) {
  42.                 JOptionPane.showMessageDialog(this,ex.getMessage());
  43.             }
  44.         });
  45.  
  46.         JLabel label = new JLabel("Notes Application", JLabel.CENTER);
  47.         label.setPreferredSize(new Dimension(500, 500));
  48.         add(label, BorderLayout.CENTER);
  49.         pack();
  50.         setDefaultCloseOperation(EXIT_ON_CLOSE);
  51.     }
  52.  
  53.     public static void main(String[] args) {
  54.         new NotesApplication().setVisible(true);
  55.     }
  56.  
  57. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top