當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。