javax.swing.JTree.paintComponent()方法的使用及代码示例

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

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

JTree.paintComponent介绍

暂无

代码示例

代码示例来源:origin: sdedit/sdedit

protected void paintComponent(Graphics g) {
    Graphics2D g2d = (Graphics2D) g;
    g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
        RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
    g2d.setRenderingHint(RenderingHints.KEY_RENDERING,
        RenderingHints.VALUE_RENDER_QUALITY);
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
        RenderingHints.VALUE_ANTIALIAS_ON);
    super.paintComponent(g);
  }
};

代码示例来源:origin: org.protege/protege-editor-owl

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  // Paint drop node
  if (dropRow != -1) {
    Rectangle r = getRowBounds(dropRow);
    if (r == null) {
      return;
    }
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    ((Graphics2D) g).setStroke(s);
    Color color = UIManager.getDefaults().getColor("Tree.selectionBorderColor");
    g.setColor(color);
    g.drawRoundRect(r.x, r.y, r.width, r.height, 7, 7);
  }
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  // Paint drop node
  if (dropRow != -1) {
    Rectangle r = getRowBounds(dropRow);
    if (r == null) {
      return;
    }
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    ((Graphics2D) g).setStroke(s);
    Color color = UIManager.getDefaults().getColor("Tree.selectionBorderColor");
    g.setColor(color);
    g.drawRoundRect(r.x, r.y, r.width, r.height, 7, 7);
  }
}

代码示例来源:origin: org.protege/protege-editor-owl

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  if (drawNodeSeperators){
    Color oldColor = g.getColor();
    g.setColor(Color.LIGHT_GRAY);
    for (int i = 0; i < getRowCount(); i++) {
      Rectangle rowBounds = getRowBounds(i);
      if (g.getClipBounds().intersects(rowBounds)) {
        if (getPathForRow(i).getPathCount() == 2) {
          g.drawLine(0, rowBounds.y, getWidth(), rowBounds.y);
        }
      }
    }
    g.setColor(oldColor);
  }
}

代码示例来源:origin: protegeproject/protege

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  if (drawNodeSeperators){
    Color oldColor = g.getColor();
    g.setColor(Color.LIGHT_GRAY);
    for (int i = 0; i < getRowCount(); i++) {
      Rectangle rowBounds = getRowBounds(i);
      if (g.getClipBounds().intersects(rowBounds)) {
        if (getPathForRow(i).getPathCount() == 2) {
          g.drawLine(0, rowBounds.y, getWidth(), rowBounds.y);
        }
      }
    }
    g.setColor(oldColor);
  }
}

代码示例来源:origin: edu.stanford.protege/org.protege.editor.owl

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  if (drawNodeSeperators){
    Color oldColor = g.getColor();
    g.setColor(Color.LIGHT_GRAY);
    for (int i = 0; i < getRowCount(); i++) {
      Rectangle rowBounds = getRowBounds(i);
      if (g.getClipBounds().intersects(rowBounds)) {
        if (getPathForRow(i).getPathCount() == 2) {
          g.drawLine(0, rowBounds.y, getWidth(), rowBounds.y);
        }
      }
    }
    g.setColor(oldColor);
  }
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  if (drawNodeSeperators){
    Color oldColor = g.getColor();
    g.setColor(Color.LIGHT_GRAY);
    for (int i = 0; i < getRowCount(); i++) {
      Rectangle rowBounds = getRowBounds(i);
      if (g.getClipBounds().intersects(rowBounds)) {
        if (getPathForRow(i).getPathCount() == 2) {
          g.drawLine(0, rowBounds.y, getWidth(), rowBounds.y);
        }
      }
    }
    g.setColor(oldColor);
  }
}

代码示例来源:origin: edu.stanford.protege/protege-editor-owl

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  // Paint drop node
  if (OWLTreePreferences.getInstance().isTreeDragAndDropEnabled() && dropRow != -1) {
    Rectangle r = getRowBounds(dropRow);
    if (r == null) {
      return;
    }
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    ((Graphics2D) g).setStroke(s);
    Color color = UIManager.getDefaults().getColor("Tree.selectionBorderColor");
    g.setColor(color);
    g.drawRoundRect(r.x, r.y, r.width, r.height, 7, 7);
  }
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

@Override
  public void paintComponent(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, getWidth(), getHeight());
    if (getSelectionCount() > 0) {
      g.setColor(SELECTION_COLOR);
      int[] rows = getSelectionRows();
      if(rows != null) {
        for (int i : rows) {
          Rectangle r = getRowBounds(i);
          g.fillRect(0, r.y, getWidth(), r.height);
        }
      }
    }
    super.paintComponent(g);
  }
}

代码示例来源:origin: protegeproject/protege

protected void paintComponent(Graphics g) {
  super.paintComponent(g);
  // Paint drop node
  if (OWLTreePreferences.getInstance().isTreeDragAndDropEnabled() && dropRow != -1) {
    Rectangle r = getRowBounds(dropRow);
    if (r == null) {
      return;
    }
    ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    ((Graphics2D) g).setStroke(s);
    Color color = UIManager.getDefaults().getColor("Tree.selectionBorderColor");
    g.setColor(color);
    g.drawRoundRect(r.x, r.y, r.width, r.height, 7, 7);
  }
}

代码示例来源:origin: jcbvm/i18n-editor

@Override
protected void paintComponent(Graphics g) {
  TranslationTreeCellRenderer renderer = (TranslationTreeCellRenderer) getCellRenderer();
  Color c1 = renderer.getSelectionBackground();
  
  FontMetrics metrics = g.getFontMetrics(getFont());
  setRowHeight(metrics.getHeight() + 8);
  
  g.setColor(getBackground());
  g.fillRect(0, 0, getWidth(), getHeight());
  
  for (int i : getSelectionRows()) {
    Rectangle r = getRowBounds(i);
    g.setColor(c1);
    g.fillRect(0, r.y, getWidth(), r.height);
  }
  
  super.paintComponent(g);
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

super.paintComponent(g);
 return;
super.paintComponent(g);
setOpaque(true);

相关文章

JTree类方法