本文整理匯總了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;
}