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

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

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

JScrollPane.doLayout介绍

暂无

代码示例

代码示例来源:origin: nz.ac.waikato.cms.weka.thirdparty/bounce

public void componentResized( ComponentEvent e) {
    scrollPane.doLayout();
  }
};

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

@Override
public void doLayout() {
  if(viewport != null){
    final Component view = viewport.getView();
    if(view != null)
      view.invalidate();
  }
  super.doLayout();
}

代码示例来源: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: org.simplericity.jettyconsole/jetty-console-core

scroll.setVisible(true);
scroll.invalidate();
scroll.doLayout();
scroll.paintImmediately(new Rectangle(scroll.getSize()));

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

@Override
public void doLayout() {
  super.doLayout();
  final Insets insets = getInsets();
  final int insetHeight = insets.top + insets.bottom;
  final Dimension prefSize = getViewport().getPreferredSize();
  int height = getHeight() - insetHeight;
  if (getHorizontalScrollBar().isVisible()) {
    height -= getHorizontalScrollBar().getHeight();
  }
  final boolean isVsbNeeded = height < prefSize.height;
  boolean layoutAgain = false;
  if (isVsbNeeded && getVerticalScrollBarPolicy() == ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER) {
    setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    layoutAgain = true;
  }
  else if (!isVsbNeeded && getVerticalScrollBarPolicy() == ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS) {
    setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
    layoutAgain = true;
  }
  if (layoutAgain) {
    super.doLayout();
    EventQueue.invokeLater(new Runnable() {
      public void run() {
        ((JComponent) getParent()).revalidate();
      }
    });
  }
}

代码示例来源:origin: net.java.dev.laf-widget/laf-widget

void installOnScrollPane(JScrollPane aScrollPane) {
  if (theScrollPane != null)
    uninstallFromScrollPane();
  theScrollPane = aScrollPane;
  theFormerLayoutManager = theScrollPane.getLayout();
  theScrollPane.setLayout(new TweakedScrollPaneLayout());
  theScrollPane.firePropertyChange("layoutManager", false, true);
  theScrollPane.addPropertyChangeListener(COMPONENT_ORIENTATION,
      propertyChangeListener);
  theScrollPane.getViewport().addContainerListener(
      theViewPortViewListener);
  theScrollPane.setCorner(JScrollPane.LOWER_TRAILING_CORNER, theButton);
  Component comp = theScrollPane.getViewport().getView();
  theComponent = (comp instanceof JComponent) ? (JComponent) comp : null;
  this.theButton.setIcon(LafWidgetRepository.getRepository()
      .getLafSupport().getSearchIcon(
          UIManager.getInt("ScrollBar.width") - 3,
          theScrollPane.getComponentOrientation()));
  theScrollPane.doLayout();
}

相关文章

JScrollPane类方法