Java 类com.intellij.ui.components.JBScrollBar 实例源码

项目:jediterm    文件:JediTerminalWidget.java   
@Override
protected JScrollBar createScrollBar() {
  JBScrollBar bar = new JBScrollBar();
  bar.putClientProperty(JBScrollPane.Alignment.class, JBScrollPane.Alignment.RIGHT);
  bar.putClientProperty(JBScrollBar.TRACK, new RegionPainter<Object>() {
    @Override
    public void paint(Graphics2D g, int x, int y, int width, int height, Object object) {
      SubstringFinder.FindResult result = myTerminalPanel.getFindResult();
      if (result != null) {
        int modelHeight = bar.getModel().getMaximum() - bar.getModel().getMinimum();
        int anchorHeight = Math.max(2, height / modelHeight);

        Color color = mySettingsProvider.getTerminalColorPalette()
          .getColor(mySettingsProvider.getFoundPatternColor().getBackground());
        g.setColor(color);
        for (SubstringFinder.FindResult.FindItem r : result.getItems()) {
          int where = height * r.getStart().y / modelHeight;
          g.fillRect(x, y + where, width, anchorHeight);
        }
      }
    }
  });
  return bar;
}
项目:jediterm    文件:ButtonlessScrollBarUI.java   
@Override
protected void paintTrack(Graphics g, JComponent c, Rectangle trackBounds) {
  if (alwaysShowTrack() || myMouseOverScrollbarExpandLevel > 0) {
    doPaintTrack(g, c, trackBounds);
  }
  RegionPainter<Object> painter = UIUtil.getClientProperty(c, JBScrollBar.TRACK);
  if (painter != null) {
    painter.paint((Graphics2D)g, trackBounds.x, trackBounds.y, trackBounds.width, trackBounds.height, null);
  }
}
项目:intellij-ce-playground    文件:JBTerminalWidget.java   
@Override
protected JScrollBar createScrollBar() {
  return new JBScrollBar();
}
项目:tools-idea    文件:JBTerminalWidget.java   
@Override
protected JScrollBar createScrollBar() {
  return new JBScrollBar();
}
项目:consulo-terminal    文件:JBTerminalWidget.java   
@Override
protected JScrollBar createScrollBar()
{
    return new JBScrollBar();
}