POLITECHNIKA RZESZOWSKA - Wydział Efektrotechnib i IrfomttyU
I import java.awt.*; import javax.swing. *;
| import java.awt.event.*;
public ciass MouseWheelTest extends JFrame implements
MouseWheelListener (
private JSpinner spinner;
public MouseWheelTest () { I' C?1:1.1. ,-lpl .*1
super("MouseWheelTest"); setSize(220, 110);
spinner = new JSpinner () ; __________
spinner.addMouseWheelLlstener(this); getContentPaneO.add(spinner, BorderLayout.NORTH);
)
public void mouseWheelMoved(MouseWheelEvent e) {
int wheelRotation = e.getWheelEotation(); // krok 1 lub -1 Integer oldValue = (Integer)spinner.getValue(); int newValue = oldValue.intValue() - wheelRotation; spinner.setValue(new Integer(newValue));
public static void main(String[] args) { new MouseWheelTest().setVisible(true);}
TSWWykłjd i
Copyright S> 2012 Jan PROKOP