Example usage for javax.swing JComponent isVisible

List of usage examples for javax.swing JComponent isVisible

Introduction

In this page you can find the example usage for javax.swing JComponent isVisible.

Prototype

@Transient
public boolean isVisible() 

Source Link

Document

Determines whether this component should be visible when its parent is visible.

Usage

From source file:com.aw.swing.mvp.binding.BindingComponent.java

public boolean isFocusable() {
    if (!isUiReadOnly()) {
        JComponent jComponent = getJComponent();
        return (jComponent.isVisible() && jComponent.isEnabled() && !(jComponent instanceof JLabel));
    }/*w  w w .  j ava2s  . c  o m*/
    return false;
}

From source file:org.nuclos.client.genericobject.GenericObjectCollectController.java

private void adjustTabbedPanes(List<JTabbedPane> lst) {
    for (JTabbedPane tabPane : lst) {
        List<Component> lstTabToRemove = new ArrayList<Component>(tabPane.getTabCount());
        for (int i = 0; i < tabPane.getTabCount(); i++) {
            Component c = tabPane.getComponentAt(i);
            if (c instanceof JComponent) {
                List<JComponent> lstComponents = new ArrayList<JComponent>();
                collectComponents((JComponent) c, lstComponents);
                if (lstComponents.size() == 0) {
                    tabPane.setEnabledAt(i, false);
                    lstTabToRemove.add(c);
                    break;
                }/*from   w  w w  .j a  v  a2  s .  c  o  m*/

                boolean blnVisible = false;
                for (JComponent jc : lstComponents) {
                    if (jc instanceof LabeledComponent) {
                        LabeledComponent lc = (LabeledComponent) jc;
                        blnVisible = lc.isVisible();
                    } else if (jc instanceof JPanel)
                        blnVisible = false;
                    else
                        blnVisible = jc.isVisible();
                    if (blnVisible)
                        break;
                }

                tabPane.setEnabledAt(i, !blnVisible ? blnVisible : blnVisible && tabPane.isEnabledAt(i));
                if (!blnVisible)
                    lstTabToRemove.add(c);
            }
        }
        for (Component c : lstTabToRemove) {
            tabPane.remove(c);
        }
    }
}