當前位置: 首頁>>代碼示例>>Java>>正文


Java Scrollbar.addAdjustmentListener方法代碼示例

本文整理匯總了Java中java.awt.Scrollbar.addAdjustmentListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Scrollbar.addAdjustmentListener方法的具體用法?Java Scrollbar.addAdjustmentListener怎麽用?Java Scrollbar.addAdjustmentListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在java.awt.Scrollbar的用法示例。


在下文中一共展示了Scrollbar.addAdjustmentListener方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createSliderPanel

import java.awt.Scrollbar; //導入方法依賴的package包/類
private void createSliderPanel(final Scrollbar sliderField, String label, final Label sliderLabel,
		final double scale)
{
	Label listLabel = new Label(label, 0);
	add(listLabel, 0, 1);
	sliderField.setSize(100, 10);
	c.ipadx = 75;
	add(sliderField, 1, 1);
	c.ipadx = 0;
	sliderField.addAdjustmentListener(new AdjustmentListener()
	{

		public void adjustmentValueChanged(AdjustmentEvent e)
		{
			setSliderLabel(sliderField, sliderLabel, scale);
		}
	});
	add(sliderLabel, 2, 1);
	setSliderLabel(sliderField, sliderLabel, scale);
	row++;
}
 
開發者ID:aherbert,項目名稱:GDSC,代碼行數:22,代碼來源:HSB_Picker.java

示例2: addListenerToSegDisplay

import java.awt.Scrollbar; //導入方法依賴的package包/類
private void addListenerToSegDisplay(){
	
	// ready to use component listener on the slider of impSegmentationDisplay 		
		Component[] components = impSegmentationDisplay.getWindow().getComponents();
	for(Component comp : components){
		if( comp instanceof ScrollbarWithLabel){ 				
			ScrollbarWithLabel scrollBar = (ScrollbarWithLabel) comp;
			Component[] components2 =  scrollBar.getComponents();
			for(Component comp2 : components2){
				if( comp2 instanceof Scrollbar){
					Scrollbar scrollBar2 = (Scrollbar) comp2;
					scrollBar2.addAdjustmentListener( new AdjustmentListener(){
						@Override
						public void adjustmentValueChanged(AdjustmentEvent e) {
							pos[displayOrient] = impSegmentationDisplay.getSlice();
							preview();
						}
					});
				}
			}
		}
	}
 				
	
	
	impListener = new ImageListener(){

		@Override
		public void imageClosed(ImagePlus imp) {
			
			//ImagePlus.removeImageListener(this);
			//if( imp.equals(impSegmentationDisplay)){
			//	impSegmentationDisplay.flush();
			//	impSegmentationDisplay = null;
			//	updateSegmentationDisplay();
			//	render();
			//}
			
		}

		@Override
		public void imageOpened(ImagePlus arg0) {	}

		@Override
		public void imageUpdated(ImagePlus arg0) {
			ImagePlus.removeImageListener(this);

			pos[displayOrient] = impSegmentationDisplay.getSlice();
			if ( pos[displayOrient] != previous.get("pos") )
				preview();
			
			ImagePlus.addImageListener(this);
		}	
	};
	
	ImagePlus.addImageListener(impListener); // not always satisfying  does not always register the action
	
	
	impSegmentationDisplay.getCanvas().addMouseMotionListener( this );
	
	/*
	KeyListener keyListener = new KeyListener(){
		@Override
		public void keyPressed(KeyEvent e) {
			pos[displayOrient] = impSegmentationDisplay.getSlice();
			preview();	
			System.out.println("hello key pressed");
			e.consume();
		}
		@Override
		public void keyTyped(KeyEvent e) { System.out.println("hello key typed");}
		@Override
		public void keyReleased(KeyEvent e) { System.out.println("hello key released");}
	};
	*/
	
	//impSegmentationDisplay.getCanvas().addKeyListener( keyListener );
	//impSegmentationDisplay.getWindow().addKeyListener( keyListener );
			
	
}
 
開發者ID:mpicbg-scicomp,項目名稱:Interactive-H-Watershed,代碼行數:82,代碼來源:Interactive_HWatershed.java

示例3: PDFViewerBuffer

import java.awt.Scrollbar; //導入方法依賴的package包/類
/**
 * It render the section of the manual specified by @marker. 
 * 
 * @param title
 * @param marker
 * @throws IOException
 */
