@Override public int getVScrollbarWidth() { return verticalSB.getWidth(); }
/** * Shows or hides the thumbnails by moving the split pane divider */ public void doThumbs(boolean show) { if (show) { split.setDividerLocation((int) thumbs.getPreferredSize().width + (int) thumbscroll.getVerticalScrollBar(). getWidth() + 4); } else { split.setDividerLocation(0); } }
@RunsInCurrentThread @Override int arrow(@Nonnull JScrollBar scrollBar) { return scrollBar.getWidth(); } }
@Override public Point call() throws Exception { boolean horizontal = bar.getOrientation() == JScrollBar.HORIZONTAL; int arrow = horizontal ? bar.getHeight() : bar.getWidth(); if (up) { return horizontal ? new Point(bar.getWidth() - arrow/2, arrow/2) : new Point(arrow/2, bar.getHeight() - arrow/2); } return new Point(arrow/2, arrow/2); } });
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()); } }
public Dimension getPreferredSize(JComponent c) { if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { return new Dimension(DEFAULT_THICKNESS, scrollbar.getHeight()); } else { return new Dimension(scrollbar.getWidth(), DEFAULT_THICKNESS); } }
@Override @RunsInCurrentThread @Nonnull Point unitLocationToScrollDown(@Nonnull JScrollBar scrollBar) { int arrow = arrow(scrollBar); return new Point(scrollBar.getWidth() - arrow / 2, arrow / 2); }
@Override @RunsInCurrentThread @Nonnull Point thumbLocation(@Nonnull JScrollBar scrollBar, double fraction) { int arrow = arrow(scrollBar); return new Point(arrow + (int) (fraction * (scrollBar.getWidth() - 2 * arrow)), arrow / 2); }
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); } });
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); } });
@Override public Dimension getPreferredSize() { int wPlus = verticalScrollBar.getWidth(); int hPlus = horizontalScrollBar.getHeight(); int w = super.getPreferredSize().width + wPlus; int h = super.getPreferredSize().height + hPlus; if (w < maxWidth && h < maxHeight) { return new Dimension(w, h); } else { return new Dimension(Math.min(maxWidth, w), Math.min(maxHeight, h)); } }
@Override public Dimension getPreferredSize() { int wPlus = verticalScrollBar.getWidth(); int hPlus = horizontalScrollBar.getHeight(); int w = super.getPreferredSize().width+wPlus; int h = super.getPreferredSize().height+hPlus; if (w < maxWidth && h < maxHeight) { return new Dimension(w,h); } else { return new Dimension(Math.min(maxWidth, w), Math.min(maxHeight, h)); } }
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); } });
protected Rectangle getCapBounds() { if (scrollbar.getOrientation() == JScrollBar.VERTICAL) { return new Rectangle(0, 0, scrollBarWidth, capSize); } else if (scrollbar.getComponentOrientation().isLeftToRight()) { return new Rectangle(0, 0, capSize, scrollBarWidth); } else { return new Rectangle(scrollbar.getWidth() - capSize, 0, capSize, scrollBarWidth); } }
public void run() { listModel.addElement(a.name); if (listModel.size() == 1) { listPanel.setSelectedIndex(0); } // update the list's size Dimension d = listPanel.getMinimumSize(); listPanel.setPreferredSize(new Dimension(d.width + listScroll.getVerticalScrollBar().getWidth(), d.height)); validate(); } });
public void run() { listModel.addElement(a.name); if (listModel.size() == 1) { listPanel.setSelectedIndex(0); } // update the list's size Dimension d = listPanel.getMinimumSize(); listPanel.setPreferredSize(new Dimension(d.width + listScroll.getVerticalScrollBar().getWidth(), d.height)); validate(); } });
public void run() { listModel.addElement(name); if (listModel.size() == 1) { listPanel.setSelectedIndex(0); } // update the list's size Dimension d = listPanel.getMinimumSize(); listPanel.setPreferredSize(new Dimension(d.width + scroll.getVerticalScrollBar().getWidth(), d.height)); // make sure it's preferred size is up to date Component old = ((BorderLayout) bodyPanel.getLayout()).getLayoutComponent(BorderLayout.CENTER); if (old != null) old.setPreferredSize(new Dimension(bodyWidth, bodyHeight)); validate(); } });
@Override public void layoutContainer(Container parent) { super.layoutContainer(parent); if (lowerLeft != null && hsb != null) { Dimension llp = lowerLeft.getPreferredSize(); //Insets insets = parent.getInsets(); lowerLeft.setBounds(hsb.getX(), hsb.getY(), llp.width, hsb.getHeight()); hsb.setBounds(hsb.getX() + llp.width, hsb.getY(), hsb.getWidth() - llp.width, hsb.getHeight()); } }
/** * Paints the border around the viewport. * * @param g the graphics context. * @param viewer the viewer. */ protected void paintViewportBorder(Graphics2D g, HexViewer viewer) { JScrollBar scrollBar = getVerticalScrollBar(viewer); if (scrollBar == null) { return; } Border border = viewer.getViewportBorder(); if (border != null) { border.paintBorder(viewer, g, 0, 0, viewer.getWidth() - scrollBar.getWidth(), viewer.getHeight()); } }
static void fixPreferredSize(Dimension size, JComponent view, JScrollBar vsb, JScrollBar hsb) { if (!view.isPreferredSizeSet()) { Border border = view.getBorder(); if (border instanceof ViewBorder) { Alignment va = getAlignment(vsb); if (va == Alignment.LEFT || va == Alignment.RIGHT && isAlignmentNeeded(view)) { size.width -= vsb.getWidth(); } Alignment ha = getAlignment(hsb); if (ha == Alignment.TOP || ha == Alignment.BOTTOM && isAlignmentNeeded(view)) { size.height -= hsb.getHeight(); } } } }