Search in sources :

Example 16 with JScrollBar

use of javax.swing.JScrollBar in project jdk8u_jdk by JetBrains.

the class Test8039464 method init.

private static void init(Container container) {
    container.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridx = 0;
    gbc.gridy = 1;
    JLabel label = new JLabel();
    Dimension size = new Dimension(111, 0);
    label.setPreferredSize(size);
    label.setMinimumSize(size);
    container.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1;
    container.add(new JScrollBar(JScrollBar.HORIZONTAL, 1, 111, 1, 1111), gbc);
    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 1;
    container.add(new JScrollBar(JScrollBar.VERTICAL, 1, 111, 1, 1111), gbc);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel) Dimension(java.awt.Dimension) JScrollBar(javax.swing.JScrollBar)

Example 17 with JScrollBar

use of javax.swing.JScrollBar in project GCViewer by chewiebug.

the class GCDocument method setWatched.

public void setWatched(boolean watched) {
    this.watched = watched;
    final JScrollBar horizontalScrollBar = ((ModelChartImpl) getLastMaximizedChartPanelView().getModelChart()).getHorizontalScrollBar();
    if (watched) {
        horizontalScrollBar.setValue(horizontalScrollBar.getMaximum());
    }
    horizontalScrollBar.setEnabled(!watched);
}
Also used : JScrollBar(javax.swing.JScrollBar)

Example 18 with JScrollBar

use of javax.swing.JScrollBar in project jodd by oblac.

the class SwingUtil method scrollToTop.

/**
	 * Scrolls scroll pane to the top left corner.
	 */
public static void scrollToTop(final JScrollPane scrollPane) {
    JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
    JScrollBar horizontalScrollBar = scrollPane.getHorizontalScrollBar();
    verticalScrollBar.setValue(verticalScrollBar.getMinimum());
    horizontalScrollBar.setValue(horizontalScrollBar.getMinimum());
}
Also used : JScrollBar(javax.swing.JScrollBar)

Example 19 with JScrollBar

use of javax.swing.JScrollBar in project mc-dev by Bukkit.

the class ServerGUI method a.

public void a(JTextArea jtextarea, JScrollPane jscrollpane, String s) {
    if (!SwingUtilities.isEventDispatchThread()) {
        SwingUtilities.invokeLater(new ServerGuiInvokeRunnable(this, jtextarea, jscrollpane, s));
    } else {
        Document document = jtextarea.getDocument();
        JScrollBar jscrollbar = jscrollpane.getVerticalScrollBar();
        boolean flag = false;
        if (jscrollpane.getViewport().getView() == jtextarea) {
            flag = (double) jscrollbar.getValue() + jscrollbar.getSize().getHeight() + (double) (a.getSize() * 4) > (double) jscrollbar.getMaximum();
        }
        try {
            document.insertString(document.getLength(), s, (AttributeSet) null);
        } catch (BadLocationException badlocationexception) {
            ;
        }
        if (flag) {
            jscrollbar.setValue(Integer.MAX_VALUE);
        }
    }
}
Also used : Document(javax.swing.text.Document) BadLocationException(javax.swing.text.BadLocationException) JScrollBar(javax.swing.JScrollBar)

Example 20 with JScrollBar

use of javax.swing.JScrollBar in project jdk8u_jdk by JetBrains.

the class InsetsEncapsulation method run.

