javax.swing.JScrollBar.isVisible()方法的使用及代码示例

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

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

JScrollBar.isVisible介绍

暂无

代码示例

代码示例来源:origin: deathmarine/Luyten

int direction = e.getWheelRotation() < 0 ? -1 : 1;
int orientation = SwingConstants.VERTICAL;
if (toScroll == null || !toScroll.isVisible()) {
  toScroll = scrollPane.getHorizontalScrollBar();
  if (toScroll == null || !toScroll.isVisible()) {
    return;

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

@Override
  public void layoutContainer(Container target) {
    super.layoutContainer(target);
    int width = LightScrollPane.this.getWidth();
    int height = LightScrollPane.this.getHeight();
    LightScrollPane.this.scrollPane.setBounds(0, 0, width, height);
    int scrollBarSize = THUMB_SIZE;
    int cornerOffset = LightScrollPane.this.verticalScrollBar.isVisible() && LightScrollPane.this.horizontalScrollBar.isVisible() ? scrollBarSize : 0;
    if (LightScrollPane.this.verticalScrollBar.isVisible()) {
      LightScrollPane.this.verticalScrollBar.setBounds(
        LightScrollPane.this.getComponentOrientation() == ComponentOrientation.RIGHT_TO_LEFT
        ? 0
        : width - scrollBarSize,
        0,
        scrollBarSize,
        height - cornerOffset
      );
    }
    if (LightScrollPane.this.horizontalScrollBar.isVisible()) {
      LightScrollPane.this.horizontalScrollBar.setBounds(
        0,
        height - scrollBarSize,
        width - cornerOffset,
        scrollBarSize
      );
    }
  }
});

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-profiler

public boolean fitsVisibleArea() {
  return !infoAreaScrollPane.getVerticalScrollBar().isVisible();
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-visualizers

public boolean fitsVisibleArea() {
  return !tableScroll.getVerticalScrollBar().isVisible();
}

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

protected ImageIcon getAutoScrollIcon() {
  ImageIcon icon;
  if (scrollPane.getHorizontalScrollBar().isVisible()) {
    if (scrollPane.getVerticalScrollBar().isVisible()) {
      icon = HV_IMAGE_ICON;
    } else {
      icon = H_IMAGE_ICON;
    }
  } else {
    if (scrollPane.getVerticalScrollBar().isVisible()) {
      icon = V_IMAGE_ICON;
    } else {
      icon = HV_IMAGE_ICON;
    }
  }
  return icon;
}

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

/**
 * Returns {@code false} for visible translucent scroll bars, or {@code true} otherwise.
 * It is needed to repaint translucent scroll bars on viewport repainting.
 */
private static boolean isOptimizedDrawingEnabledFor(JScrollBar bar) {
 return bar == null || bar.isOpaque() || !bar.isVisible();
}

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

private boolean shouldExtendViewportUnderScrollbar(@Nullable JScrollBar scrollbar) {
 if (scrollbar == null || !scrollbar.isVisible()) return false;
 return isOverlaidScrollbar(scrollbar);
}

代码示例来源:origin: omegat-org/omegat

private void propagateTableColumns() {
  // Set last column of tableTotal to match size of scrollbar.
  JScrollBar scrollbar = list.scrollFiles.getVerticalScrollBar();
  int sbWidth = scrollbar == null || !scrollbar.isVisible() ? 0 : scrollbar.getWidth();
  list.tableTotal.getColumnModel().getColumn(TotalsTableColumn.MARGIN.index).setPreferredWidth(sbWidth);
  // Propagate column sizes to totals table
  for (int i = 0; i < list.tableFiles.getColumnCount(); i++) {
    TableColumn srcCol = list.tableFiles.getColumnModel().getColumn(i);
    TableColumn trgCol = list.tableTotal.getColumnModel().getColumn(i);
    trgCol.setPreferredWidth(srcCol.getWidth());
  }
}

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

public void run()
  {
    double mainWidth = main.getSize().getWidth();
    double optionsWidth = options.getPreferredSize().getWidth();
    // consider scrollbar width if visible
    double scrollWidth = options.getVerticalScrollBar().isVisible() ? options.getVerticalScrollBar().getWidth() : 0;
    double	loc	= (mainWidth - optionsWidth - scrollWidth) / mainWidth;
    if(loc>=0 && loc<=1)	// Might be NaN, if plugin is switched before panel is shown.
      main.setDividerLocation(loc);
  }
});

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

public void run()
  {
    double mainWidth = main.getWidth();
    double optionsWidth = options.getPreferredSize().getWidth();
    // consider scrollbar width if visible
    double scrollWidth = options.getVerticalScrollBar().isVisible() ? options.getVerticalScrollBar().getWidth() : 0;
    double	loc	= (mainWidth - optionsWidth - scrollWidth) / mainWidth;
    if(loc>=0 && loc<=1)	// Might be NaN, if plugin is switched before panel is shown.
      main.setDividerLocation(loc);
  }
});

代码示例来源:origin: net.sourceforge.jadex/jadex-tools-comanalyzer

public void run()
  {
    double mainWidth = main.getWidth();
    double optionsWidth = options.getPreferredSize().getWidth();
    // consider scrollbar width if visible
    double scrollWidth = options.getVerticalScrollBar().isVisible() ? options.getVerticalScrollBar().getWidth() : 0;
    double	loc	= (mainWidth - optionsWidth - scrollWidth) / mainWidth;
    if(loc>=0 && loc<=1)	// Might be NaN, if plugin is switched before panel is shown.
      main.setDividerLocation(loc);
  }
});

