Package javax.swing

Examples of javax.swing.JScrollBar$ModelListener


   */
  public void testVerticalFreeStanding(TestHarness harness
  {
    harness.checkPoint("testVerticalFreeStanding()");
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.VERTICAL);
    scrollBar.putClientProperty("JScrollBar.isFreeStanding", Boolean.TRUE);
    scrollBar.setUI(ui);
    scrollBar.setBounds(0, 0, 20, 100);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 15, 20, 69));   
    harness.check(ui.getThumbBounds(), new Rectangle(0, 15, 20, 17));
   
    scrollBar.setBounds(40, 50, 37, 250);
    ui.layoutContainer(scrollBar);
    harness.check(ui.getTrackBounds(), new Rectangle(0, 15, 37, 219));   
    harness.check(ui.getThumbBounds(), new Rectangle(0, 15, 37, 21))
  }
View Full Code Here


   */
  public void test(TestHarness harness
  {
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    harness.check(ui.getMinimumThumbSize(), new Dimension(0, 0));
    JScrollBar sb = new JScrollBar(JScrollBar.HORIZONTAL);
    sb.setUI(ui);
    sb.putClientProperty("JScrollBar.isFreeStanding", Boolean.FALSE);
    harness.check(ui.getMinimumThumbSize(), new Dimension(15, 15));
    sb.putClientProperty("JScrollBar.isFreeStanding", Boolean.TRUE);
    harness.check(ui.getMinimumThumbSize(), new Dimension(17, 17));
  }
View Full Code Here

      e.printStackTrace();
    }

    // test horizontal scroll bar
    MyMetalScrollBarUI ui = new MyMetalScrollBarUI();
    JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    scrollBar.setUI(ui);
    harness.check(ui.getPreferredSize(scrollBar), new Dimension(61, 17));
 
    // test vertical scroll bar
    MyMetalScrollBarUI ui2 = new MyMetalScrollBarUI();
    JScrollBar scrollBar2 = new JScrollBar(JScrollBar.VERTICAL);
    scrollBar2.setUI(ui2);
    harness.check(ui2.getPreferredSize(scrollBar2), new Dimension(17, 61));
  }
View Full Code Here

    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);
    }
View Full Code Here

        fScrollBarSkinProvider = scrollBarSkinProvider;
    }

    @Override
    public void installUI(JComponent c) {
        JScrollBar scrollBar = (JScrollBar) c;
        // convert the Swing scroll bar orientation to the type-safe ScrollBarOrientation.
        fOrientation = ScrollBarOrientation.getOrientation(scrollBar.getOrientation());
        fSkin = fScrollBarSkinProvider.provideSkin(fOrientation);
        super.installUI(c);
    }
View Full Code Here

            return;
        }
        // the scrollbars auto-correct if we try to set a value that's out of
        // bounds
        Point hexPoint = getCentreHexLocation(c);
        JScrollBar vscroll = scrollpane.getVerticalScrollBar();
        vscroll.setValue(hexPoint.y - vscroll.getVisibleAmount() / 2);
        JScrollBar hscroll = scrollpane.getHorizontalScrollBar();
        hscroll.setValue(hexPoint.x - hscroll.getVisibleAmount() / 2);
        repaint();
    }
View Full Code Here

    //
    // KeyListener
    //
    public void keyPressed(KeyEvent ke) {
        JScrollBar vbar = scrollpane.getVerticalScrollBar();
        JScrollBar hbar = scrollpane.getHorizontalScrollBar();
        switch (ke.getKeyCode()) {
        case KeyEvent.VK_NUMPAD7:
            hbar.setValue((int) (hbar.getValue() - HEX_W * scale));
            vbar.setValue((int) (vbar.getValue() - HEX_H * scale));
            break;
        case KeyEvent.VK_NUMPAD8:
        case KeyEvent.VK_UP:
            vbar.setValue((int) (vbar.getValue() - HEX_H * scale));
            break;
        case KeyEvent.VK_NUMPAD9:
            hbar.setValue((int) (hbar.getValue() + HEX_W * scale));
            vbar.setValue((int) (vbar.getValue() - HEX_H * scale));
            break;
        case KeyEvent.VK_NUMPAD1:
            hbar.setValue((int) (hbar.getValue() - HEX_W * scale));
            vbar.setValue((int) (vbar.getValue() + HEX_H * scale));
            break;
        case KeyEvent.VK_NUMPAD2:
        case KeyEvent.VK_DOWN:
            vbar.setValue((int) (vbar.getValue() + HEX_H * scale));
            break;
        case KeyEvent.VK_NUMPAD3:
            hbar.setValue((int) (hbar.getValue() + HEX_W * scale));
            vbar.setValue((int) (vbar.getValue() + HEX_H * scale));
            break;
        case KeyEvent.VK_NUMPAD4:
        case KeyEvent.VK_LEFT:
            hbar.setValue((int) (hbar.getValue() - HEX_W * scale));
            break;
        case KeyEvent.VK_NUMPAD6:
        case KeyEvent.VK_RIGHT:
            hbar.setValue((int) (hbar.getValue() + HEX_W * scale));
            break;
        case KeyEvent.VK_NUMPAD5:
            // center on the selected entity
            if (selectedEntity != null) {
                centerOnHex(selectedEntity.getPosition());
View Full Code Here

            return;
        }

        oldtime = time;

        JScrollBar bar = logSp.getVerticalScrollBar();
        bar.setValue(bar.getMaximum());

        //logSp.paintImmediately(0, 0, logSp.getSize().width,
        //                       logSp.getSize().height);
        /*
        SwingUtilities.invokeLater(new Runnable()
View Full Code Here

    public void ensureLogging()
    {
        if(buffer.equals(""))
        {
            JScrollBar bar;

            if((logSp == null) ||
                   ((bar = logSp.getVerticalScrollBar()) == null) || bar == null ||
                   (bar.getValue() == bar.getMaximum()) ||
                   bar.getValueIsAdjusting())
            {
                return;
            }
            else
            {
                bar.setValue(bar.getMaximum());
                logSp.repaint();

                /*
                logSp.paintImmediately(0, 0, logSp.getSize().width,
                               logSp.getSize().height);
View Full Code Here

                catch(Exception ex)
                {
                    ex.printStackTrace();
                }

                JScrollBar bar = textP.getVerticalScrollBar();
                bar.setValue(bar.getMaximum());

               // text.setCaretPosition(i);
                text.setCaretPosition(text.getText().length());
                //text.getCaret().setDot(1);
            }
View Full Code Here

TOP

Related Classes of javax.swing.JScrollBar$ModelListener

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.