@Override
public void run() {
    runTest(new JLabel("hi"));
    runTest(new JMenu());
    runTest(new JTree());
    runTest(new JTable());
    runTest(new JMenuItem());
    runTest(new JCheckBoxMenuItem());
    runTest(new JToggleButton());
    runTest(new JSpinner());
    runTest(new JSlider());
    runTest(Box.createVerticalBox());
    runTest(Box.createHorizontalBox());
    runTest(new JTextField());
    runTest(new JTextArea());
    runTest(new JTextPane());
    runTest(new JPasswordField());
    runTest(new JFormattedTextField());
    runTest(new JEditorPane());
    runTest(new JButton());
    runTest(new JColorChooser());
    runTest(new JFileChooser());
    runTest(new JCheckBox());
    runTest(new JInternalFrame());
    runTest(new JDesktopPane());
    runTest(new JTableHeader());
    runTest(new JLayeredPane());
    runTest(new JRootPane());
    runTest(new JMenuBar());
    runTest(new JOptionPane());
    runTest(new JRadioButton());
    runTest(new JRadioButtonMenuItem());
    runTest(new JPopupMenu());
    runTest(new JScrollBar());
    runTest(new JScrollPane());
    runTest(new JViewport());
    runTest(new JSplitPane());
    runTest(new JTabbedPane());
    runTest(new JToolBar());
    runTest(new JSeparator());
    runTest(new JProgressBar());
    if (!failures.isEmpty()) {
        System.out.println("These classes failed");
        for (final Component failure : failures) {
            System.out.println(failure.getClass());
        }
        throw new RuntimeException("Test failed");
    }
}
Also used : JDesktopPane(javax.swing.JDesktopPane) JTextArea(javax.swing.JTextArea) JRadioButton(javax.swing.JRadioButton) JLayeredPane(javax.swing.JLayeredPane) JTabbedPane(javax.swing.JTabbedPane) JButton(javax.swing.JButton) JProgressBar(javax.swing.JProgressBar) JTableHeader(javax.swing.table.JTableHeader) JTextField(javax.swing.JTextField) JSeparator(javax.swing.JSeparator) JScrollBar(javax.swing.JScrollBar) JTextPane(javax.swing.JTextPane) JToggleButton(javax.swing.JToggleButton) JSlider(javax.swing.JSlider) JMenuItem(javax.swing.JMenuItem) JComponent(javax.swing.JComponent) Component(java.awt.Component) JScrollPane(javax.swing.JScrollPane) JViewport(javax.swing.JViewport) JFormattedTextField(javax.swing.JFormattedTextField) JLabel(javax.swing.JLabel) JRadioButtonMenuItem(javax.swing.JRadioButtonMenuItem) JToolBar(javax.swing.JToolBar) JOptionPane(javax.swing.JOptionPane) JCheckBoxMenuItem(javax.swing.JCheckBoxMenuItem) JPopupMenu(javax.swing.JPopupMenu) JCheckBox(javax.swing.JCheckBox) JTree(javax.swing.JTree) JFileChooser(javax.swing.JFileChooser) JPasswordField(javax.swing.JPasswordField) JTable(javax.swing.JTable) JEditorPane(javax.swing.JEditorPane) JSpinner(javax.swing.JSpinner) JRootPane(javax.swing.JRootPane) JSplitPane(javax.swing.JSplitPane) JColorChooser(javax.swing.JColorChooser) JInternalFrame(javax.swing.JInternalFrame) JMenu(javax.swing.JMenu) JMenuBar(javax.swing.JMenuBar)

Aggregations

JScrollBar (javax.swing.JScrollBar)26 JScrollPane (javax.swing.JScrollPane)6 Dimension (java.awt.Dimension)5 JTextArea (javax.swing.JTextArea)5 Point (java.awt.Point)4 JFrame (javax.swing.JFrame)3 JLabel (javax.swing.JLabel)3 JViewport (javax.swing.JViewport)3 GridBagConstraints (java.awt.GridBagConstraints)2 JButton (javax.swing.JButton)2 JPanel (javax.swing.JPanel)2 JPopupMenu (javax.swing.JPopupMenu)2 JTabbedPane (javax.swing.JTabbedPane)2 JTextPane (javax.swing.JTextPane)2 JmriJFrame (jmri.util.JmriJFrame)2 GCResourceGroup (com.tagtraum.perf.gcviewer.view.model.GCResourceGroup)1 Component (java.awt.Component)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 Scrollbar (java.awt.Scrollbar)1