Search in sources :

Example 96 with EventObject

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);
    }
}
Also used : DefaultEditorKit(javax.swing.text.DefaultEditorKit) PreferencesHandler(jmri.plaf.macosx.PreferencesHandler) AbstractAction(javax.swing.AbstractAction) JMenu(javax.swing.JMenu) EventObject(java.util.EventObject)

Example 97 with EventObject

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);
    }
}
Also used : DefaultEditorKit(javax.swing.text.DefaultEditorKit) PreferencesHandler(jmri.plaf.macosx.PreferencesHandler) AbstractAction(javax.swing.AbstractAction) JMenu(javax.swing.JMenu) EventObject(java.util.EventObject)

Example 98 with EventObject

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");
}
Also used : QuitHandler(jmri.plaf.macosx.QuitHandler) WindowMenu(jmri.util.WindowMenu) EventObject(java.util.EventObject)

Example 99 with EventObject

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();
        }
    });
}
Also used : QuitHandler(jmri.plaf.macosx.QuitHandler) AboutDialog(jmri.swing.AboutDialog) PreferencesHandler(jmri.plaf.macosx.PreferencesHandler) EventObject(java.util.EventObject) AboutHandler(jmri.plaf.macosx.AboutHandler)

Example 100 with EventObject

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);
}
Also used : TableCellRenderer(javax.swing.table.TableCellRenderer) EventObject(java.util.EventObject) CellEditorListener(javax.swing.event.CellEditorListener) TableCellEditor(javax.swing.table.TableCellEditor) EventObject(java.util.EventObject)

Aggregations

EventObject (java.util.EventObject)111 EventFactory (org.apache.camel.spi.EventFactory)25 EventNotifier (org.apache.camel.spi.EventNotifier)25 ManagementStrategy (org.apache.camel.spi.ManagementStrategy)25 AlertHandler (edu.cmu.cs.hcii.cogtool.util.AlertHandler)21 EventNotifierSupport (org.apache.camel.support.EventNotifierSupport)15 DefaultCamelContext (org.apache.camel.impl.DefaultCamelContext)10 Frame (edu.cmu.cs.hcii.cogtool.model.Frame)9 Hashtable (java.util.Hashtable)8 AsynchClientTask (cbit.vcell.client.task.AsynchClientTask)7 ProgressDialogListener (org.vcell.util.ProgressDialogListener)7 Test (org.junit.Test)6 MouseEvent (java.awt.event.MouseEvent)4 File (java.io.File)4 ExchangeCompletedEvent (org.apache.camel.management.event.ExchangeCompletedEvent)4 ClientConfig (com.hazelcast.client.config.ClientConfig)3 Design (edu.cmu.cs.hcii.cogtool.model.Design)3 TaskGroup (edu.cmu.cs.hcii.cogtool.model.TaskGroup)3 DesignEditorFrame (edu.cmu.cs.hcii.cogtool.uimodel.DesignEditorFrame)3 PreferencesHandler (jmri.plaf.macosx.PreferencesHandler)3