本文整理汇总了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);
}