本文整理汇总了Java中javax.swing.JToggleButton.setSelectedIcon方法的典型用法代码示例。如果您正苦于以下问题:Java JToggleButton.setSelectedIcon方法的具体用法?Java JToggleButton.setSelectedIcon怎么用?Java JToggleButton.setSelectedIcon使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JToggleButton
的用法示例。
在下文中一共展示了JToggleButton.setSelectedIcon方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initToggle
import javax.swing.JToggleButton; //导入方法依赖的package包/类
void initToggle() {
shapeToggle = new JToggleButton(Icons.getIcon(Icons.POLYGON, false));
shapeToggle.setSelectedIcon(Icons.getIcon(Icons.POLYGON, true));
shapeToggle.setBorder( null );
shapeToggle.setToolTipText("Shapefile Manager");
shapeToggle.addActionListener( new ActionListener() {
public void actionPerformed(ActionEvent e) {
if( shapeToggle.isSelected() ) {
// if( suite.getShapes().size()==0 ) {
if( table==null ) {
init();
// shapeToggle.setSelected(false);
return;
}
}
dialog.setVisible( shapeToggle.isSelected() );
}
});
}
示例2: createLassoPanel
import javax.swing.JToggleButton; //导入方法依赖的package包/类
protected JPanel createLassoPanel() {
JPanel p2 = new JPanel(new BorderLayout());
JToggleButton tb = new JToggleButton(Icons.getIcon(Icons.LASSO, false));
tb.setSelectedIcon(Icons.getIcon(Icons.LASSO, true));
tb.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
// ((AbstractButton)e.getSource()).setSelected(true);
if (((AbstractButton)e.getSource()).isSelected()) {
map.setBaseCursor(Cursors.getCursor(Cursors.LASSO));
} else
map.setBaseCursor(Cursor.getDefaultCursor());
}
});
tb.setBorder(BorderFactory.createEmptyBorder(0, 1, 0, 0));
p2.add(tb, BorderLayout.WEST);
p2.setBorder(null);
JLabel l = new JLabel("<html>Lasso<br>Data</html>");
l.setSize(35, 60);
l.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));
p2.add(l);
// ***** GMA 1.6.2: Listen for lasso button to ensure that it works correctly with the
// zoom buttons in the main toolbar
lassoTB = tb;
lassoTB.addMouseListener(this);
return p2;
}