Package javax.swing

Examples of javax.swing.JScrollBar


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

                JScrollBar bar = textP.getVerticalScrollBar();
                bar.setValue(bar.getMaximum());
            }
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
View Full Code Here


    this.setLayout(new BorderLayout());
    this.list.setCellRenderer(this.renderer);
    this.list.setTransferHandler(new BytecodeEditorTransferHandler(this));
    this.add(this.label, BorderLayout.NORTH);
    this.add(this.editorScrollPane, BorderLayout.CENTER);
    this.editorScrollPane.setVerticalScrollBar(new JScrollBar() {
      final AlphaComposite SEMI_OPAQUE = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.3f);
          @Override
          public void paint(Graphics g) {
            g.setPaintMode();
            super.paint(g);
View Full Code Here

        uninstallComponents();
        uninstallKeyboardActions();
    }

    public void layoutContainer(final Container c) {
        JScrollBar bar = ((JScrollBar)c);
        BoundedRangeModel model = bar.getModel();
        orientationStrategy.layoutScrollBar(bar);
        orientationStrategy.calculateTrackBounds(model);
        orientationStrategy.calculateThumbBounds(model);
    }
View Full Code Here

    blink = true;

    // Initialize the GUI
    setLayout(new ScrollLayout());
    add(CENTER,painter);
    add(RIGHT,vertical = new JScrollBar(JScrollBar.VERTICAL));
    add(BOTTOM,horizontal = new JScrollBar(JScrollBar.HORIZONTAL));

    // Add some event listeners
    vertical.addAdjustmentListener(new AdjustHandler());
    horizontal.addAdjustmentListener(new AdjustHandler());
    painter.addComponentListener(new ComponentHandler());
View Full Code Here

        this.setMinimumSize(this.getMaximumSize());
        this.setResizable(false);
       
        c.setCursor(new Cursor(Cursor.HAND_CURSOR));
       
        this.sb = new JScrollBar(JScrollBar.HORIZONTAL,
                                 0,
                                 0,
                                 0,
                                 50);
        c.add(sb);
View Full Code Here

            Integer rowNum = new Integer(tcModel.getRowCount());
            testCases.put(tr, rowNum);
            long currentScrollBarMax = 0;

            JScrollPane scrollPane = (JScrollPane) tcTable.getParent().getParent();
            JScrollBar scrollbar = scrollPane.getVerticalScrollBar();
            if (scrollbar != null) {
                if (scrollbar.getMouseListeners().length == 1) {
                    scrollPane.addMouseWheelListener(new MouseWheelListener() {

                        public void mouseWheelMoved(MouseWheelEvent e) {
                            userScrollPosition = true;
                        }
                    });
                    scrollbar.addMouseListener(new MouseAdapter() {

                        @Override
                        public void mouseClicked(MouseEvent e) {
                            userScrollPosition = true;
                        }

                        @Override
                        public void mousePressed(MouseEvent e) {
                            userScrollPosition = true;
                        }
                    });
                }
                currentScrollBarMax = scrollbar.getMaximum() - scrollbar.getSize().height - tcTable.getRowHeight();
                tcModel.addRow(cols);
                if (!userScrollPosition) {
                    tcTable.scrollRectToVisible(tcTable.getCellRect(tcModel.getRowCount() - 1, 0, true));
                    return;
                } else if (scrollbar.getValue() >= currentScrollBarMax) {
                    tcTable.scrollRectToVisible(tcTable.getCellRect(tcModel.getRowCount() - 1, 0, true));
                    userScrollPosition = false;
                    return;
                } else {
                    System.out.println("Scrollbar pos=" + scrollbar.getValue() + "; max=" + currentScrollBarMax + "height=" + scrollbar.getSize().height);
                }
            } else {
                tcModel.addRow(cols);
            }
        } else {
View Full Code Here

        long currentScrollBarMax = 0;
        //int lastRow = m_LogModel.getRowCount();
        // check if the user has change the scrolling position
        JScrollPane scrollPane = (JScrollPane) m_LogTable.getParent().getParent();
        JScrollBar scrollbar = scrollPane.getVerticalScrollBar();
        if (scrollbar != null) {
            if (scrollbar.getMouseListeners().length == 1) {
                scrollPane.addMouseWheelListener(new MouseWheelListener() {

                    public void mouseWheelMoved(MouseWheelEvent e) {
                        m_UserScrollPosition = true;
                    }
                });
                scrollbar.addMouseListener(new MouseAdapter() {

                    @Override
                    public void mouseClicked(MouseEvent e) {
                        m_UserScrollPosition = true;
                    }

                    @Override
                    public void mousePressed(MouseEvent e) {
                        m_UserScrollPosition = true;
                    }
                });
            }
            currentScrollBarMax = scrollbar.getMaximum() - scrollbar.getSize().height - m_LogTable.getRowHeight();
            m_LogModel.addRow(cols);
            // check if the first row must be remove (memory handling issue)
            if (m_LogModel.getRowCount() > MAX_ROWS) {
                boolean wasFirstRowVisible = m_LogSorterTable.convertRowIndexToView(0) != -1;
                m_LogModel.removeRow(0);
                if (wasFirstRowVisible && m_UserScrollPosition) {
                    Rectangle visibleRect = m_LogTable.getVisibleRect();
                    if (!visibleRect.contains(0, 0)) {
                        visibleRect.y -= m_LogTable.getScrollableUnitIncrement(visibleRect, SwingConstants.VERTICAL, -1);
                        m_LogTable.scrollRectToVisible(visibleRect);
                    }
                }
            }
            if (!m_UserScrollPosition) {
                m_LogTable.scrollRectToVisible(
                        m_LogTable.getCellRect(m_LogTable.getRowCount() - 1, 0, true));
                return;
            } else if (scrollbar.getValue() >= currentScrollBarMax) {
                m_LogTable.scrollRectToVisible(
                        m_LogTable.getCellRect(m_LogTable.getRowCount() - 1, 0, true));
                m_UserScrollPosition = false;
                return;
            }
View Full Code Here

        super();
        this.canvas = canvas;
        canvas.setRecenterOnResize(false);

        // create components
        vertical = new JScrollBar(JScrollBar.VERTICAL, 0, 0, 0, 0);
        horizontal = new JScrollBar(JScrollBar.HORIZONTAL, 0, 0, 0, 0);
   
        // create a spacer next to the horizontal bar
        horizontalPanel = new JPanel(new BorderLayout());
        horizontalPanel.add(horizontal, BorderLayout.CENTER);
        cornerBox = Box.createRigidArea
View Full Code Here

        hsbPropertyChangeListener = createHSBPropertyChangeListener();
        viewportChangeListener = createViewportChangeListener();
        spPropertyChangeListener = createPropertyChangeListener();

        JViewport viewport = scrollpane.getViewport();
        JScrollBar vsb = scrollpane.getVerticalScrollBar();
        JScrollBar hsb = scrollpane.getHorizontalScrollBar();

        if (viewport != null) {
            viewport.addChangeListener(viewportChangeListener);
        }
        if (vsb != null) {
            vsb.getModel().addChangeListener(vsbChangeListener);
            vsb.addPropertyChangeListener(vsbPropertyChangeListener);
        }
        if (hsb != null) {
            hsb.getModel().addChangeListener(hsbChangeListener);
            hsb.addPropertyChangeListener(hsbPropertyChangeListener);
        }

        scrollpane.addPropertyChangeListener(spPropertyChangeListener);

        mouseScrollListener = createMouseWheelListener();
View Full Code Here

        }
    }

    protected void uninstallListeners(JComponent c) {
        JViewport viewport = scrollpane.getViewport();
        JScrollBar vsb = scrollpane.getVerticalScrollBar();
        JScrollBar hsb = scrollpane.getHorizontalScrollBar();

        if (viewport != null) {
            viewport.removeChangeListener(viewportChangeListener);
        }
        if (vsb != null) {
            vsb.getModel().removeChangeListener(vsbChangeListener);
            vsb.removePropertyChangeListener(vsbPropertyChangeListener);
        }
        if (hsb != null) {
            hsb.getModel().removeChangeListener(hsbChangeListener);
            hsb.removePropertyChangeListener(hsbPropertyChangeListener);
        }

        scrollpane.removePropertyChangeListener(spPropertyChangeListener);

        if (mouseScrollListener != null) {
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.