| 120 | /// |
| 121 | /// a newly created Command instance |
| 122 | public static Command create(String name, Image icon, final ActionListener ev) { |
| 123 | Command cmd = new Command(name) { |
| 124 | @Override |
| 125 | public void actionPerformed(ActionEvent evt) { |
| 126 | ev.actionPerformed(evt); |
| 127 | } |
| 128 | }; |
| 129 | cmd.setIcon(icon); |
| 130 | return cmd; |
| 131 | } |
| 132 | |
| 133 | /// Creates a new command instance that encapsulates the action listener and details, the main |
| 134 | /// value of this approach is in our ability to write commands using the shorthand lambda syntax |