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

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

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

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

View Full DocumentRight Arrow Icon
Topics Discrete Structures Review
Background image of page 2
Topics JUST KIDDING!
Background image of page 3

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

View Full DocumentRight Arrow Icon
Topics Menu Bars
Background 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
Background image of page 5

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

View Full DocumentRight Arrow Icon
Menu Bars
Background image of page 6
Menu Bars To attach a menu bar to a JFrame, use the setJMenuBar method on the JFrame
Background image of page 7

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

View Full DocumentRight 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
Background image of page 8
Example Write a simple text editor with a menu bar - Hint – Embed a JTextArea on a JScrollPane
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

View Full DocumentRight Arrow Icon
Background 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

This note was uploaded on 02/09/2010 for the course CS COP 3330 taught by Professor Douglass during the Spring '09 term at University of Central Florida.

Page1 / 12

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

This preview shows document pages 1 - 12. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online