Example usage for javax.swing JMenuItem equals

List of usage examples for javax.swing JMenuItem equals

Introduction

In this page you can find the example usage for javax.swing JMenuItem equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:com.net2plan.gui.GUINet2Plan.java

@Override
public void actionPerformed(ActionEvent e) {
    try {/*from   w ww .j  ava2  s . c o m*/
        if (!(e.getSource() instanceof JMenuItem))
            throw new RuntimeException("Bad");

        JMenuItem item = (JMenuItem) e.getSource();
        if (item.equals(optionsItem)) {
            JDialog dialog = new GUIConfiguration();
            dialog.setVisible(true);
        } else if (item.equals(errorConsoleItem)) {
            ErrorHandling.showConsole();
        } else if (item.equals(classPathEditorItem)) {
            ClassPathEditor.showGUI();
        } else if (item.equals(keyCombinationItem)) {
            showKeyCombinations();
        } else if (item.equals(exitItem)) {
            askForClose();
        } else if (item.equals(helpItem)) {
            loadHelp();
        } else if (item.equals(javadocItem)) {
            loadJavadocLib();
        } else if (item.equals(javadocExamplesItem)) {
            loadExamples();
        } else {
            Object object = itemObject.get(item);

            WindowUtils.setWindowLeftSide(instance);

            if (object != null) {
                if (object instanceof Class) {
                    Object classInstance = ((Class) object).newInstance();

                    if (classInstance instanceof IGUIModule) {
                        IGUIModule module = (IGUIModule) classInstance;
                        module.start();

                        object = module;
                    }
                }

                if (object instanceof JPanel) {
                    container.removeAll();
                    container.add((JPanel) object, "grow");
                    container.revalidate();
                    container.updateUI();
                }
            }
        }
    } catch (Throwable ex) {
        ErrorHandling.addErrorOrException(ex, GUINet2Plan.class);
        ErrorHandling.showErrorDialog("Unable to execute option");
    }
}