Last change
on this file since 193 was
193,
checked in by Maciej Komosinski, 10 years ago
|
Set svn:eol-style native for all textual files
|
-
Property svn:eol-style set to
native
|
File size:
438 bytes
|
Rev | Line | |
---|
[84] | 1 | package com.framsticks.util.swing; |
---|
| 2 | |
---|
| 3 | import javax.swing.*; |
---|
| 4 | |
---|
| 5 | /** |
---|
| 6 | * Author: Piotr Śniegowski |
---|
| 7 | */ |
---|
| 8 | public class MenuConstructor { |
---|
| 9 | protected final JMenu menu; |
---|
| 10 | |
---|
| 11 | public MenuConstructor(JMenu menu) { |
---|
| 12 | this.menu = menu; |
---|
| 13 | } |
---|
| 14 | |
---|
| 15 | public MenuConstructor add(KeyStroke accelerator, Action action) { |
---|
| 16 | JMenuItem item = new JMenuItem(action); |
---|
| 17 | if (accelerator != null) { |
---|
| 18 | item.setAccelerator(accelerator); |
---|
| 19 | } |
---|
| 20 | menu.add(item); |
---|
| 21 | return this; |
---|
| 22 | } |
---|
| 23 | |
---|
| 24 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.