当前位置: 首页>>代码示例>>Java>>正文


Java Component.setEnabled方法代码示例

本文整理汇总了Java中java.awt.Component.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Component.setEnabled方法的具体用法?Java Component.setEnabled怎么用?Java Component.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.Component的用法示例。


在下文中一共展示了Component.setEnabled方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: prepareRenderer

import java.awt.Component; //导入方法依赖的package包/类
@Override
public Component prepareRenderer(TableCellRenderer renderer, int row, int col) {
    Component result = super.prepareRenderer(renderer, row, col);

    if ((row < 0) || (row >= getRowCount())) {
        return result;
    }

    Object value = getValueAt(row, col);

    if ((result != null) && value instanceof Property && (col == 1)) {
        result.setEnabled(((Property) value).canWrite());
    }

    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:SheetTable.java

示例2: enableComponents

import java.awt.Component; //导入方法依赖的package包/类
private void enableComponents(Component comp, boolean enable) {
    if (comp instanceof Container) {
        for (Component subComp : ((Container)comp).getComponents()) {
            enableComponents(subComp, enable);
        }
    }
    if ((comp instanceof JComboBox)
            || ((comp instanceof JTextComponent) && ((JTextComponent)comp).isEditable())
            || (comp instanceof AbstractButton) || (comp instanceof JList)) {
        if (enable) {
            Boolean b = enableMap.get(comp);
            if (b != null) {
                comp.setEnabled(b);
            } else {
                comp.setEnabled(true);
            }
        } else {
            enableMap.put(comp, comp.isEnabled());
            comp.setEnabled(false);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:IssuePanel.java

示例3: enableComponents

import java.awt.Component; //导入方法依赖的package包/类
private void enableComponents (Component comp, boolean enable) {
    if (comp instanceof Container) {
        for (Component subComp : ((Container) comp).getComponents()) {
            enableComponents(subComp, enable);
        }
    }
    if ((comp instanceof JComboBox)
            || ((comp instanceof JTextComponent) && ((JTextComponent) comp).isEditable())
            || (comp instanceof AbstractButton) || (comp instanceof JList)) {
        if (enable) {
            Boolean b = enableMap.get(comp);
            if (b != null) {
                comp.setEnabled(b);
            }
        } else {
            enableMap.put(comp, comp.isEnabled());
            comp.setEnabled(false);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:TaskPanel.java

示例4: setEnabled

import java.awt.Component; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);

    Component[] components = getComponents();
    for (Component component : components) {
        component.setEnabled(enabled);
    }

    if (singlePlayerGame && enabled) {
        readyBox.setEnabled(false);
    }

    if (enabled) {
        start.setEnabled(getFreeColClient().isAdmin());
    }

    gameOptions.setEnabled(enabled);
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:23,代码来源:StartGamePanel.java

示例5: getTableCellRendererComponent

import java.awt.Component; //导入方法依赖的package包/类
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
    Component c = r.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
    c.setEnabled(t.isEnabled());
    if (background != null) {
        c.setBackground(background);
    }
    return c;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DisablingCellRenderer.java

示例6: getListCellRendererComponent

import java.awt.Component; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {
	Component component = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
	component.setEnabled(model.isEnabled(value));
	return component;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:ExtendedListCellRenderer.java

示例7: setTabEnabled

import java.awt.Component; //导入方法依赖的package包/类
/** Changes the enabled status of the tab component at a given index. */
private void setTabEnabled(int index, boolean enabled) {
    if (index >= 0) {
        Component label = getTabComponentAt(index);
        if (label != null) {
            label.setEnabled(enabled);
        }
        getComponentAt(index).requestFocus();
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:11,代码来源:ResourceDisplay.java

示例8: setEnabled

import java.awt.Component; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void setEnabled(boolean enable) {
    super.setEnabled(enable);
    for (Component child : getComponents()) {
        if (child instanceof CargoLabel) child.setEnabled(enable);
    }
}
 
开发者ID:wintertime,项目名称:FreeCol,代码行数:11,代码来源:TradeRouteInputPanel.java

示例9: getTableCellRendererComponent

import java.awt.Component; //导入方法依赖的package包/类
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
	Component renderer = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
	if (!table.isCellEditable(row, referenceColumn))
		renderer.setEnabled(false);
	return renderer;

}
 
开发者ID:max6cn,项目名称:jmt,代码行数:9,代码来源:ImagedComboBoxCellEditorFactory.java

示例10: setEnabledRecursive

import java.awt.Component; //导入方法依赖的package包/类
private static void setEnabledRecursive(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabledRecursive((Container) component, enabled);
        }
    }
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:9,代码来源:Test6559154.java

示例11: add

import java.awt.Component; //导入方法依赖的package包/类
@Override
public void add(final Component c, final Object constraints)
{
	if( allowSetEnable )
	{
		c.setEnabled(button.isSelected());
	}

	inner.add(c, constraints);
}
 
开发者ID:equella,项目名称:Equella,代码行数:11,代码来源:GroupBox.java

示例12: enableDisablePanel

import java.awt.Component; //导入方法依赖的package包/类
private void enableDisablePanel(boolean enabled) {
    loggersPanel.setEnabled(enabled);
    Component[] components = loggersPanel.getComponents();
    for (Component c : components) {
        if (!c.equals(btnRemove)) {
            c.setEnabled(enabled);
        }
    }
    btnRemove.setEnabled(enabled && !customLoggersList.isEmpty());
    loggersScrollPane.getViewport().getView().setEnabled(enabled);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:LoggerHintsCustomizer.java

示例13: recursiveSetEnable

import java.awt.Component; //导入方法依赖的package包/类
/**
 * Enable or disable the childs of the given component
 *
 * @param enable true or false !
 * @param comp the component
 */
public static void recursiveSetEnable(final boolean enable, final JComponent comp) {
	for (final Component c : comp.getComponents()) {
		c.setEnabled(enable);
		if (c instanceof JComponent) {
			recursiveSetEnable(enable, (JComponent) c);
		}
	}
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:15,代码来源:WWJPanel.java

示例14: setEnabled

import java.awt.Component; //导入方法依赖的package包/类
private static void setEnabled(Container container, boolean enabled) {
    for (Component component : container.getComponents()) {
        component.setEnabled(enabled);
        if (component instanceof Container) {
            setEnabled((Container) component, enabled);
        }
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:9,代码来源:ColorChooserPanel.java

示例15: blockInterface

import java.awt.Component; //导入方法依赖的package包/类
private static void blockInterface(){

		panelLoading.setVisible(true);
		scrollPane.setVisible(false);
		for(Component comp : panelOptions.getComponents()){
			comp.setEnabled(false);
		}

		itemSelectSubjectFolder.setVisible(false);

		btnSearch.setVisible(false);
		panelSearch.setVisible(false);
		btnLogout.setVisible(false);

	}
 
开发者ID:davovoid,项目名称:faitic-checker,代码行数:16,代码来源:SubjectsGUI.java


注:本文中的java.awt.Component.setEnabled方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。