Search in sources :

Example 1 with JScrollBar

use of javax.swing.JScrollBar in project jmeter by apache.

the class ProxyControlGui method createTargetPanel.

private JPanel createTargetPanel() {
    targetNodesModel = new DefaultComboBoxModel<>();
    targetNodes = new JComboBox<>(targetNodesModel);
    // $NON-NLS-1$ // Bug 56303 fixed the width of combo list
    targetNodes.setPrototypeDisplayValue("");
    // get popup element
    JPopupMenu popup = (JPopupMenu) targetNodes.getUI().getAccessibleChild(targetNodes, 0);
    JScrollPane scrollPane = findScrollPane(popup);
    if (scrollPane != null) {
        // add scroll pane if label element is too long
        scrollPane.setHorizontalScrollBar(new JScrollBar(JScrollBar.HORIZONTAL));
        scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    }
    targetNodes.setActionCommand(CHANGE_TARGET);
    // Action listener will be added later
    // $NON-NLS-1$
    JLabel label = new JLabel(JMeterUtils.getResString("proxy_target"));
    label.setLabelFor(targetNodes);
    HorizontalPanel panel = new HorizontalPanel();
    panel.add(label);
    panel.add(targetNodes);
    return panel;
}
Also used : JScrollPane(javax.swing.JScrollPane) HorizontalPanel(org.apache.jmeter.gui.util.HorizontalPanel) JLabel(javax.swing.JLabel) JPopupMenu(javax.swing.JPopupMenu) JScrollBar(javax.swing.JScrollBar)

Example 2 with JScrollBar

use of javax.swing.JScrollBar in project felix by apache.

the class LogPanel method log.

/* public static void log(String msg) {
        logArea.append(msg + "\n\r");
		JScrollBar scrBar = scroll.getVerticalScrollBar();
		int maxPos = scrBar.getMaximum();
		scrBar.setValue(maxPos);
   }*/
public static void log(final String msg) {
    synchronized (logArea) {
        logArea.append(msg);
        logArea.append("\n\r");
    }
    JScrollBar scrBar = scroll.getVerticalScrollBar();
    int maxPos = scrBar.getMaximum();
    scrBar.setValue(maxPos);
}
Also used : JScrollBar(javax.swing.JScrollBar)

Example 3 with JScrollBar

use of javax.swing.JScrollBar in project omegat by omegat-org.

the class PreferencesWindowController method adjustTreeSize.

private void adjustTreeSize() {
    JScrollBar hScrollBar = innerPanel.availablePrefsScrollPane.getHorizontalScrollBar();
    if (hScrollBar != null) {
        int currentWidth = innerPanel.availablePrefsScrollPane.getViewport().getWidth();
        int preferredWidth = hScrollBar.getMaximum();
        if (preferredWidth > currentWidth) {
            int newWidth = innerPanel.leftPanel.getWidth() + (preferredWidth - currentWidth);
            innerPanel.leftPanel.setMinimumSize(new Dimension(newWidth, 0));
            innerPanel.mainSplitPane.setDividerLocation(-1);
        }
    }
}
Also used : Dimension(java.awt.Dimension) Point(java.awt.Point) JScrollBar(javax.swing.JScrollBar)

Example 4 with JScrollBar

use of javax.swing.JScrollBar in project omegat by omegat-org.

the class AutoCompleterListView method getPreferredWidth.

@Override
public int getPreferredWidth() {
    int width = getList().getPreferredSize().width;
    JScrollBar bar = completer.scroll.getVerticalScrollBar();
    if (bar != null) {
        width += bar.getPreferredSize().width;
    }
    return width;
}
Also used : Point(java.awt.Point) JScrollBar(javax.swing.JScrollBar)

Example 5 with JScrollBar

use of javax.swing.JScrollBar in project omegat by omegat-org.

the class ProjectFilesListController method propagateTableColumns.

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());
    }
}
Also used : TableColumn(javax.swing.table.TableColumn) Point(java.awt.Point) JScrollBar(javax.swing.JScrollBar)

Aggregations

JScrollBar (javax.swing.JScrollBar)60 Dimension (java.awt.Dimension)12 Point (java.awt.Point)12 JScrollPane (javax.swing.JScrollPane)10 JLabel (javax.swing.JLabel)7 JPanel (javax.swing.JPanel)6 Component (java.awt.Component)5 JTabbedPane (javax.swing.JTabbedPane)5 JTextArea (javax.swing.JTextArea)5 GridBagConstraints (java.awt.GridBagConstraints)4 Insets (java.awt.Insets)4 ActionEvent (java.awt.event.ActionEvent)4 JPopupMenu (javax.swing.JPopupMenu)4 JViewport (javax.swing.JViewport)4 Color (java.awt.Color)3 GridBagLayout (java.awt.GridBagLayout)3 ActionListener (java.awt.event.ActionListener)3 AdjustmentEvent (java.awt.event.AdjustmentEvent)3 AdjustmentListener (java.awt.event.AdjustmentListener)3 IOException (java.io.IOException)3