本文整理汇总了Java中java.awt.Component.isEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java Component.isEnabled方法的具体用法?Java Component.isEnabled怎么用?Java Component.isEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.Component
的用法示例。
在下文中一共展示了Component.isEnabled方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: paintLoweredBevel
import java.awt.Component; //导入方法依赖的package包/类
protected void paintLoweredBevel(Component c, Graphics g, int x, int y, int width, int height) {
if (!c.isEnabled()) {
return;
}
Color oldColor = g.getColor();
int h = height;
int w = width;
g.translate(x, y);
g.setColor(getShadowOuterColor(c));
g.drawLine(0, 0, 0, h - 1);
g.drawLine(1, 0, w - 1, 0);
g.setColor(getHighlightInnerColor(c));
g.drawLine(1, h - 1, w - 1, h - 1);
g.drawLine(w - 1, 1, w - 1, h - 2);
g.translate(-x, -y);
g.setColor(oldColor);
}
示例2: paintRaisedBevel
import java.awt.Component; //导入方法依赖的package包/类
protected void paintRaisedBevel(Component c, Graphics g, int x, int y, int width, int height) {
if (!c.isEnabled()) {
return;
}
Color oldColor = g.getColor();
int h = height;
int w = width;
g.translate(x, y);
g.setColor(getHighlightInnerColor(c));
g.drawLine(0, 0, 0, h - 1);
g.drawLine(1, 0, w - 1, 0);
g.setColor(getShadowOuterColor(c));
g.drawLine(0, h - 1, w - 1, h - 1);
g.drawLine(w - 1, 0, w - 1, h - 2);
g.translate(-x, -y);
g.setColor(oldColor);
}
示例3: paintBorder
import java.awt.Component; //导入方法依赖的package包/类
@Override
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.translate(x, y);
if (c.isEnabled()) {
if (c.isFocusOwner()) {
g2.setColor(Colors.TEXTFIELD_BORDER_FOCUS);
} else {
g2.setColor(Colors.TEXTFIELD_BORDER);
}
} else {
g2.setColor(Colors.TEXTFIELD_BORDER_DISABLED);
}
g2.drawRoundRect(0, 0, w - 1, h - 1, RapidLookAndFeel.CORNER_DEFAULT_RADIUS, RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
g2.translate(-x, -y);
}
示例4: paintBorder
import java.awt.Component; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y, int w, int h) {
AbstractButton button = (AbstractButton)c;
ButtonModel model = button.getModel();
if (MetalLookAndFeel.usingOcean()) {
if(model.isArmed() || !button.isEnabled()) {
super.paintBorder(c, g, x, y, w, h);
}
else {
g.setColor(MetalLookAndFeel.getControlDarkShadow());
g.drawRect(0, 0, w - 1, h - 1);
}
return;
}
if (! c.isEnabled() ) {
MetalUtils.drawDisabledBorder( g, x, y, w-1, h-1 );
} else {
if ( model.isPressed() && model.isArmed() ) {
MetalUtils.drawPressed3DBorder( g, x, y, w, h );
} else if ( model.isSelected() ) {
MetalUtils.drawDark3DBorder( g, x, y, w, h );
} else {
MetalUtils.drawFlush3DBorder( g, x, y, w, h );
}
}
}
示例5: accept
import java.awt.Component; //导入方法依赖的package包/类
private boolean accept(Component aComponent) {
if (!(aComponent.isVisible() && aComponent.isDisplayable() &&
aComponent.isFocusable() && aComponent.isEnabled())) {
return false;
}
// Verify that the Component is recursively enabled. Disabling a
// heavyweight Container disables its children, whereas disabling
// a lightweight Container does not.
if (!(aComponent instanceof Window)) {
for (Container enableTest = aComponent.getParent();
enableTest != null;
enableTest = enableTest.getParent())
{
if (!(enableTest.isEnabled() || enableTest.isLightweight())) {
return false;
}
if (enableTest instanceof Window) {
break;
}
}
}
return true;
}
示例6: paintBorder
import java.awt.Component; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y,
int w, int h) {
if (!(c instanceof JTextComponent)) {
// special case for non-text components (bug ID 4144840)
if (c.isEnabled()) {
MetalUtils.drawFlush3DBorder(g, x, y, w, h);
} else {
MetalUtils.drawDisabledBorder(g, x, y, w, h);
}
return;
}
if (c.isEnabled() && ((JTextComponent)c).isEditable()) {
MetalUtils.drawFlush3DBorder(g, x, y, w, h);
} else {
MetalUtils.drawDisabledBorder(g, x, y, w, h);
}
}
示例7: doRelease
import java.awt.Component; //导入方法依赖的package包/类
private void doRelease(JLabel label) {
Component labelFor = label.getLabelFor();
if (labelFor != null && labelFor.isEnabled()) {
InputMap inputMap = SwingUtilities.getUIInputMap(label, JComponent.WHEN_FOCUSED);
if (inputMap != null) {
// inputMap should never be null.
int dka = label.getDisplayedMnemonic();
inputMap.remove(KeyStroke.getKeyStroke(dka, BasicLookAndFeel.getFocusAcceleratorKeyMask(), true));
inputMap.remove(KeyStroke.getKeyStroke(dka, 0, true));
inputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ALT, 0, true));
}
if (labelFor instanceof Container &&
((Container) labelFor).isFocusCycleRoot()) {
labelFor.requestFocus();
} else {
SwingUtilities2.compositeRequestFocus(labelFor);
}
}
}
示例8: previousEnabledChild
import java.awt.Component; //导入方法依赖的package包/类
private static MenuElement previousEnabledChild(MenuElement e[],
int fromIndex, int toIndex) {
for (int i=fromIndex; i>=toIndex; i--) {
if (e[i] != null) {
Component comp = e[i].getComponent();
if ( comp != null
&& (comp.isEnabled() || UIManager.getBoolean("MenuItem.disabledAreNavigable"))
&& comp.isVisible()) {
return e[i];
}
}
}
return null;
}
示例9: paintIcon
import java.awt.Component; //导入方法依赖的package包/类
public void paintIcon(Component c, Graphics g, int x, int y) {
Dimension size = c.getSize();
Graphics g2 = g.create(size.width / 2 - 5, size.height / 2 - 5, 10, 10);
g2.setColor(Color.GRAY);
g2.drawPolygon(xPoints, yPoints, 3);
if (c.isEnabled()) {
g2.setColor(Color.BLACK);
g2.fillPolygon(xPoints, yPoints, 3);
}
g2.dispose();
}
示例10: nextEnabledChild
import java.awt.Component; //导入方法依赖的package包/类
private static MenuElement nextEnabledChild(MenuElement e[],
int fromIndex, int toIndex) {
for (int i=fromIndex; i<=toIndex; i++) {
if (e[i] != null) {
Component comp = e[i].getComponent();
if ( comp != null
&& (comp.isEnabled() || UIManager.getBoolean("MenuItem.disabledAreNavigable"))
&& comp.isVisible()) {
return e[i];
}
}
}
return null;
}
示例11: processBindingForKeyStrokeRecursive
import java.awt.Component; //导入方法依赖的package包/类
static boolean processBindingForKeyStrokeRecursive(MenuElement elem,
KeyStroke ks, KeyEvent e, int condition, boolean pressed) {
if (elem == null) {
return false;
}
Component c = elem.getComponent();
if ( !(c.isVisible() || (c instanceof JPopupMenu)) || !c.isEnabled() ) {
return false;
}
if (c != null && c instanceof JComponent &&
((JComponent)c).processKeyBinding(ks, e, condition, pressed)) {
return true;
}
MenuElement[] subElements = elem.getSubElements();
for (MenuElement subElement : subElements) {
if (processBindingForKeyStrokeRecursive(subElement, ks, e, condition, pressed)) {
return true;
// We don't, pass along to children JMenu's
}
}
return false;
}
示例12: paintBorder
import java.awt.Component; //导入方法依赖的package包/类
public void paintBorder(Component c, Graphics g, int x, int y,
int w, int h) {
if (c.isEnabled()) {
MetalUtils.drawFlush3DBorder(g, x, y, w, h);
} else {
MetalUtils.drawDisabledBorder(g, x, y, w, h);
}
}
示例13: isFocusableComponent
import java.awt.Component; //导入方法依赖的package包/类
private boolean isFocusableComponent(Component aComponent) {
return aComponent.isEnabled() && aComponent.isVisible();
}
示例14: focusable
import java.awt.Component; //导入方法依赖的package包/类
private static boolean focusable(Component c) {
if (c instanceof JLabel || c instanceof Box.Filler) return false;
return c.isVisible() && c.isEnabled() && c.isFocusable();
}