javax.swing.JScrollPane.getHeight()方法的使用及代码示例

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

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

JScrollPane.getHeight介绍

暂无

代码示例

代码示例来源:origin: stanfordnlp/CoreNLP

private void showMatchedPart(int idx) {
 Point2D.Double coord = matchedPartCoordinates.get(idx);
 Dimension treeSize = tjp.getPreferredSize();
 JScrollBar horizontal = scroller.getHorizontalScrollBar();
 JScrollBar vertical = scroller.getVerticalScrollBar();
 int horizontalLength = horizontal.getMaximum() - horizontal.getMinimum();
 double x = Math.max(0,
           (coord.getX() / treeSize.getWidth() * horizontalLength
            - (scroller.getWidth() / 2.0)));
 int verticalLength = vertical.getMaximum() - vertical.getMinimum();
 double y = Math.max(0,
           (coord.getY() / treeSize.getHeight() * verticalLength
            - (scroller.getHeight() / 2.0)));
 horizontal.setValue((int) x);
 vertical.setValue((int) y);
}

代码示例来源:origin: com.eas.platypus/platypus-js-forms

@ScriptFunction(jsDoc = HEIGHT_JSDOC)
@Override
public int getHeight() {
  return super.getHeight();
}

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

int scrollPaneHeight = scrollPane.getHeight();
JTableHeader header = table.getTableHeader();
int heightOfheaderOfTabel = header.getHeight();

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

editor.setSize(new Dimension(
          scroller.getWidth()-20, 
          scroller.getHeight()-20));

代码示例来源:origin: featurecat/lizzie

/**
 * Create comment cached image
 *
 * @param forceRefresh
 * @param w
 * @param h
 */
public void createCommentImage(boolean forceRefresh, int w, int h) {
 if (forceRefresh || scrollPane.getWidth() != w || scrollPane.getHeight() != h) {
  if (w > 0 && h > 0) {
   scrollPane.setSize(w, h);
   cachedCommentImage =
     new BufferedImage(scrollPane.getWidth(), scrollPane.getHeight(), TYPE_INT_ARGB);
   Graphics2D g2 = cachedCommentImage.createGraphics();
   scrollPane.doLayout();
   scrollPane.validate();
   scrollPane.printAll(g2);
   g2.dispose();
  }
 }
}

代码示例来源:origin: com.akiban/akiban-persistit

@Override
  public void valueChanged(final TreeSelectionEvent tse) {
    final ValueInspectorTreeNode node = (ValueInspectorTreeNode) tse.getPath().getLastPathComponent();
    if (node != null && tse.isAddedPath()) {
      if (node.getEvalString() == null && textScrollPane.getHeight() != 0) {
        _textArea.setText(null);
        node.evalString(new Runnable() {
          @Override
          public void run() {
            _textArea.setText(node.getEvalString());
          }
        });
        ;
      } else {
        _textArea.setText(node.getEvalString());
      }
    }
  }
});

代码示例来源:origin: edu.stanford.nlp/stanford-corenlp

private void showMatchedPart(int idx) {
 Point2D.Double coord = matchedPartCoordinates.get(idx);
 Dimension treeSize = tjp.getPreferredSize();
 JScrollBar horizontal = scroller.getHorizontalScrollBar();
 JScrollBar vertical = scroller.getVerticalScrollBar();
 int horizontalLength = horizontal.getMaximum() - horizontal.getMinimum();
 double x = Math.max(0,
           (coord.getX() / treeSize.getWidth() * horizontalLength
            - (scroller.getWidth() / 2.0)));
 int verticalLength = vertical.getMaximum() - vertical.getMinimum();
 double y = Math.max(0,
           (coord.getY() / treeSize.getHeight() * verticalLength
            - (scroller.getHeight() / 2.0)));
 horizontal.setValue((int) x);
 vertical.setValue((int) y);
}

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

int maxSize = Math.max(MAX_SIZE, Math.max(_scrollPane.getWidth(), _scrollPane.getHeight()) / 2);

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

@Override
public void show( final Component c, final int iX, final int iY )
{
 super.show( c, iX, iY );
 EventQueue.invokeLater(
  () -> {
   if( !_bResizedWidth && _viewer.getWidth() > MAX_WIDTH )
   {
    //noinspection SuspiciousNameCombination
    _scroller.setPreferredSize( new Dimension( MAX_WIDTH, MAX_WIDTH ) );
    _bResizedWidth = true;
    pack();
    setVisible( false );
    show( c, iX, iY );
    return;
   }
   if( !_bResizedHeight && isViewerLessThanHalfFull() )
   {
    _scroller.setPreferredSize( new Dimension( MAX_WIDTH, _scroller.getHeight() / 2 ) );
    _bResizedHeight = true;
    pack();
    setVisible( false );
    show( c, iX, iY );
   }
  } );
}

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

@Override
public void show( final Component c, final int iX, final int iY )
{
 super.show( c, iX, iY );
 EventQueue.invokeLater(
  () -> {
   if( !_bResizedWidth && _viewer.getWidth() > MAX_WIDTH )
   {
    //noinspection SuspiciousNameCombination
    _scroller.setPreferredSize( new Dimension( MAX_WIDTH, MAX_WIDTH ) );
    _bResizedWidth = true;
    pack();
    setVisible( false );
    show( c, iX, iY );
    return;
   }
   if( !_bResizedHeight && isViewerLessThanHalfFull() )
   {
    _scroller.setPreferredSize( new Dimension( MAX_WIDTH, _scroller.getHeight() / 2 ) );
    _bResizedHeight = true;
    pack();
    setVisible( false );
    show( c, iX, iY );
   }
  } );
}

