本文整理汇总了Java中javax.swing.JSlider.setPreferredSize方法的典型用法代码示例。如果您正苦于以下问题:Java JSlider.setPreferredSize方法的具体用法?Java JSlider.setPreferredSize怎么用?Java JSlider.setPreferredSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSlider
的用法示例。
在下文中一共展示了JSlider.setPreferredSize方法的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: createFilterPanel
import javax.swing.JSlider; //导入方法依赖的package包/类
/**
* @return
*/
private Component createFilterPanel() {
JPanel jp = new MyJPanel("Filter nodes", Color.RED);
jp.add(new JLabel("Betweenness:"));
mNodeAcceptBetweennessSlider = new JSlider(JSlider.HORIZONTAL);
mNodeAcceptBetweennessSlider.setPreferredSize(new Dimension(180, 40));
mNodeAcceptBetweennessSlider.setValue(0);
mNodeAcceptBetweennessSlider.setPaintTicks(true);
mNodeAcceptBetweennessSlider.setBackground(Color.WHITE);
jp.add(mNodeAcceptBetweennessSlider);
return jp;
}
示例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;
}