java.awt.Container.getGraphics()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(2.2k)|赞(0)|评价(0)|浏览(112)

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

Container.getGraphics介绍

暂无

代码示例

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

public static class MyBorderLayout extends BorderLayout {
  Color[] colors = new Color[] {Color.RED, Color.BLUE, Color.GREEN, Color.CYAN, Color.MAGENTA};
  public void paintDebug(Container parent) {
    Graphics g = parent.getGraphics();

    for (int i = 0; i < parent.getComponentCount(); i++) {
      Component child = parent.getComponents()[i];
      g.setColor(colors[i % colors.length]);
      Rectangle r = child.getBounds();
      g.drawRect(r.x, r.y, r.width, r.height);
    }
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

protected synchronized void dragBorderXOR( Rectangle rcBounds )
 {
  Container parent = SplitPane.this;
  Graphics g = parent.getGraphics();
  if( g == null )
  {
   return;
  }
  g.setXORMode( new Color( UIManager.getColor( "desktop" ).getRGB() ) );  // This color is replaced with...
  g.setColor( EditorUtilities.WINDOW );     // ...this color when under the pen.
  if( _rcLast != null )
  {
   g.fillRect( _rcLast.x + 1, _rcLast.y + 1, _rcLast.width - 2, _rcLast.height - 2 );
  }
  _rcLast = rcBounds;
  if( _rcLast != null )
  {
   g.fillRect( _rcLast.x + 1, _rcLast.y + 1, _rcLast.width - 2, _rcLast.height - 2 );
  }
  g.dispose();
  g = null;
 }
}

代码示例来源:origin: openpreserve/jhove

private void updateDisplay ()
  {
    String progString = "";
    String txt;
    switch (_progressState) {
      case DOWNLOADING:
        txt = "Downloading " + _docName;
        break;
      case PROCESSING:
        txt = "Processing " + _docName;
        break;
      default:
        txt = _docName;
        break;
    }
    _docNameLabel.setText (txt);
    if (_byteCount >= 0) {
      progString = Long.toString (_byteCount) + " bytes";
      if (_contentLength > 0) {
        progString += " out of " + Long.toString (_contentLength);
      }
    }
    _progressLabel.setText (progString);
    Container content = getContentPane ();
    content.update (content.getGraphics ());
  }
}

代码示例来源:origin: org.gosu-lang.gosu/gosu-editor

Graphics g = parent.getGraphics();
if( g == null )

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

if (getOutlineMode() == PARTIAL_OUTLINE_MODE) {
  if (_ghost && (getRelativeContainer() != null || getParent() != null)) {
    Graphics g = (getRelativeContainer() != null ? getRelativeContainer() : getParent()).getGraphics();
    g.setXORMode(_lineColor);
    paintOutline(g, true);

相关文章

微信公众号

最新文章

更多

Container类方法