本文整理汇总了Java中javax.swing.JButton.setDisabledIcon方法的典型用法代码示例。如果您正苦于以下问题:Java JButton.setDisabledIcon方法的具体用法?Java JButton.setDisabledIcon怎么用?Java JButton.setDisabledIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setDisabledIcon方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getToolbarPresenter
import javax.swing.JButton; //导入方法依赖的package包/类
public static Component getToolbarPresenter(Action action) {
JButton button = new JButton(action);
button.setBorderPainted(false);
button.setOpaque(false);
button.setText(null);
button.putClientProperty("hideActionText", Boolean.TRUE); // NOI18N
Object icon = action.getValue(Action.SMALL_ICON);
if (icon == null) {
icon = ImageUtilities.loadImageIcon("org/netbeans/modules/dlight/terminal/action/local_term.png", false);// NOI18N
}
if (!(icon instanceof Icon)) {
throw new IllegalStateException("No icon provided for " + action); // NOI18N
}
button.setDisabledIcon(ImageUtilities.createDisabledIcon((Icon) icon));
return button;
}
示例2: customizePanel
import javax.swing.JButton; //导入方法依赖的package包/类
public void customizePanel(JPanel valuePanel, Container buttonsPanel) {
valuePanel.setLayout(new BorderLayout());
valuePanel.add(jComboBoxColumns);
jComboBoxColumns.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
setJavelinZoneFromProperty();
}
});
addButton = new JButton();
addButton.setFocusPainted(false);
addButton.setEnabled(false);
addButton.setPreferredSize(new Dimension(24, 24));
addButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/twinsoft/convertigo/eclipse/property_editors/images/table_editor/new_line.png")));
addButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/com/twinsoft/convertigo/eclipse/property_editors/images/table_editor/new_line.d.png")));
addButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent actionEvent) {
addButtonActionPerformed();
}
});
buttonsPanel.add(addButton);
if (javelin != null) {
javelin.addZoneListener(this);
}
}
示例3: SplashScreen
import javax.swing.JButton; //导入方法依赖的package包/类
public SplashScreen(Image image) {
this.icon = new ImageIcon(image);
Container container = getContentPane();
container.setLayout(null);
BufferedImage alphaImage = new BufferedImage(this.icon.getIconWidth(), this.icon.getIconHeight(), 2);
Graphics2D g = alphaImage.createGraphics();
g.drawImage(image, 0, 0, this.icon.getIconWidth(), this.icon.getIconHeight(), null);
g.dispose();
JButton background = new JButton(new ImageIcon(alphaImage));
background.setBounds(0, 0, this.icon.getIconWidth(), this.icon.getIconHeight());
background.setRolloverEnabled(true);
background.setRolloverIcon(background.getIcon());
background.setSelectedIcon(background.getIcon());
background.setDisabledIcon(background.getIcon());
background.setPressedIcon(background.getIcon());
background.setFocusable(false);
background.setContentAreaFilled(false);
background.setBorderPainted(false);
background.setOpaque(false);
container.add(background);
setSize(this.icon.getIconWidth(), this.icon.getIconHeight() + 20);
try {
setBackground(new Color(0, 0, 0, 0));
} catch (UnsupportedOperationException e) {
setBackground(new Color(0, 0, 0));
}
setLocationRelativeTo(null);
}
示例4: addUnitTypes
import javax.swing.JButton; //导入方法依赖的package包/类
private void addUnitTypes() {
int row = 1;
JButton allColonistsButton = createUnitNameButton(Messages.message("report.labour.allColonists"), labourData.getSummary());
reportPanel.add(allColonistsButton, "cell " + COLONY_COLUMN + " " + row + " 1 " + labourData.getSummary().getUnitSummaryRowCount());
row = addLocationData(labourData.getSummary().getTotal(), null, row);
for (UnitType unitType : LabourData.getLabourTypes(getMyPlayer())) {
LabourData.UnitData unitData = labourData.getUnitData(unitType);
JButton unitButton = createUnitNameButton(unitData.getUnitName(), unitData);
int rows = unitData.getUnitSummaryRowCount();
reportPanel.add(unitButton, "cell " + COLONY_COLUMN + " " + row + " 1 " + rows);
if (unitData.hasDetails()) {
row = addLocationData(unitData.getTotal(), null, row);
} else {
unitButton.setEnabled(false);
unitButton.setDisabledIcon(unitButton.getIcon());
unitButton.setForeground(Color.GRAY);
reportPanel.add(createEmptyLabel(), "cell " + UNIT_TYPE_COLUMN + " " + row + " " + (COLUMNS - 1) + " 1");
row++;
}
}
}
示例5: createButton
import javax.swing.JButton; //导入方法依赖的package包/类
private JButton createButton(int icon) {
JButton button = new JButton( Icons.getIcon(icon,false));
button.setPressedIcon( Icons.getIcon(icon, true) );
button.setDisabledIcon( Icons.getDisabledIcon( icon, false ));
button.setBorder( BorderFactory.createLineBorder(Color.black));
button.setMargin(new Insets(1,0,1,0));
return button;
}