本文整理匯總了Java中javax.swing.JComponent.isEnabled方法的典型用法代碼示例。如果您正苦於以下問題:Java JComponent.isEnabled方法的具體用法?Java JComponent.isEnabled怎麽用?Java JComponent.isEnabled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComponent
的用法示例。
在下文中一共展示了JComponent.isEnabled方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: paintThumb
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) {
int x = (int) thumbBounds.getX();
int y = (int) thumbBounds.getY();
int w = (int) thumbBounds.getWidth();
int h = (int) thumbBounds.getHeight();
if (c.isEnabled() && w > 0 && h > 0) {
if (this.scrollbar.getOrientation() == Adjustable.HORIZONTAL) {
h -= 1;
y++;
drawHorizThumb(g, x, y, w, h);
} else {
w -= 1;
x++;
drawVertThumb(g, x, y, w, h);
}
}
}
示例2: paintBorder
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* Draws the border of the combobox.
*/
private void paintBorder(Graphics g, JComponent c) {
int w = c.getWidth();
int h = c.getHeight();
if (w <= 0 || h <= 0) {
return;
}
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
boolean hasFocus = comboBox.isEditable() ? c.isFocusOwner()
|| ((JComboBox) c).getEditor().getEditorComponent().isFocusOwner() : c.isFocusOwner();
if (c.isEnabled()) {
if (hasFocus) {
g2.setColor(Colors.COMBOBOX_BORDER_FOCUS);
} else {
g2.setColor(Colors.COMBOBOX_BORDER);
}
} else {
g2.setColor(Colors.COMBOBOX_BORDER_DISABLED);
}
g2.drawRoundRect(0, 0, w - 1, h - 1, RapidLookAndFeel.CORNER_DEFAULT_RADIUS, RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
}
示例3: buildInfoPanel
import javax.swing.JComponent; //導入方法依賴的package包/類
/** Adjust the info panel by retrieving upper and lower info subpanels from the selected tab. */
protected void buildInfoPanel() {
JComponent upperInfoPanel = null;
JComponent lowerInfoPanel = null;
ResourceTab tab = getSelectedTab();
if (tab != null) {
upperInfoPanel = tab.getUpperInfoPanel();
lowerInfoPanel = tab.getLowerInfoPanel();
}
JPanel infoPanel = (JPanel) getInfoPanel();
String key;
if (lowerInfoPanel == null || !lowerInfoPanel.isEnabled()) {
// if we switch from split to single, freeze the divider location
if (upperInfoPanel != null && upperInfoPanel.getParent() == getSplitInfoPanel()) {
this.frozenDividerPos = getSplitInfoPanel().getDividerLocation();
}
getSingleInfoPanel().removeAll();
if (upperInfoPanel != null) {
getSingleInfoPanel().add(upperInfoPanel, BorderLayout.CENTER);
getSingleInfoPanel().validate();
getSingleInfoPanel().repaint();
}
key = this.SINGLE_INFO_KEY;
} else {
JSplitPane splitInfoPanel = getSplitInfoPanel();
int dividerPos = this.frozenDividerPos;
this.frozenDividerPos = 0;
if (dividerPos == 0) {
dividerPos = splitInfoPanel.getDividerLocation();
}
splitInfoPanel.setTopComponent(upperInfoPanel);
splitInfoPanel.setBottomComponent(lowerInfoPanel);
splitInfoPanel.setDividerLocation(dividerPos);
key = this.SPLIT_INFO_KEY;
}
((CardLayout) infoPanel.getLayout()).show(infoPanel, key);
}
示例4: mousePressed
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public synchronized void mousePressed(MouseEvent e)
{
JComponent c = (JComponent) e.getComponent();
if( c.isEnabled() )
{
c.setForeground(mTextPressed);
c.setBackground(mBackgroundPressed);
c.repaint();
}
}
示例5: mouseEntered
import javax.swing.JComponent; //導入方法依賴的package包/類
@Override
public synchronized void mouseEntered(MouseEvent e)
{
JComponent c = (JComponent) e.getComponent();
if( c.isEnabled() )
{
c.setForeground(mTextActive);
c.setBackground(mBackgroundActive);
c.repaint();
}
}
示例6: getState
import javax.swing.JComponent; //導入方法依賴的package包/類
protected State getState(final JComponent c) {
if (!AquaFocusHandler.isActive(c)) return State.INACTIVE;
if (!c.isEnabled()) return State.DISABLED;
return State.ACTIVE;
}
示例7: isAvailable
import javax.swing.JComponent; //導入方法依賴的package包/類
private boolean isAvailable(JComponent c) {
return c.isVisible() && c.isEnabled();
}
示例8: paintBox
import javax.swing.JComponent; //導入方法依賴的package包/類
/**
* Draws the combobox itself.
*/
private void paintBox(Graphics g, JComponent c) {
int w = c.getWidth();
int h = c.getHeight() - 1;
if (w <= 0 || h <= 0) {
return;
}
Graphics2D g2 = (Graphics2D) g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
if (c.isEnabled()) {
if (Boolean.parseBoolean(String.valueOf(c.getClientProperty(RapidLookTools.PROPERTY_INPUT_BACKGROUND_DARK)))) {
g2.setColor(Colors.COMBOBOX_BACKGROUND_DARK);
} else {
g2.setColor(Colors.COMBOBOX_BACKGROUND);
}
} else {
g2.setColor(Colors.COMBOBOX_BACKGROUND_DISABLED);
}
g2.fillRoundRect(0, 0, w - 1, h, RapidLookAndFeel.CORNER_DEFAULT_RADIUS, RapidLookAndFeel.CORNER_DEFAULT_RADIUS);
// arrow
int ny = c.getSize().height / 2 - 3;
int nx = c.getWidth() - 15;
if (isDown && c.isEnabled()) {
nx++;
ny++;
}
g2.translate(nx, ny);
if (c.isEnabled()) {
g2.setColor(Colors.COMBOBOX_ARROW);
} else {
g2.setColor(Colors.COMBOBOX_ARROW_DISABLED);
}
w = 14;
Polygon arrow = new Polygon(new int[] { 0, 4, 8 }, new int[] { 0, 6, 0 }, 3);
g2.fillPolygon(arrow);
g2.translate(-nx, -ny);
}
示例9: paintThumb
import javax.swing.JComponent; //導入方法依賴的package包/類
protected void paintThumb( Graphics g, JComponent c, Rectangle thumbBounds )
{
if (!c.isEnabled()) {
return;
}
if (MetalLookAndFeel.usingOcean()) {
oceanPaintThumb(g, c, thumbBounds);
return;
}
boolean leftToRight = MetalUtils.isLeftToRight(c);
g.translate( thumbBounds.x, thumbBounds.y );
if ( scrollbar.getOrientation() == JScrollBar.VERTICAL )
{
if ( !isFreeStanding ) {
thumbBounds.width += 2;
if ( !leftToRight ) {
g.translate( -1, 0 );
}
}
g.setColor( thumbColor );
g.fillRect( 0, 0, thumbBounds.width - 2, thumbBounds.height - 1 );
g.setColor( thumbShadow );
drawRect(g, 0, 0, thumbBounds.width - 2, thumbBounds.height - 1);
g.setColor( thumbHighlightColor );
drawHLine(g, 1, thumbBounds.width - 3, 1);
drawVLine(g, 1, 1, thumbBounds.height - 2);
bumps.setBumpArea( thumbBounds.width - 6, thumbBounds.height - 7 );
bumps.paintIcon( c, g, 3, 4 );
if ( !isFreeStanding ) {
thumbBounds.width -= 2;
if ( !leftToRight ) {
g.translate( 1, 0 );
}
}
}
else // HORIZONTAL
{
if ( !isFreeStanding ) {
thumbBounds.height += 2;
}
g.setColor( thumbColor );
g.fillRect( 0, 0, thumbBounds.width - 1, thumbBounds.height - 2 );
g.setColor( thumbShadow );
drawRect(g, 0, 0, thumbBounds.width - 1, thumbBounds.height - 2);
g.setColor( thumbHighlightColor );
drawHLine(g, 1, thumbBounds.width - 3, 1);
drawVLine(g, 1, 1, thumbBounds.height - 3);
bumps.setBumpArea( thumbBounds.width - 7, thumbBounds.height - 6 );
bumps.paintIcon( c, g, 4, 3 );
if ( !isFreeStanding ) {
thumbBounds.height -= 2;
}
}
g.translate( -thumbBounds.x, -thumbBounds.y );
}