Example usage for java.awt Component equals

List of usage examples for java.awt Component equals

Introduction

In this page you can find the example usage for java.awt Component equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

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

Usage

From source file:edu.uara.gui.tableeditor.ChartGenerationFrame.java

private void switchTabPanel(Component c) {
    this.tab_chartProperties.setSelectedComponent(c);
    Component[] compCollection = tab_chartProperties.getComponents();
    for (Component comp : compCollection) {
        if (comp.equals(c)) {
            if (comp instanceof JPanel) {
                JPanel p = (JPanel) comp;
                for (Component childComp : p.getComponents())
                    childComp.setEnabled(true);
            }/*from  w  ww. j av a 2  s .com*/
        } else {
            if (comp instanceof JPanel) {
                JPanel p = (JPanel) comp;
                for (Component childComp : p.getComponents())
                    childComp.setEnabled(false);
            }
        }
    }
}

From source file:edu.uara.gui.tableeditor.ChartGenerationFrame.java

/**
 * turn on and off other options when multi-piechart is selected
 * @param enabled//from w  w w. j  a v  a  2  s  .  c  o m
 */
private void toggleMultiplePieChartOptions(boolean enabled) {
    for (Component comp : this.tabPanel_piechart.getComponents()) {
        if (!comp.equals(this.cbo_pieDataSelect) && !comp.equals(this.opt_multiPieCharts)
                && !comp.equals(this.lbl_datasetBy) && !comp.equals(this.lbl_pieLabelFormat)
                && !comp.equals(this.cbo_pieSectionLabel)) {
            comp.setEnabled(enabled);
        }
    }
}

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Copy the currently table cells to the clipboard.
 *///from   w  w  w  .  j  a  v  a2 s .co  m
public void copyCurrentSelectionToClipboard() {

    Component focusedComponent = this.getFocusOwner();

    if (focusedComponent != null) {
        if (focusedComponent.equals(tblActual)) {
            this.adapterActualTable.doCopy();
        } else if (focusedComponent.equals(tblSimulation)) {
            this.adapterSimulationTable.doCopy();
        } else if (focusedComponent.equals(txtSummary)) {
            txtSummary.copy();
        }
    }
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.TreeViewerControl.java

/**
 * Returns the {@link ChangeListener} attached to the tab pane,
 * or creates one if none initialized.//from  w ww  .  ja v  a2s  . c o m
 * 
 * @return See above.
 */
ChangeListener getTabbedListener() {
    if (tabsListener == null) {
        tabsListener = new ChangeListener() {
            // This method is called whenever the selected tab changes
            public void stateChanged(ChangeEvent ce) {
                JTabbedPane pane = (JTabbedPane) ce.getSource();
                model.clearFoundResults();
                Component c = pane.getSelectedComponent();
                if (c == null) {
                    model.setSelectedBrowser(null, true);
                    return;
                }
                Map browsers = model.getBrowsers();
                Iterator i = browsers.values().iterator();
                boolean selected = false;
                Browser browser;
                while (i.hasNext()) {
                    browser = (Browser) i.next();
                    if (c.equals(browser.getUI())) {
                        model.setSelectedBrowser(browser, true);
                        selected = true;
                        break;
                    }
                }
                if (!selected)
                    model.setSelectedBrowser(null, true);
            }
        };
    }
    return tabsListener;
}

From source file:self.philbrown.javaQuery.$.java

/**
 * Finds a component that is identified by the given name
 * @param name//from   w  ww .j a  va2  s.c o  m
 * @return the found component, or {@code null} if it was not found.
 */
public static Component findComponentWithName(String name, Component parent)//FIXME: debug to ensure this is working!
{
    if (parent.getName() != null && parent.equals(name))
        return parent;
    else if (parent instanceof Container) {
        for (Component c : ((Container) parent).getComponents()) {
            Component found = findComponentWithName(name, c);
            if (found != null) {
                return found;
            }
        }
    }
    return null;
}