Package javax.swing

Examples of javax.swing.JScrollBar


                    }
                    else {
                        zoomIn();
                    }
                } else {
                    JScrollBar bar;
                    if (event.isShiftDown()) {
                        // Shift + wheel: scroll horizontally.
                        bar = getHorizontalScrollBar();
                    } else {
                        // Wheel alone: scroll vertically.
                        bar = getVerticalScrollBar();
                    }
                    int newValue = bar.getValue() + bar.getBlockIncrement()
                            * event.getUnitsToScroll();
                    bar.setValue(newValue);
                }
            }
        });
    }
View Full Code Here


    super(null);
  }

  @Override
  protected Component createWidget() {
    JScrollBar bar = new JScrollBar();
    Dimension size = bar.getPreferredSize();
    bar.setSize(size);
    bar.doLayout();
    bar.validate();
    return bar;
  }
View Full Code Here

    return bar;
  }

  @Override
  protected Component newWidget() {
    return new JScrollBar();
  }
View Full Code Here

  private IEditor iEditor;

  @Override
  public IEditor getEditorAt() {
    JScrollBar bar = (JScrollBar) adaptable.cloneWidget();
    iEditor = new TransparentScrollBarEditor(bar);
    return iEditor;
  }
View Full Code Here

      e.printStackTrace();
    }

    // test horizontal scroll bar
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.setUI(ui);
    harness.check(ui.getMaximumThumbSize(), new Dimension(4096, 4096));
 
    // test vertical scroll bar
    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
    scrollBar2.setUI(ui2);
    harness.check(ui2.getMaximumThumbSize(), new Dimension(4096, 4096));
   
    // restore a sane look and feel
    try
    {
View Full Code Here

   * @param harness the test harness to use
   */
  private void testIncrButton(TestHarness harness)
  {
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
    ui.setScrollbar(new JScrollBar());
    harness.check(ui.getIncrButton(), null);
    ui.installDefaults();
    harness.check(ui.getIncrButton(), null);
  }
View Full Code Here

   * @param harness the test harness to use
   */
  private void testDecrButton(TestHarness harness)
  {
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
    ui.setScrollbar(new JScrollBar());
    harness.check(ui.getDecrButton(), null);
    ui.installDefaults();
    harness.check(ui.getDecrButton(), null);
  }
View Full Code Here

      e.printStackTrace();
    }

    // test horizontal scroll bar
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.setUI(ui);
    harness.check(ui.getMaximumSize(scrollBar),
            new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
 
    // test vertical scroll bar
    MyBasicScrollBarUI ui2 = new MyBasicScrollBarUI();
    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
    scrollBar2.setUI(ui2);
    harness.check(ui2.getMaximumSize(scrollBar2),
            new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE));
   
    // restore a sane look and feel
    try
View Full Code Here

    }
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
    harness.check(ui.getTrackBounds(), null);
    harness.check(ui.getThumbBounds(), null);
   
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.setUI(ui);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    scrollBar.setBounds(0, 0, 100, 20);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 0, 0, 0));
    harness.check(ui.getThumbBounds(), new Rectangle(0, 0, 0, 0));
   
    JPanel panel = new JPanel(new BorderLayout());
    panel.setSize(100, 20);
View Full Code Here

  }
 
  public void testHorizontal(TestHarness harness
  {
    MyBasicScrollBarUI ui = new MyBasicScrollBarUI();
        JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.setUI(ui);
    scrollBar.setBounds(0, 0, 100, 20);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 68, 20));   
    harness.check(ui.getThumbBounds(), new Rectangle(16, 0, 8, 20));
   
    scrollBar.setBounds(40, 50, 250, 37);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(16, 0, 218, 37));   
    harness.check(ui.getThumbBounds(), new Rectangle(16, 0, 21, 37));
  }
View Full Code Here

TOP

Related Classes of javax.swing.JScrollBar

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.