public PDFViewerBuffer(String title, ManualBookmarkers marker)
		throws IOException {
	super(title);

	/**	To avoid out of
	 * memory issue, it uses a buffer to load the pages.	
	 */	
	buffer = new Image[BUFFER_SIZE];
	bufferIndex = new int[BUFFER_SIZE];
	JPanel omni = new JPanel(new BorderLayout());
	canvas = new JPanel();

	loadManual(marker);
	loadPage(0);

	updateCanvas();

	/**	
	 * creation and management scrollbars	
	 */
	bar = new Scrollbar(Scrollbar.VERTICAL, 0, 1, 0, (pageEnd - pageStart)
			* SCROLLBAR_ACCURACY);
	bar.addAdjustmentListener(this);
	JScrollPane scroller = new JScrollPane(canvas);
	scroller.getVerticalScrollBar().setPreferredSize(new Dimension(0, 0));
	scroller.getHorizontalScrollBar().setPreferredSize(new Dimension(0, 0));
	omni.add(scroller, BorderLayout.CENTER);

	omni.add(bar, BorderLayout.WEST);
	omni.add(bar, BorderLayout.EAST);
	setContentPane(omni);

	this.addWindowListener(new CloseHelpFileAdapter());
	this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
	Toolkit tk = Toolkit.getDefaultToolkit();
	setPreferredSize(new Dimension((int) Math.min(imageWidth, tk.getScreenSize().getWidth()),
			(int) Math.min(imageHeight * 1.9, tk.getScreenSize().getHeight())));
	pack();
	setVisible(true);
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:48,代碼來源:PDFViewerBuffer.java

示例4: sliderHorizontal

import java.awt.Scrollbar; //導入方法依賴的package包/類
public static Scrollbar sliderHorizontal(int value, int minScrollWidth, int maxScrollWidth, AdjustmentListener listener) {
    Scrollbar slider = new Scrollbar(Scrollbar.HORIZONTAL, value, 1, minScrollWidth, maxScrollWidth);
    slider.addAdjustmentListener(listener);
    return slider;
}
 
開發者ID:vocobox,項目名稱:vocobox,代碼行數:6,代碼來源:EzLayout.java

示例5: sliderVertical

import java.awt.Scrollbar; //導入方法依賴的package包/類
public static Scrollbar sliderVertical(int value, int minScrollWidth, int maxScrollWidth, AdjustmentListener listener) {
    Scrollbar slider = new Scrollbar(Scrollbar.VERTICAL, value, 1, minScrollWidth, maxScrollWidth);
    slider.addAdjustmentListener(listener);
    return slider;
}
 
開發者ID:vocobox,項目名稱:vocobox,代碼行數:6,代碼來源:EzLayout.java

示例6: makeAdjustPropertiesDialog

import java.awt.Scrollbar; //導入方法依賴的package包/類
protected GenericDialog makeAdjustPropertiesDialog() {
	Rectangle box = getBoundingBox(null);
	GenericDialog gd = new GD("Properties of #" + id, this);
	gd.addStringField("title: ", title);
	gd.addNumericField("x: ", box.x, 2);
	gd.addNumericField("y: ", box.y, 2);
	gd.addNumericField("scale_x: ", 1, 2);
	gd.addNumericField("scale_y: ", 1, 2);
	gd.addNumericField("rot (degrees): ", 0, 2);
	gd.addSlider("alpha: ", 0, 100, (int)(alpha*100));
	gd.addCheckbox("visible", visible);
	gd.addSlider("Red: ", 0, 255, color.getRed());
	gd.addSlider("Green: ", 0, 255, color.getGreen());
	gd.addSlider("Blue: ", 0, 255, color.getBlue());
	gd.addCheckbox("locked", locked);
	// add slider listener
	final Scrollbar alp = (Scrollbar)gd.getSliders().get(0);
	final Scrollbar red = (Scrollbar)gd.getSliders().get(1);
	final Scrollbar green = (Scrollbar)gd.getSliders().get(2);
	final Scrollbar blue = (Scrollbar)gd.getSliders().get(3);
	final TextField talp = (TextField)gd.getNumericFields().get(5);
	final TextField tred = (TextField)gd.getNumericFields().get(6);
	final TextField tgreen = (TextField)gd.getNumericFields().get(7);
	final TextField tblue = (TextField)gd.getNumericFields().get(8);
	SliderListener sla = new SliderListener() {
		public void update() {
			setAlpha((float)alp.getValue()/100);
		}
	};
	SliderListener slc = new SliderListener() {
		public void update() {
			setColor(new Color(red.getValue(), green.getValue(), blue.getValue()));
		}
	};
	alp.addAdjustmentListener(sla);
	red.addAdjustmentListener(slc);
	green.addAdjustmentListener(slc);
	blue.addAdjustmentListener(slc);
	talp.addTextListener(sla);
	tred.addTextListener(slc);
	tgreen.addTextListener(slc);
	tblue.addTextListener(slc);
	
	gd.addChoice( "composite mode: ", compositeModes, compositeModes[ compositeMode ] );
	return gd;
}
 
開發者ID:trakem2,項目名稱:TrakEM2,代碼行數:47,代碼來源:Displayable.java


注:本文中的java.awt.Scrollbar.addAdjustmentListener方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。