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);
}
}
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);
}
}
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;
}
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();
}
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;
}
Aggregations