Search in sources :

Example 6 with AdjustmentEvent

use of java.awt.event.AdjustmentEvent in project jdk8u_jdk by JetBrains.

the class ScrollPaneAdjustable method setValueIsAdjusting.

/**
     * Sets the <code>valueIsAdjusting</code> property.
     *
     * @param b new adjustment-in-progress status
     * @see #getValueIsAdjusting
     * @since 1.4
     */
public void setValueIsAdjusting(boolean b) {
    if (isAdjusting != b) {
        isAdjusting = b;
        AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, AdjustmentEvent.TRACK, value, b);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
Also used : AdjustmentEvent(java.awt.event.AdjustmentEvent)

Example 7 with AdjustmentEvent

use of java.awt.event.AdjustmentEvent in project jdk8u_jdk by JetBrains.

the class ScrollPaneAdjustable method setTypedValue.

/**
     * Sets the value of this scrollbar to the specified value.
     * <p>
     * If the value supplied is less than the current minimum or
     * greater than the current maximum, then one of those values is
     * substituted, as appropriate. Also, creates and dispatches
     * the AdjustementEvent with specified type and value.
     *
     * @param v the new value of the scrollbar
     * @param type the type of the scrolling operation occurred
     */
private void setTypedValue(int v, int type) {
    v = Math.max(v, minimum);
    v = Math.min(v, maximum - visibleAmount);
    if (v != value) {
        value = v;
        // Synchronously notify the listeners so that they are
        // guaranteed to be up-to-date with the Adjustable before
        // it is mutated again.
        AdjustmentEvent e = new AdjustmentEvent(this, AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, type, value, isAdjusting);
        adjustmentListener.adjustmentValueChanged(e);
    }
}
Also used : AdjustmentEvent(java.awt.event.AdjustmentEvent)

Example 8 with AdjustmentEvent

use of java.awt.event.AdjustmentEvent in project OsmAnd-tools by osmandapp.

the class JScrollPopupMenu method getScrollBar.

protected JScrollBar getScrollBar() {
    if (popupScrollBar == null) {
        popupScrollBar = new JScrollBar(JScrollBar.VERTICAL);
        popupScrollBar.addAdjustmentListener(new AdjustmentListener() {

            @Override
            public void adjustmentValueChanged(AdjustmentEvent e) {
                doLayout();
                repaint();
            }
        });
        popupScrollBar.setVisible(true);
    }
    return popupScrollBar;
}
Also used : AdjustmentEvent(java.awt.event.AdjustmentEvent) AdjustmentListener(java.awt.event.AdjustmentListener) JScrollBar(javax.swing.JScrollBar)

Example 9 with AdjustmentEvent

use of java.awt.event.AdjustmentEvent in project artisynth_core by artisynth.

the class TimelineController method displaySetup.

private void displaySetup() {
    timescale.addChangeListener(new ChangeListener() {

        public void stateChanged(ChangeEvent e) {
            double cursorTime = timescale.getTimescaleCursorTime();
            // adjusted manually, then the restart time must be changed
            if (!myScheduler.isPlaying() && timescale.isTimeManuallyDragged()) {
                // be reset to any time corresponding to the timeline cursor
                if (!myMain.getWorkspace().rootModelHasState()) {
                    myScheduler.setTime(cursorTime);
                } else // Else only reset the scheduler time to the closest valid
                // waypoint when the cursor is dragged past a valid waypoint
                {
                    setRestartTime(TimelineConstants.RESTART_BY_CURSOR_DRAG);
                }
            }
            // See if the duration of the timeline has to be extended
            if (cursorTime >= 0.9 * timescale.getMaximumTime()) {
                extendTimeline();
            }
            if (timescale.isTimeManuallyDragged()) {
                requestUpdateWidgets();
            }
        }
    });
    timelineScrollPane.getHorizontalScrollBar().addAdjustmentListener(new AdjustmentListener() {

        public void adjustmentValueChanged(AdjustmentEvent e) {
            requestUpdateDisplay();
        }
    });
    timelineScrollPane.setViewportView(timelinePane);
    JScrollPane workspaceScrollPane = new JScrollPane(workspacePane);
    timelineScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS);
    // Set the workspace scrollpane not to show vertical scroll bar
    workspaceScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
    workspaceScrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    // Synchronize scrollbars of workspace and timeline panels
    timelineScrollPane.getVerticalScrollBar().setModel(workspaceScrollPane.getVerticalScrollBar().getModel());
    mainSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, workspaceScrollPane, timelineScrollPane);
    mainSplitPane.setDividerLocation(GuiStorage.TIMELINE_PANEL_WIDTH);
    mainSplitPane.setDividerSize(SPLIT_DIVIDER_SIZE);
    mainSplitPane.setContinuousLayout(true);
    mainSplitPane.addPropertyChangeListener("dividerLocation", new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent pc_evt) {
            updateComponentSizes();
        }
    });
    Container contentPane = getContentPane();
    contentPane.add(myToolBar, BorderLayout.PAGE_START);
    contentPane.add(mainSplitPane);
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    setLocation(screenSize.width / 6, screenSize.height / 6);
    setSize(screenSize.width * 1 / 2, screenSize.height * 1 / 4);
    updateComponentSizes();
}
Also used : JScrollPane(javax.swing.JScrollPane) PropertyChangeEvent(java.beans.PropertyChangeEvent) Container(java.awt.Container) ValueChangeEvent(maspack.widgets.ValueChangeEvent) ChangeEvent(javax.swing.event.ChangeEvent) PropertyChangeEvent(java.beans.PropertyChangeEvent) PropertyChangeListener(java.beans.PropertyChangeListener) AdjustmentEvent(java.awt.event.AdjustmentEvent) AdjustmentListener(java.awt.event.AdjustmentListener) ChangeListener(javax.swing.event.ChangeListener) PropertyChangeListener(java.beans.PropertyChangeListener) Dimension(java.awt.Dimension) JSplitPane(javax.swing.JSplitPane)

