当前位置: 首页>>代码示例>>Java>>正文


Java AdjustmentListener类代码示例

本文整理汇总了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;
}
 
开发者ID:TeamRedFox,项目名称:PointOfSale,代码行数:20,代码来源:Cart.java

示例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;
}
 
开发者ID:girtel,项目名称:Net2Plan,代码行数:21,代码来源:JScrollPopupMenu.java

示例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);
				}
			}
		}
	};
}
 
开发者ID:valsr,项目名称:SweetHome3D,代码行数:27,代码来源:SwingTools.java

示例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;
}
 
开发者ID:P15,项目名称:jailer,代码行数:17,代码来源:JScrollC2PopupMenu.java

示例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);
}
 
开发者ID:meteoinfo,项目名称:MeteoInfoLib,代码行数:18,代码来源:SymbolControl.java

示例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;
}
 
开发者ID:friedlwo,项目名称:AppWoksUtils,代码行数:17,代码来源:JScrollPopupMenu.java

示例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());
	        	}
	        }
	    }); 
	}
 
开发者ID:ScreenBasedSimulator,项目名称:ScreenBasedSimulator,代码行数:19,代码来源:PathographyPanel.java

示例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;
}
 
开发者ID:spdx,项目名称:ATTIC-osit,代码行数:25,代码来源:JPanCMCodeView.java

示例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);
}
 
开发者ID:RUB-NDS,项目名称:WS-Attacker,代码行数:26,代码来源:AttackOverview_NB.java

示例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);
}
 
开发者ID:Impro-Visor,项目名称:Impro-Visor,代码行数:23,代码来源:ClimaticPopInitialiser.java

示例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();
            }
        }
    });
}
 
开发者ID:barnex,项目名称:amumag,代码行数:17,代码来源:AmuView.java

示例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);
	}
}
 
开发者ID:imglib,项目名称:imglib2-tests,代码行数:23,代码来源:ImgPanel.java

示例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);

        }
 
开发者ID:magarena,项目名称:magarena,代码行数:22,代码来源:LogViewer.java

示例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;
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ChangesFragmentedDiffPanel.java

示例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));
}
 
开发者ID:VDuda,项目名称:SyncRunner-Pub,代码行数:24,代码来源:ComponentLineNumberTable.java


注:本文中的java.awt.event.AdjustmentListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。