本文整理汇总了Java中java.awt.event.AdjustmentListener类的典型用法代码示例。如果您正苦于以下问题:Java AdjustmentListener类的具体用法?Java AdjustmentListener怎么用?Java AdjustmentListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AdjustmentListener类属于java.awt.event包,在下文中一共展示了AdjustmentListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateScrollPane
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public JScrollPane generateScrollPane()
{
JScrollPane newScroll = new JScrollPane();
JList list = new JList(listModel);
list.setFont( new Font("monospaced", Font.PLAIN, 12) );
newScroll.setViewportView(list);
Dimension listSize = new Dimension(400, 150);
newScroll.setSize(listSize);
newScroll.setMaximumSize(listSize);
newScroll.setPreferredSize(listSize);
newScroll.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
e.getAdjustable().setValue(e.getAdjustable().getMaximum());
}
});
return newScroll;
}
示例2: getScrollBar
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
private JScrollBar getScrollBar()
{
if (popupScrollBar == null)
{
popupScrollBar = new JScrollBar(JScrollBar.VERTICAL);
popupScrollBar.addAdjustmentListener(new AdjustmentListener()
{
@Override
public void adjustmentValueChanged(AdjustmentEvent e)
{
doLayout();
repaint();
}
});
popupScrollBar.setVisible(false);
}
return popupScrollBar;
}
示例3: createAdjustmentListenerUpdatingScrollPaneViewToolTip
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
/**
* Returns a scroll bar adjustment listener bound to the given <code>scrollPane</code> view
* that updates view tool tip when its vertical scroll bar is adjusted.
*/
public static AdjustmentListener createAdjustmentListenerUpdatingScrollPaneViewToolTip(final JScrollPane scrollPane)
{
return new AdjustmentListener()
{
public void adjustmentValueChanged(AdjustmentEvent ev)
{
Point screenLocation = MouseInfo.getPointerInfo().getLocation();
Point point = new Point(screenLocation);
Component view = scrollPane.getViewport().getView();
SwingUtilities.convertPointFromScreen(point, view);
if (scrollPane.isShowing() && scrollPane.getViewport().getViewRect().contains(point))
{
MouseEvent mouseEvent = new MouseEvent(view, MouseEvent.MOUSE_MOVED, System.currentTimeMillis(), 0,
point.x, point.y, 0, false, MouseEvent.NOBUTTON);
if (isToolTipShowing())
{
ToolTipManager.sharedInstance().mouseMoved(mouseEvent);
}
}
}
};
}
示例4: getScrollBar
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
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(false);
}
return popupScrollBar;
}
示例5: initComponents
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
private void initComponents() {
this.setPreferredSize(new Dimension(200, 100));
this.setLayout(new BorderLayout());
this.setBackground(Color.white);
_vScrollBar = new JScrollBar(JScrollBar.VERTICAL);
_vScrollBar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
onScrollValueChanged(e);
}
});
this.add(_vScrollBar, BorderLayout.EAST);
//this._vScrollBar.setSize(this._vScrollBar.getWidth(), this.getHeight());
this._vScrollBar.setSize(20, this.getHeight());
this._vScrollBar.setLocation(this.getWidth() - this._vScrollBar.getWidth(), 0);
}
示例6: getScrollBar
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
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(false);
}
return popupScrollBar;
}
示例7: PathographyPanel
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public PathographyPanel() {
model = new DefaultListModel<String>();
list = new JList<String>(model);
this.setViewportView(list);
this.setAutoscrolls(true);
this.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
if(needScroll) {
e.getAdjustable().setValue(e.getAdjustable().getMaximum());
needScroll = false;
} else {
e.getAdjustable().setValue(e.getAdjustable().getValue());
}
}
});
}
示例8: getJScrollPane
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public JScrollPane getJScrollPane() {
if (jScrollPane == null) {
jScrollPane = new JScrollPane();
JPanel LeftSourceCodePanel = new JPanel();
LeftSourceCodePanel.setLayout(new BorderLayout());
LeftSourceCodePanel.add(getJTextPaneLineNumber(), BorderLayout.WEST);
LeftSourceCodePanel.add(getJTextPaneSourceView(), BorderLayout.CENTER);
jScrollPane.setViewportView(LeftSourceCodePanel);
jScrollPane.getVerticalScrollBar().setUnitIncrement(ConstantValue.CODE_SCROLL_SIZE);
jScrollPane.getVerticalScrollBar().addAdjustmentListener(
new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
if(siblingSourceView != null) {
siblingSourceView.changeScrollBar(changeLine());
}
}
}
);
}
return jScrollPane;
}
示例9: addAdjustmenListenerToResultsScrollbar
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
private void addAdjustmenListenerToResultsScrollbar()
{
resultTableScrollPane.getVerticalScrollBar().addAdjustmentListener( new AdjustmentListener()
{
@Override
public void adjustmentValueChanged( AdjustmentEvent e )
{
if ( e.getValueIsAdjusting() )
{
// The user is dragging the knob
return;
}
JScrollBar bar = resultTableScrollPane.getVerticalScrollBar();
int max = bar.getMaximum();
int current = bar.getValue();
final int THRESHOLD = bar.getVisibleAmount() * 2;
if ( current > ( max - THRESHOLD ) )
{
e.getAdjustable().setValue( max );
}
}
} );
// resultTableScrollPane.setAutoscrolls(true);
}
示例10: ClimaticPopInitialiser
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public ClimaticPopInitialiser(int population) {
populationSize = population;
panel = new Panel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
populationLabel = new Label(Integer.toString(populationSize));
panel.add(new Label("Population Size", Label.RIGHT));
panel.add(new Scrollbar(Scrollbar.HORIZONTAL, populationSize, 1,
MIN_POPULATION_SIZE, MAX_POPULATION_SIZE) {
{
addAdjustmentListener(new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent evt) {
populationSize = getValue();
populationLabel.setText(Integer.toString(getValue()));
populationLabel.repaint();
}
}
);
}
}
);
panel.add(populationLabel);
}
示例11: initScroller
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
protected void initScroller() {
scroller = new JScrollBar(JScrollBar.VERTICAL);
scroller.setMinimum(0);
scroller.setVisibleAmount(1);
scroller.setMaximum(1);
scroller.addAdjustmentListener(new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent e) {
try {
time(scroller.getValue());
} catch (IOException ex) {
ex.printStackTrace();
}
}
});
}
示例12: SliderPanel
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public SliderPanel(final ImgData<?> imgData) {
setBorder(new TitledBorder(imgData.name));
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
// add one slider per dimension beyond the first two
for (int d = 2; d < imgData.imgPlus.numDimensions(); d++) {
final int dimLength = (int) imgData.imgPlus.dimension(d);
final JScrollBar bar =
new JScrollBar(Adjustable.HORIZONTAL, 0, 1, 0, dimLength);
final int dim = d;
bar.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(final AdjustmentEvent e) {
final int value = bar.getValue();
imgData.projector.setPosition(value, dim);
imgData.projector.map();
imgData.owner.repaint();
}
});
add(bar);
}
}
示例13: LogScrollPane
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public LogScrollPane(Component aView) {
super(aView);
final JScrollBar vscroll = getVerticalScrollBar();
vscroll.setUnitIncrement(INCREMENT);
vscroll.setBlockIncrement(INCREMENT);
vscroll.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
e.getAdjustable().setValue(e.getAdjustable().getMaximum());
}
});
setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
setBorder(BorderFactory.createEmptyBorder());
getViewport().setOpaque(false);
}
示例14: afterPanelsAdded
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public void afterPanelsAdded() {
myLeftScroll.setMinimum(0);
myLeftScroll.setMaximum(myMaxColumnsLeft);
myLeftScroll.addAdjustmentListener(new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
myInScrolling = true;
final int scrollPosCorrected = myLeftScroll.getValue() + 1;
if (myByLeft) {
scrollMain(myLeftScroll.getValue(), myLeftModels);
scrollOther(scrollPosCorrected, myMaxColumnsLeft, myMaxColumnsRight, myRightModels);
} else {
scrollMain(myLeftScroll.getValue(), myRightModels);
scrollOther(scrollPosCorrected, myMaxColumnsRight, myMaxColumnsLeft, myLeftModels);
}
myInScrolling = false;
}
});
}
示例15: ComponentLineNumberTable
import java.awt.event.AdjustmentListener; //导入依赖的package包/类
public ComponentLineNumberTable(JScrollPane jScrollPane, JTable table) {
this.scrollPane = jScrollPane;
this.table = table;
this.table.getModel().addTableModelListener(new TableModelListener() {
public void tableChanged(TableModelEvent tme) {
ComponentLineNumberTable.this.repaint();
}
});
this.table.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent lse) {
ComponentLineNumberTable.this.repaint();
}
});
this.scrollPane.getVerticalScrollBar().addAdjustmentListener(new AdjustmentListener() {
public void adjustmentValueChanged(AdjustmentEvent ae) {
ComponentLineNumberTable.this.repaint();
}
});
setPreferredSize(new Dimension(26, 50));
}