本文整理匯總了Java中javax.swing.JSlider.addMouseListener方法的典型用法代碼示例。如果您正苦於以下問題:Java JSlider.addMouseListener方法的具體用法?Java JSlider.addMouseListener怎麽用?Java JSlider.addMouseListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JSlider
的用法示例。
在下文中一共展示了JSlider.addMouseListener方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: installListeners
import javax.swing.JSlider; //導入方法依賴的package包/類
@Override
protected void installListeners(JSlider slider) {
super.installListeners(slider);
if ((this.thumbPressedListener = createThumbPressedListener()) != null) {
slider.addMouseListener(this.thumbPressedListener);
}
}
示例2: installListeners
import javax.swing.JSlider; //導入方法依賴的package包/類
protected void installListeners(JSlider slider) {
slider.addMouseListener(mThumbTrackListener);
slider.addMouseMotionListener(mThumbTrackListener);
slider.addFocusListener(focusListener);
slider.addComponentListener(componentListener);
slider.addPropertyChangeListener(propertyChangeListener);
slider.getModel().addChangeListener(changeListener);
}
示例3: createAnimationControls
import javax.swing.JSlider; //導入方法依賴的package包/類
private void createAnimationControls() {
Font sliderFont = new Font("Arial", Font.PLAIN, 12);
animationControls = new JPanel();
animationControls.setLayout(new BoxLayout(animationControls,
BoxLayout.PAGE_AXIS));
JLabel manualLabel = new JLabel("Frame #");
manualLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
manualSlider = new JSlider(JSlider.HORIZONTAL);
manualSlider.setPaintTicks(true);
manualSlider.setPaintLabels(true);
manualSlider.setFont(sliderFont);
manualSlider.addChangeListener(manualSliderListener);
manualSlider.addMouseListener(manualSliderClickListener);
manualSlider.setMinorTickSpacing(1);
manualSlider.addComponentListener(resizeListener);
JLabel framerateLabel = new JLabel("Framerate");
framerateLabel.setAlignmentX(Component.CENTER_ALIGNMENT);
framerateSlider = new JSlider(JSlider.HORIZONTAL, FRAMERATE_MIN,
FRAMERATE_MAX, FRAMERATE_INIT);
framerateSlider.setMajorTickSpacing(10);
framerateSlider.setMinorTickSpacing(1);
framerateSlider.setPaintTicks(true);
framerateSlider.setPaintLabels(true);
framerateSlider.setLabelTable(framerateSlider.createStandardLabels(10,
10));
framerateSlider.setFont(sliderFont);
framerateSlider.addChangeListener(framerateListener);
JPanel frameratePanel = new JPanel();
frameratePanel.setLayout(new BoxLayout(frameratePanel,
BoxLayout.PAGE_AXIS));
frameratePanel.add(framerateLabel);
frameratePanel.add(Box.createRigidArea(new Dimension(0, 2)));
frameratePanel.add(framerateSlider);
playPauseButton = new JButton(playIcon);
playPauseButton.addActionListener(playPauseListener);
stopButton = new JButton(stopIcon);
stopButton.addActionListener(stopListener);
animationControls.add(new JSeparator(JSeparator.HORIZONTAL));
animationControls.add(Box.createRigidArea(new Dimension(0, 2)));
animationControls.add(manualLabel);
animationControls.add(Box.createRigidArea(new Dimension(0, 2)));
animationControls.add(manualSlider);
animationControls.add(Box.createRigidArea(new Dimension(0, 5)));
JPanel p2 = new JPanel();
p2.setLayout(new BoxLayout(p2, BoxLayout.LINE_AXIS));
p2.add(playPauseButton);
p2.add(Box.createRigidArea(new Dimension(10, 0)));
p2.add(stopButton);
p2.add(frameratePanel);
animationControls.add(p2);
animationControls.setVisible(false);
animationControls.setBorder(BorderFactory.createEmptyBorder(0, 10, 5,
10));
container.add(animationControls, BorderLayout.SOUTH);
}