javax.swing.JComponent.isOpaque()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(149)

本文整理了Java中javax.swing.JComponent.isOpaque()方法的一些代码示例,展示了JComponent.isOpaque()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JComponent.isOpaque()方法的具体详情如下:
包路径:javax.swing.JComponent
类名称:JComponent
方法名:isOpaque

JComponent.isOpaque介绍

暂无

代码示例

代码示例来源:origin: JetBrains/ideavim

/**
 * Turns on the more window for the given editor
 */
private void activate() {
 JRootPane root = SwingUtilities.getRootPane(myEditor.getContentComponent());
 myOldGlass = (JComponent)root.getGlassPane();
 if (myOldGlass != null) {
  myOldLayout = myOldGlass.getLayout();
  myWasOpaque = myOldGlass.isOpaque();
  myOldGlass.setLayout(null);
  myOldGlass.setOpaque(false);
  myOldGlass.add(this);
  myOldGlass.addComponentListener(myAdapter);
 }
 setFontForElements();
 positionPanel();
 if (myOldGlass != null) {
  myOldGlass.setVisible(true);
 }
 myActive = true;
 UiHelper.requestFocus(myText);
}

代码示例来源:origin: JetBrains/ideavim

oldGlass = (JComponent)root.getGlassPane();
oldLayout = oldGlass.getLayout();
wasOpaque = oldGlass.isOpaque();
oldGlass.setLayout(null);
oldGlass.setOpaque(false);

代码示例来源:origin: ron190/jsql-injection

this.oldOpaque = parent.isOpaque();
this.oldBorder = parent.getBorder();
parent.setOpaque(false);

代码示例来源:origin: stackoverflow.com

