本文整理汇总了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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
示例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;
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}