代码示例来源:origin: featurecat/lizzie

commentPane.setSize(w, h);
createCommentImage(!comment.equals(this.cachedComment), w, h);
commentRect = new Rectangle(x, y, scrollPane.getWidth(), scrollPane.getHeight());
g.drawImage(
  cachedCommentImage,

代码示例来源:origin: com.synaptix/SynaptixSwing

private void mouseMovedInScrollPane(Point point) {
  Rectangle bounds = scrollPane.getViewport().getBounds();
  int tw = getScrollBarWidth();
  int th = getScrollBarHeight();
  Point p = new Point(point.x - bounds.x, point.y - bounds.y);
  boolean dansHaut = p.y >= 0 && p.y < th;
  boolean dansBas = p.y >= scrollPane.getHeight() - th
      && p.y < scrollPane.getHeight();
  boolean dansGauche = p.x >= 0 && p.x < tw;
  boolean dansDroite = p.x >= scrollPane.getWidth() - tw
      && p.x < scrollPane.getWidth();
  if (feedback.showHaut) {
    feedback.setMouseInHaut(dansHaut);
    feedback.distanceHaut = p.y;
  }
  if (feedback.showBas) {
    feedback.setMouseInBas(dansBas);
    feedback.distanceBas = scrollPane.getHeight() - p.y;
  }
  if (feedback.showGauche) {
    feedback.setMouseInGauche(dansGauche);
    feedback.distanceGauche = p.x;
  }
  if (feedback.showDroite) {
    feedback.setMouseInDroite(dansDroite);
    feedback.distanceDroite = scrollPane.getWidth() - p.x;
  }
  verifyTimer();
}

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

/**
 *
 * @return
 */
private boolean isViewerLessThanHalfFull()
{
 Position endPos = _viewer.getDocument().getEndPosition();
 if( endPos == null )
 {
  return false;
 }
 int iEndPos = endPos.getOffset() - 1;
 try
 {
  Rectangle rcEndPos = _viewer.modelToView( iEndPos );
  if( rcEndPos != null )
  {
   return rcEndPos.y + rcEndPos.height < _scroller.getHeight() / 2;
  }
 }
 catch( Exception e )
 {
  // Do nothing
 }
 return false;
}

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

/**
 *
 * @return
 */
private boolean isViewerLessThanHalfFull()
{
 Position endPos = _viewer.getDocument().getEndPosition();
 if( endPos == null )
 {
  return false;
 }
 int iEndPos = endPos.getOffset() - 1;
 try
 {
  Rectangle rcEndPos = _viewer.modelToView( iEndPos );
  if( rcEndPos != null )
  {
   return rcEndPos.y + rcEndPos.height < _scroller.getHeight() / 2;
  }
 }
 catch( Exception e )
 {
  // Do nothing
 }
 return false;
}

代码示例来源:origin: senbox-org/snap-desktop

@Override
public void paintComponent(Graphics g) {
  if (img != null) {
    Graphics2D g2 = (Graphics2D)g;
    g2.addRenderingHints(new RenderingHints(
        RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
    g2.addRenderingHints(new RenderingHints(
        RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
    g2.addRenderingHints(new RenderingHints(
        RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC));
    int w = imgScrollPanel.getWidth()*zoom - 10;
    int h = imgScrollPanel.getHeight()*zoom - 10;
    setIcon(new ImageIcon(new FixedSizeThumbnailMaker()
        .size(w, h)
        .keepAspectRatio(true)
        .fitWithinDimensions(true)
        .make(img)));
  }
  super.paintComponent(g);
}

代码示例来源:origin: mikaelhg/openblocks

/**
 * redraws and revalidates the size and preferred size of the viewport
 * and scroll pane to reflect the current collection of explorers.
 */
public void reformView() {
  int accumWidth = 0;
  int height = scroll.getHeight();
  int width = scroll.getWidth();
  for (Explorer explorer : explorers) {
    explorer.getJComponent().setBounds(accumWidth, 0, width, height);
    explorer.reformView();
    accumWidth += width;
  }
  view.setPreferredSize(new Dimension(accumWidth, height));
  view.setBounds(0, 0, accumWidth, height);
  scroll.revalidate();
  scroll.repaint();
  scroll.getHorizontalScrollBar().setValue(explorers.get(position).getJComponent().getX());
}

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

vsbR.height = isVsbCoversWholeHeight(scrollPane) ? scrollPane.getHeight() - insets.bottom - insets.top : availR.height + vpbInsets.top + vpbInsets.bottom;
hsbR.width = isHsbCoversWholeWidth(scrollPane) ? scrollPane.getWidth() - vsbR.width - insets.left - insets.right : availR.width + vpbInsets.left + vpbInsets.right;
rowHeadR.height = availR.height + vpbInsets.top + vpbInsets.bottom;

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

JScrollPane pane = (JScrollPane)parent;
Rectangle bounds = new Rectangle(pane.getWidth(), pane.getHeight());
JBInsets.removeFrom(bounds, pane.getInsets());

相关文章

JScrollPane类方法