{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Slides0420 - -Hint – Use a JFileChooser to support Save...

Info icon This preview shows pages 1–12. Sign up to view the full content.

View Full Document Right Arrow Icon
Slides 4/20 COP 3330
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Topics Discrete Structures Review
Image of page 2
Topics JUST KIDDING!
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Topics Menu Bars
Image of page 4
Menu Bars There are three main classes to be concerned with when building a menu bar - JMenuBar – The menu bar itself - JMenu – A drop-down menu on the menu bar - JMenuItem – An individual item on a menu
Image of page 5

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Menu Bars
Image of page 6
Menu Bars To attach a menu bar to a JFrame, use the setJMenuBar method on the JFrame
Image of page 7

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Menu Bars To be able to respond to menu selections, register ActionListeners with the JMenuItems This is just like being able to respond to button clicks
Image of page 8
Example Write a simple text editor with a menu bar - Hint – Embed a JTextArea on a JScrollPane
Image of page 9

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 10
Image of page 11

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 12
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: -Hint – Use a JFileChooser to support Save and Open options Accelerators • Key combinations that can be used to trigger menu items are known as accelerators • Use the setAccelerator method to give a JMenuItem an accelerator • Use the static getKeyStroke method on KeyStroke to specify the key combination Mnemonics • Menus can be navigated with the keyboard by using mnemonics • These are the underlined letters you see all over most menus • Use the setMnemonic method on JMenu and JMenuItem to specify the mnemonics Example • Add mnemonics and accelerators to the text editor program...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern