use of java.util.EventObject in project JMRI by JMRI.
the class AppsLaunchFrame method editMenu.
protected void editMenu(JMenuBar menuBar, WindowInterface wi) {
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
menuBar.add(editMenu);
// cut, copy, paste
AbstractAction a;
a = new DefaultEditorKit.CutAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCut"));
editMenu.add(a);
a = new DefaultEditorKit.CopyAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCopy"));
editMenu.add(a);
a = new DefaultEditorKit.PasteAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemPaste"));
editMenu.add(a);
// prefs
prefsAction = new apps.gui3.TabbedPreferencesAction(Bundle.getMessage("MenuItemPreferences"));
// Put prefs in Apple's prefered area on Mac OS X
if (SystemType.isMacOSX()) {
Application.getApplication().setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(EventObject eo) {
prefsAction.actionPerformed(null);
}
});
}
// Include prefs in Edit menu if not on Mac OS X or not using Aqua Look and Feel
if (!SystemType.isMacOSX() || !UIManager.getLookAndFeel().isNativeLookAndFeel()) {
editMenu.addSeparator();
editMenu.add(prefsAction);
}
}
use of java.util.EventObject in project JMRI by JMRI.
the class Apps method editMenu.
protected void editMenu(JMenuBar menuBar, WindowInterface wi) {
JMenu editMenu = new JMenu(Bundle.getMessage("MenuEdit"));
menuBar.add(editMenu);
// cut, copy, paste
AbstractAction a;
a = new DefaultEditorKit.CutAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCut"));
editMenu.add(a);
a = new DefaultEditorKit.CopyAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemCopy"));
editMenu.add(a);
a = new DefaultEditorKit.PasteAction();
a.putValue(Action.NAME, Bundle.getMessage("MenuItemPaste"));
editMenu.add(a);
// prefs
prefsAction = new apps.gui3.TabbedPreferencesAction(Bundle.getMessage("MenuItemPreferences"));
// Put prefs in Apple's prefered area on Mac OS X
if (SystemType.isMacOSX()) {
Application.getApplication().setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(EventObject eo) {
doPreferences();
}
});
}
// Include prefs in Edit menu if not on Mac OS X or not using Aqua Look and Feel
if (!SystemType.isMacOSX() || !UIManager.getLookAndFeel().isNativeLookAndFeel()) {
editMenu.addSeparator();
editMenu.add(prefsAction);
}
}
use of java.util.EventObject in project JMRI by JMRI.
the class Apps method createMenus.
/**
* Create default menubar.
* <P>
* This does not include the development menu.
*
* @param menuBar Menu bar to be populated
* @param wi WindowInterface where this menu bar will appear
*/
protected void createMenus(JMenuBar menuBar, WindowInterface wi) {
// the debugging statements in the following are
// for testing startup time
log.debug("start building menus");
if (SystemType.isMacOSX()) {
Application.getApplication().setQuitHandler(new QuitHandler() {
@Override
public boolean handleQuitRequest(EventObject eo) {
return handleQuit();
}
});
}
fileMenu(menuBar, wi);
editMenu(menuBar, wi);
toolsMenu(menuBar, wi);
rosterMenu(menuBar, wi);
panelMenu(menuBar, wi);
// check to see if operations in main menu
if (jmri.jmrit.operations.setup.Setup.isMainMenuEnabled()) {
operationsMenu(menuBar, wi);
}
systemsMenu(menuBar, wi);
scriptMenu(menuBar, wi);
debugMenu(menuBar, wi);
// * GT 28-AUG-2008 Added window menu
menuBar.add(new WindowMenu(wi));
helpMenu(menuBar, wi);
log.debug("end building menus");
}
use of java.util.EventObject in project JMRI by JMRI.
the class Apps3 method initMacOSXMenus.
protected void initMacOSXMenus() {
jmri.plaf.macosx.Application macApp = jmri.plaf.macosx.Application.getApplication();
macApp.setAboutHandler(new AboutHandler() {
@Override
public void handleAbout(EventObject eo) {
new AboutDialog(null, true).setVisible(true);
}
});
macApp.setPreferencesHandler(new PreferencesHandler() {
@Override
public void handlePreferences(EventObject eo) {
new TabbedPreferencesAction(Bundle.getMessage("MenuItemPreferences")).actionPerformed();
}
});
macApp.setQuitHandler(new QuitHandler() {
@Override
public boolean handleQuitRequest(EventObject eo) {
return handleQuit();
}
});
}
use of java.util.EventObject in project jdk8u_jdk by JetBrains.
the class bug6711682 method createAndShowGUI.
private static void createAndShowGUI() {
editorCb = new JCheckBox();
rendererCb = new JCheckBox();
JFrame f = new JFrame("Table with CheckBox");
Container p = f.getContentPane();
p.setLayout(new BorderLayout());
table = new JTable(new Object[][] { { false }, { false }, { false } }, new Object[] { "CheckBox" });
TableCellEditor editor = new TableCellEditor() {
int editedRow;
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
this.editedRow = row;
editorCb.setSelected(Boolean.TRUE.equals(value));
editorCb.setBackground(UIManager.getColor("Table.selectionBackground"));
return editorCb;
}
public void addCellEditorListener(CellEditorListener l) {
}
public void cancelCellEditing() {
}
public Object getCellEditorValue() {
return editorCb.isSelected();
}
public boolean isCellEditable(EventObject anEvent) {
return true;
}
public void removeCellEditorListener(CellEditorListener l) {
}
public boolean shouldSelectCell(EventObject anEvent) {
return true;
}
public boolean stopCellEditing() {
table.getModel().setValueAt(editorCb.isSelected(), editedRow, 0);
return true;
}
};
table.getColumnModel().getColumn(0).setCellEditor(editor);
TableCellRenderer renderer = new TableCellRenderer() {
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
rendererCb.setSelected(Boolean.TRUE.equals(value));
return rendererCb;
}
};
table.getColumnModel().getColumn(0).setCellRenderer(renderer);
p.add(table, BorderLayout.CENTER);
f.pack();
f.setVisible(true);
}
Aggregations