本文整理汇总了Java中javax.swing.JSlider.setBackground方法的典型用法代码示例。如果您正苦于以下问题:Java JSlider.setBackground方法的具体用法?Java JSlider.setBackground怎么用?Java JSlider.setBackground使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSlider
的用法示例。
在下文中一共展示了JSlider.setBackground方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}