Introduction to GUI programming

Lab 10

 

We will create a frame with a title, menubar and buttons and labels in its contentPane for this lab.

 

  1. Create a frame using JFrame Class. Name this frame “My Frame” or any other title you want to.
  2. Add a menu bar to this frame. The menu bar will have two menus File and Edit

File Menu will have three Menu Items Open, Save, Print.

Edit Menu will have three Menu Items Copy, Cut and Paste

  1. Create two Labels and three buttons using JLabel and JButton Classes.
  2. Add this to the content Pane using BorderLayout Manager.
  3. Add ActionListeners to all the menu items and buttons. Whenever a Component is selected or clicked on, the information about that component should be printed.