本文整理汇总了Java中javax.swing.JSlider.setEnabled方法的典型用法代码示例。如果您正苦于以下问题:Java JSlider.setEnabled方法的具体用法?Java JSlider.setEnabled怎么用?Java JSlider.setEnabled使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSlider
的用法示例。
在下文中一共展示了JSlider.setEnabled方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Slider
import javax.swing.JSlider; //导入方法依赖的package包/类
/**
* @param prefix the text of the Label
* @param sufix thge text of the Label
* @param minvalue start vlaue
* @param maxvalue last value
* @param startvalue inital value
* @param komma 10^x offset for komma digits
*/
public Slider(String prefix, String sufix, int minvalue, int maxvalue, int startvalue, int komma, @Nullable ChangeListener cl,@Nullable Updater upd, boolean enabled) {//ChangeListener or Updater could be Null!
slider = new JSlider(minvalue, maxvalue, startvalue);
slider.addChangeListener(this);
if(prefix != null)
this.prefix = prefix;
if(sufix != null) {
this.sufix = sufix;
}
offset = komma;
label = new JLabel(getLabelText());
add(slider);
add(label);
listener = cl;
updater = upd;
slider.setEnabled(enabled);
defaultvalue = startvalue;
}
示例3: createSizePanel
import javax.swing.JSlider; //导入方法依赖的package包/类
/**
* @return
*/
private Component createSizePanel() {
final ButtonGroup buttons = new ButtonGroup();
JPanel jp = new MyJPanel("Node Size", Color.RED);
mNodeSizeDegreeSlider = new JSlider(JSlider.HORIZONTAL);
mNodeSizeDegreeSlider.setPreferredSize(new Dimension(180, 40));
mNodeSizeDegreeSlider.setPaintTicks(true);
mNodeSizeDegreeSlider.setBackground(Color.WHITE);
mNodeSizeDegreeSlider.setValue(0);
final JRadioButton degree = new JRadioButton("Degree");
degree.setBackground(Color.WHITE);
degree.setSelected(true);
buttons.add(degree);
jp.add( degree );
jp.add(mNodeSizeDegreeSlider);
mNodeSizePageRankSlider = new JSlider(JSlider.HORIZONTAL);
mNodeSizePageRankSlider.setPreferredSize(new Dimension(180, 40));
mNodeSizePageRankSlider.setPaintTicks(true);
mNodeSizePageRankSlider.setBackground(Color.WHITE);
mNodeSizePageRankSlider.setEnabled( false );
final JRadioButton rank = new JRadioButton("PageRank with Prior");
rank.setBackground(Color.WHITE);
buttons.add(rank);
jp.add( rank );
jp.add( mNodeSizePageRankSlider);
ActionListener al = new ActionListener() {
public void actionPerformed(ActionEvent e) {
if( e.getSource() == rank) {
mNodeSizePageRankSlider.setEnabled(true);
mNodeSizeDegreeSlider.setEnabled(false);
}
if ( e.getSource() == degree) {
mNodeSizePageRankSlider.setEnabled(false);
mNodeSizeDegreeSlider.setEnabled(true);
}
}
};
degree.addActionListener(al);
rank.addActionListener(al);
return jp;
}