Example 10 with AdjustmentEvent

use of java.awt.event.AdjustmentEvent in project cytoscape-impl by cytoscape.

the class PreviewTablePanel method getTableScrollPane.

private JScrollPane getTableScrollPane() {
    if (tableScrollPane == null) {
        tableScrollPane = new JScrollPane(getPreviewTable());
        tableScrollPane.getHorizontalScrollBar().addAdjustmentListener(new AdjustmentListener() {

            @Override
            public void adjustmentValueChanged(AdjustmentEvent e) {
                // Realign the Attribute Editor Dialog if it is open
                if (!e.getValueIsAdjusting())
                    positionEditDialog();
            }
        });
    }
    return tableScrollPane;
}
Also used : JScrollPane(javax.swing.JScrollPane) AdjustmentEvent(java.awt.event.AdjustmentEvent) AdjustmentListener(java.awt.event.AdjustmentListener)

Aggregations

AdjustmentEvent (java.awt.event.AdjustmentEvent)12 AdjustmentListener (java.awt.event.AdjustmentListener)9 JScrollBar (javax.swing.JScrollBar)3 BorderLayout (java.awt.BorderLayout)2 JPanel (javax.swing.JPanel)2 JScrollPane (javax.swing.JScrollPane)2 ActionEvent (com.codename1.ui.events.ActionEvent)1 Content (ij3d.Content)1 UniverseListener (ij3d.UniverseListener)1 IntegerField (ini.trakem2.utils.IntegerField)1 Container (java.awt.Container)1 Dimension (java.awt.Dimension)1 GridBagConstraints (java.awt.GridBagConstraints)1 GridBagLayout (java.awt.GridBagLayout)1 Insets (java.awt.Insets)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 PropertyChangeEvent (java.beans.PropertyChangeEvent)1 PropertyChangeListener (java.beans.PropertyChangeListener)1 WeakReference (java.lang.ref.WeakReference)1