代码示例来源:origin: UNIVALI-LITE/Portugol-Studio

@Override
public void layoutContainer(Container cntnr) {
  super.layoutContainer(cntnr);
  if(!hsb.isVisible() && vsb.isVisible()){
    Dimension tamanhoBarraVertical = vsb.getSize();
    tamanhoBarraVertical.height -= hsb.getPreferredSize().height;
    vsb.setSize(tamanhoBarraVertical);
  }
}

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

/**
 * Returns the alignment of the specified scroll bar
 * if and only if the specified scroll bar
 * is located over the main viewport.
 *
 * @param bar the scroll bar to process
 * @return the scroll bar alignment or {@code null}
 */
private static Alignment getAlignment(JScrollBar bar) {
  if (bar != null && bar.isVisible() && !bar.isOpaque()) {
    return (Alignment) UIUtil.getClientProperty(bar, Alignment.class);
  }
  return null;
}

代码示例来源:origin: bbuck/DragonConsole

public void run() {
    try {
      if (vBar.isVisible())
        vBar.setValue(vBar.getMaximum() - vBar.getModel().getExtent());
      console.repaint();
    } catch (Exception exc) {
      JOptionPane.showMessageDialog(null,
          "Error #0005\n"
              + "Failed to set the JScrollBar to Max Value!\n"
              + exc.getMessage(),
          "Error Caught", JOptionPane.ERROR_MESSAGE);
    }
  }
});

代码示例来源:origin: org.orbisgis/mapeditor

/**
     * Compute the best height to show all the items of the JTree 
     * plus the decoration height.
     * @return Height in pixels
     */
    public Dimension getMinimalComponentDimension() {                
        Dimension panel = getPreferredSize();
        Dimension treeDim = tree.getPreferredSize();
        // Get the vertical scrollbar width
        JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
        if(scrollBar!=null && scrollBar.isVisible()) {
            return new Dimension(panel.width+scrollBar.getWidth(),treeDim.height+getMinimumSize().height);
        } else {
            return new Dimension(panel.width,treeDim.height+getMinimumSize().height);
        }
    }
}

代码示例来源:origin: org.integratedmodelling/klab-common

@Override
  public void run() {
    try {
      sleep(80); // Time out for a tenth of a second
      if (vBar.isVisible())
        vBar.setValue(vBar.getMaximum() - vBar.getModel().getExtent());
      console.repaint();
    } catch (Exception exc) {
      JOptionPane.showMessageDialog(null, "Error #0005\n"
          + "Failed to set the JScrollBar to Max Value!\n"
          + exc.getMessage(), "Error Caught", JOptionPane.ERROR_MESSAGE);
    }
  }
}.start();

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

public static boolean isValidCellBoundary(Component aTarget) {
    JScrollPane scroll = getFirstScrollPane(aTarget);
    if (scroll != null && (scroll.getHorizontalScrollBar() == null || !scroll.getHorizontalScrollBar().isVisible())) {
      Point rightOnScroll = SwingUtilities.convertPoint(aTarget, new Point(aTarget.getWidth(), 1), scroll);
      int scrollRightBoundary = (scroll.getWidth() - (scroll.getInsets() != null ? scroll.getInsets().right : 0));
      return (scrollRightBoundary - rightOnScroll.x) > MultiLevelHeader.PICK_MARGIN_SIZE;
    }
    return true;
  }
}

代码示例来源:origin: apache/batik

public void mouseWheelMoved(MouseWheelEvent e)
  {
    final JScrollBar sb = (vertical.isVisible()) ?
      vertical : horizontal;        // vertical is preferred
    if(e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
      final int amt = e.getUnitsToScroll() * sb.getUnitIncrement();
      sb.setValue(sb.getValue() + amt);
    } else if(e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL){
      final int amt = e.getWheelRotation() * sb.getBlockIncrement();
      sb.setValue(sb.getValue() + amt);
    }
  }// mouseWheelMoved()
}// inner class WheelListener

代码示例来源:origin: org.apache.xmlgraphics/batik-swing

public void mouseWheelMoved(MouseWheelEvent e)
  {
    final JScrollBar sb = (vertical.isVisible()) ?
      vertical : horizontal;        // vertical is preferred
    if(e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
      final int amt = e.getUnitsToScroll() * sb.getUnitIncrement();
      sb.setValue(sb.getValue() + amt);
    } else if(e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL){
      final int amt = e.getWheelRotation() * sb.getBlockIncrement();
      sb.setValue(sb.getValue() + amt);
    }
  }// mouseWheelMoved()
}// inner class WheelListener

代码示例来源:origin: fr.avianey.apache-xmlgraphics/batik

public void mouseWheelMoved(MouseWheelEvent e)
  {
    final JScrollBar sb = (vertical.isVisible()) ?
      vertical : horizontal;        // vertical is preferred
    if(e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) {
      final int amt = e.getUnitsToScroll() * sb.getUnitIncrement();
      sb.setValue(sb.getValue() + amt);
    } else if(e.getScrollType() == MouseWheelEvent.WHEEL_BLOCK_SCROLL){
      final int amt = e.getWheelRotation() * sb.getBlockIncrement();
      sb.setValue(sb.getValue() + amt);
    }
  }// mouseWheelMoved()
}// inner class WheelListener

相关文章

JScrollBar类方法