if (isOpaque()) {
  g2d.setColor(getBackground());
  g2d.fillRect(0, 0, getWidth(), getHeight());

代码示例来源:origin: JetBrains/jediterm

@Override
boolean isBorderNeeded(JComponent c) {
 return !c.isOpaque() && myTrackAnimator.myValue > 0 && myThumbAnimator.myValue > 0;
}

代码示例来源:origin: com.jidesoft/jide-oss

public void paintStatusBarBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) {
  if (c.isOpaque()) {
    paintContentBackground(c, g, rect, orientation, state);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

public void paintDockableFrameBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) {
  if (!c.isOpaque()) {
    return;
  }
  g.setColor(UIDefaultsLookup.getColor("DockableFrame.background"));
  g.fillRect(rect.x, rect.y, rect.width, rect.height);
}

代码示例来源:origin: de.rototor.jeuclid/jeuclid-core

private Color getRealBackgroundColor(JComponent c) {
  Color back = c.getBackground();
  if (c.isOpaque()) {
    if (back == null) {
      back = Color.WHITE;
    }
    // Remove Alpha
    back = new Color(back.getRGB());
  }
  return back;
}

代码示例来源:origin: stackoverflow.com

public void update(Graphics g, JComponent c) {
  if (c.isOpaque()) {
    g.setColor(c.getBackground());
    g.fillRect(0, 0, c.getWidth(),c.getHeight());
  }
  paint(g, c);
}

代码示例来源:origin: de.rototor.jeuclid/jeuclid-core

/** {@inheritDoc} */
@Override
public void update(final Graphics g, final JComponent c) {
  if (c.isOpaque()) {
    g.setColor(c.getBackground());
    g.fillRect(0, 0, c.getWidth(), c.getHeight());
  }
  this.paint(g, c);
}

代码示例来源:origin: com.jtattoo/JTattoo

public void paintBackground(Graphics g, JComponent c) {
  if (c.isOpaque()) {
    if (c.getBackground() instanceof ColorUIResource) {
      g.setColor(AbstractLookAndFeel.getBackgroundColor());
    } else {
      g.setColor(c.getBackground());
    }
    g.fillRect(0, 0, c.getWidth(), c.getHeight());
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void update(Graphics g, JComponent c) {
  if (c.isOpaque()) {
    Object backgroundTexture = c.getClientProperty("backgroundTexture");
    if (backgroundTexture instanceof Icon) {
      JTattooUtilities.fillComponent(g, c, (Icon)backgroundTexture);
    } else {
      g.setColor(c.getBackground());
      g.fillRect(0, 0, c.getWidth(), c.getHeight());
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void paintBackground(Graphics g, JComponent c) {
    if (c.isOpaque()) {
      if ((c.getBackground() instanceof ColorUIResource) && c.getBackground().equals(AbstractLookAndFeel.getBackgroundColor())) {
        BernsteinUtils.fillComponent(g, c);
      } else {
        g.setColor(c.getBackground());
        g.fillRect(0, 0, c.getWidth(), c.getHeight());
      }
    }
  }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void paintBackground(Graphics g, JComponent c) {
    if (c.isOpaque()) {
      if ((c.getBackground() instanceof ColorUIResource) && c.getBackground().equals(AbstractLookAndFeel.getBackgroundColor())) {
        McWinUtils.fillComponent(g, c);
      } else {
        g.setColor(c.getBackground());
        g.fillRect(0, 0, c.getWidth(), c.getHeight());
      }
    }
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

@Override
public void paintDockableFrameBackground(JComponent c, Graphics g, Rectangle rect, int orientation, int state) {
  if (!c.isOpaque()) {
    return;
  }
  Graphics2D g2d = (Graphics2D) g;
  JideSwingUtilities.fillGradient(g2d,
      new Rectangle(rect.x, rect.y, rect.width, rect.height),
      getCurrentTheme().getColor("DockableFrame.backgroundLt"),
      getCurrentTheme().getColor("DockableFrame.backgroundDk"),
      orientation == SwingConstants.HORIZONTAL);
}

代码示例来源:origin: JetBrains/jediterm

@Override
void paintThumb(Graphics2D g, int x, int y, int width, int height, JComponent c) {
 if (c.isOpaque()) {
  RegionPainter<Float> p = ScrollColorProducer.isDark(c) ? ScrollPainter.Thumb.Mac.DARCULA : ScrollPainter.Thumb.Mac.DEFAULT;
  paint(p, g, x, y, width, height, c, myThumbAnimator.myValue, true);
 }
 else if (myThumbAnimator.myValue > 0) {
  RegionPainter<Float> p = ScrollColorProducer.isDark(c) ? ScrollPainter.Thumb.Mac.Overlay.DARCULA : ScrollPainter.Thumb.Mac.Overlay.DEFAULT;
  paint(p, g, x, y, width, height, c, myThumbAnimator.myValue, false);
 }
}

代码示例来源:origin: com.jtattoo/JTattoo

public void update(Graphics g, JComponent c) {
    if (c.isOpaque() && c.getBackground() instanceof ColorUIResource && c.getClientProperty("backgroundTexture") == null) {
      BernsteinUtils.fillComponent(g, c);
    } else {
      super.update(g, c);
    }
  }
}

代码示例来源:origin: org.orbisgis/orbisgis-view

/**
 * Apply the opacity, background color, foreground color and border properties of {@code source} to
 * {@code destination}.
 * @param source The source component.
 * @param destination The destination component.
 */
public static void copyComponentStyle(JComponent source, JComponent destination) {
  destination.setOpaque(source.isOpaque());
  destination.setBackground(source.getBackground());
  destination.setForeground(source.getForeground());
  destination.setBorder(source.getBorder());
}

代码示例来源:origin: net.sf.nimrod/nimrod-laf

public void update( Graphics g, JComponent c) {
 oldOpaque = c.isOpaque();
 
 if ( c.getParent() instanceof JToolBar ) {
  super.update( g,c);
 }
 else {
  c.setOpaque( false);
  super.update( g,c);
  c.setOpaque( oldOpaque);
 }
}

代码示例来源:origin: com.metsci.glimpse/glimpse-wizard

protected void copySettings( JComponent from, JComponent to )
{
  to.setForeground( from.getForeground( ) );
  to.setBackground( from.getBackground( ) );
  to.setEnabled( from.isEnabled( ) );
  to.setFont( from.getFont( ) );
  to.setOpaque( from.isOpaque( ) );
}

相关文章

JComponent类方法