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

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

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

JScrollPane.getHorizontalScrollBarPolicy介绍

暂无

代码示例

代码示例来源:origin: ron190/jsql-injection

private ControlPanel(JScrollPane scrollPane) {
    this.setLayout(new BorderLayout());
    this.setOpaque(false);
    this.vScrollBar = new JMyScrollBar(Adjustable.VERTICAL);
    scrollPane.setVerticalScrollBar(this.vScrollBar);
    scrollPane.remove(this.vScrollBar);
    if (scrollPane.getVerticalScrollBarPolicy() != ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER) {
      this.add(this.vScrollBar, BorderLayout.EAST);
    }
    this.hScrollBar = new JMyScrollBar(Adjustable.HORIZONTAL);
    scrollPane.setHorizontalScrollBar(this.hScrollBar);
    scrollPane.remove(this.hScrollBar);
    if (scrollPane.getHorizontalScrollBarPolicy() != ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER) {
      this.add(this.hScrollBar, BorderLayout.SOUTH);
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

@Override
public int getHorizontalScrollBarPolicy() {
  if (horizontalScrollBarIsNeeded) {
    return JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS;
  } else {
    return super.getHorizontalScrollBarPolicy();
  }
}

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

@ScriptFunction
@Override
public int getHorizontalScrollBarPolicy() {
  return super.getHorizontalScrollBarPolicy();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

public void layoutContainer(Container parent) {
    super.layoutContainer(parent);
    
    Component view = (viewport != null) ? viewport.getView() : null;
    Dimension viewPrefSize =  (view != null) ? view.getPreferredSize() 
                         : new Dimension(0,0);
    Dimension extentSize =  (viewport != null) ? viewport.toViewCoordinates(viewport.getSize()) 
                          : new Dimension(0,0);
    boolean viewTracksViewportWidth = (view instanceof Scrollable) &&
                     ((Scrollable)view).getScrollableTracksViewportWidth();
    boolean hsbNeeded = !viewTracksViewportWidth &&
              viewPrefSize.width > extentSize.width;
    // enable horizontal scrollbar only if it is needed
    if (hsb != null) {
      hsb.setEnabled(hsbNeeded);
    }
    // make dependent horizontal scrollbar visible by setting scrollbar policy
    JScrollPane scrollPane = (JScrollPane)parent;
    if (scrollPane.getHorizontalScrollBarPolicy() != JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) {
      int newPolicy = hsbNeeded ? JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
                   : JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
      if (newPolicy != dependentScrollPane.getHorizontalScrollBarPolicy()) {
        dependentScrollPane.setHorizontalScrollBarPolicy(newPolicy);
        dependentScrollPane.getViewport().invalidate();
      }
    }
  }
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

public void layoutContainer(Container parent) {
    super.layoutContainer(parent);
    Component view = (viewport != null) ? viewport.getView() : null;
    Dimension viewPrefSize = (view != null) ? view.getPreferredSize() : new Dimension(0, 0);
    Dimension extentSize = (viewport != null) ? viewport.toViewCoordinates(viewport.getSize())
                         : new Dimension(0, 0);
    boolean viewTracksViewportWidth = (view instanceof Scrollable) &&
      ((Scrollable) view).getScrollableTracksViewportWidth();
    boolean hsbNeeded = !viewTracksViewportWidth && (viewPrefSize.width > extentSize.width);
    // enable horizontal scrollbar only if it is needed
    if (hsb != null) {
      hsb.setEnabled(hsbNeeded);
    }
    // make dependent horizontal scrollbar visible by setting scrollbar policy
    JScrollPane scrollPane = (JScrollPane) parent;
    if (scrollPane.getHorizontalScrollBarPolicy() != JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) {
      int newPolicy = hsbNeeded ? JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
                   : JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
      if (newPolicy != dependentScrollPane.getHorizontalScrollBarPolicy()) {
        dependentScrollPane.setHorizontalScrollBarPolicy(newPolicy);
        dependentScrollPane.getViewport().invalidate();
      }
    }
  }
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

public void layoutContainer(Container parent) {
    super.layoutContainer(parent);
    
    Component view = (viewport != null) ? viewport.getView() : null;
    Dimension viewPrefSize =  (view != null) ? view.getPreferredSize() 
                         : new Dimension(0,0);
    Dimension extentSize =  (viewport != null) ? viewport.toViewCoordinates(viewport.getSize()) 
                          : new Dimension(0,0);
    boolean viewTracksViewportWidth = (view instanceof Scrollable) &&
                     ((Scrollable)view).getScrollableTracksViewportWidth();
    boolean hsbNeeded = !viewTracksViewportWidth &&
              viewPrefSize.width > extentSize.width;
    // enable horizontal scrollbar only if it is needed
    if (hsb != null) {
      hsb.setEnabled(hsbNeeded);
    }
    // make dependent horizontal scrollbar visible by setting scrollbar policy
    JScrollPane scrollPane = (JScrollPane)parent;
    if (scrollPane.getHorizontalScrollBarPolicy() != JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS) {
      int newPolicy = hsbNeeded ? JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS
                   : JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED;
      if (newPolicy != dependentScrollPane.getHorizontalScrollBarPolicy()) {
        dependentScrollPane.setHorizontalScrollBarPolicy(newPolicy);
        dependentScrollPane.getViewport().invalidate();
      }
    }
  }
}

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

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

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

if (ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER == pane.getHorizontalScrollBarPolicy()) {
  viewPosition.x = 0;
  viewSize.width = extentSize.width;

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

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

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

/**
 * This method is invoked after the ScrollPaneLayout is set as the
 * LayoutManager of a <code>JScrollPane</code>.
 * It initializes all of the internal fields that
 * are ordinarily set by <code>addLayoutComponent</code>.  For example:
 * <pre>
 * ScrollPaneLayout mySPLayout = new ScrollPanelLayout() {
 *     public void layoutContainer(Container p) {
 *         super.layoutContainer(p);
 *         // do some extra work here ...
 *     }
 * };
 * scrollpane.setLayout(mySPLayout):
 * </pre>
 */
public void syncWithScrollPane(JScrollPane sp) {
  viewport = sp.getViewport();
  vsb = sp.getVerticalScrollBar();
  hsb = sp.getHorizontalScrollBar();
  rowHead = sp.getRowHeader();
  colHead = sp.getColumnHeader();
  lowerLeft = sp.getCorner(LOWER_LEFT_CORNER);
  lowerRight = sp.getCorner(LOWER_RIGHT_CORNER);
  upperLeft = sp.getCorner(UPPER_LEFT_CORNER);
  upperRight = sp.getCorner(UPPER_RIGHT_CORNER);
  vsbPolicy = sp.getVerticalScrollBarPolicy();
  hsbPolicy = sp.getHorizontalScrollBarPolicy();
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

/**
 * This method is invoked after the ScrollPaneLayout is set as the
 * LayoutManager of a <code>JScrollPane</code>.
 * It initializes all of the internal fields that
 * are ordinarily set by <code>addLayoutComponent</code>.  For example:
 * <pre>
 * ScrollPaneLayout mySPLayout = new ScrollPanelLayout() {
 *     public void layoutContainer(Container p) {
 *         super.layoutContainer(p);
 *         // do some extra work here ...
 *     }
 * };
 * scrollpane.setLayout(mySPLayout):
 * </pre>
 */
 public void syncWithScrollPane(JScrollPane sp) {
viewport = sp.getViewport();
vsb = sp.getVerticalScrollBar();
hsb = sp.getHorizontalScrollBar();
rowHead = sp.getRowHeader();
colHead = sp.getColumnHeader();
lowerLeft = sp.getCorner(LOWER_LEFT_CORNER);
lowerRight = sp.getCorner(LOWER_RIGHT_CORNER);
upperLeft = sp.getCorner(UPPER_LEFT_CORNER);
upperRight = sp.getCorner(UPPER_RIGHT_CORNER);
vsbPolicy = sp.getVerticalScrollBarPolicy();
hsbPolicy = sp.getHorizontalScrollBarPolicy();
 }

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

public Dimension minimumLayoutSize(Container parent) {
  JScrollPane scrollPane = (JScrollPane) parent;
  vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
  hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

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

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

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

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();
boolean flatLayout = scrollPane instanceof JideScrollPane && ((JideScrollPane) scrollPane).isFlatLayout();

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

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

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

private void superlayoutContainer(Container parent) {
  JScrollPane scrollPane = (JScrollPane) parent;
  vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
  hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui

private void superlayoutContainer(final Container parent) {
  final JScrollPane scrollPane = (JScrollPane)parent;
  vsbPolicy = scrollPane.getVerticalScrollBarPolicy();
  hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

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

hsbPolicy = scrollPane.getHorizontalScrollBarPolicy();

相关文章

JScrollPane类方法