本文整理匯總了Java中javax.swing.JSlider.setFocusable方法的典型用法代碼示例。如果您正苦於以下問題:Java JSlider.setFocusable方法的具體用法?Java JSlider.setFocusable怎麽用?Java JSlider.setFocusable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JSlider
的用法示例。
在下文中一共展示了JSlider.setFocusable方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: buidSlider
import javax.swing.JSlider; //導入方法依賴的package包/類
/**
* Creates the image slider component
*
* @return JComponent
*/
private JComponent buidSlider() {
slider = new JSlider(0, 0);
slider.setPreferredSize(new Dimension(120, 25));
slider.setEnabled(false);
slider.setOpaque(false);
slider.setFocusable(false);
slider.addChangeListener((ChangeEvent e) -> {
if (input != null) {
if (input instanceof MultiFileInput) {
MultiFileInput multi = (MultiFileInput) input;
input = new MultiFileInput(multi.getFiles(), slider.getValue());
fireValueChanged();
}
}
});
return slider;
}
示例2: getAnimationPanel
import javax.swing.JSlider; //導入方法依賴的package包/類
/**
* Returns the frames-per-second slider for the animation dialog.
*/
final JPanel getAnimationPanel() {
// lazily create the label
if (this.animationPanel == null) {
JLabel label = new JLabel("Animation Speed");
label.setAlignmentX(Component.CENTER_ALIGNMENT);
final JSlider slider = new JSlider(SwingConstants.HORIZONTAL, 1, 10, 2) {
@Override
public void updateUI() {
setUI(BasicSliderUI.createUI(this));
}
};
slider.setMajorTickSpacing(9);
slider.setMinorTickSpacing(1);
slider.setSnapToTicks(true);
slider.setPaintTicks(true);
slider.setPaintLabels(true);
slider.setFocusable(false);
slider.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
int speed = slider.getValue();
setSpeed(speed);
}
});
slider.setAlignmentX(Component.CENTER_ALIGNMENT);
this.animationPanel = new JPanel();
this.animationPanel.setLayout(new BoxLayout(this.animationPanel, BoxLayout.Y_AXIS));
this.animationPanel.add(label);
this.animationPanel.add(slider);
}
return this.animationPanel;
}