本文整理了Java中javax.swing.JCheckBox.setIcon()
方法的一些代码示例,展示了JCheckBox.setIcon()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JCheckBox.setIcon()
方法的具体详情如下:
包路径:javax.swing.JCheckBox
类名称:JCheckBox
方法名:setIcon
暂无
代码示例来源:origin: ron190/jsql-injection
radioCustomFromRow.setIcon(new CheckBoxMenuItemIconCustom());
radioCustomFromRow.setFocusPainted(false);
radioCustomToRow.setIcon(new CheckBoxMenuItemIconCustom());
radioCustomToRow.setFocusPainted(false);
radioCustomFromChar.setIcon(new CheckBoxMenuItemIconCustom());
radioCustomFromChar.setFocusPainted(false);
radioCustomToChar.setIcon(new CheckBoxMenuItemIconCustom());
radioCustomToChar.setFocusPainted(false);
代码示例来源:origin: otros-systems/otroslogviewer
private void createFollowCheckBox() {
boolean f = configuration.getBoolean(ConfKeys.TAILING_PANEL_FOLLOW);
follow = new JCheckBox("Follow new events", f ? Icons.FOLLOW_ON : Icons.FOLLOW_OFF, f);
follow.setToolTipText("Scroll to latest log event");
follow.addActionListener(e -> {
boolean f1 = follow.isSelected();
follow.setIcon(f1 ? Icons.FOLLOW_ON : Icons.FOLLOW_OFF);
configuration.setProperty(ConfKeys.TAILING_PANEL_FOLLOW, f1);
});
}
代码示例来源:origin: stackoverflow.com
public void setIcons(Jtable table, int column, Icon icon, Icon selectedIcon) {
JCheckBox cellRenderer = (JCheckBox) table.getCellRenderer(0, column);
cellRenderer.setSelectedIcon(selectedIcon);
cellRenderer.setIcon(icon);
DefaultCellEditor cellEditor = (DefaultCellEditor) table.getCellEditor(0, column);
JCheckBox editorComponent = (JCheckBox) cellEditor.getComponent();
editorComponent.setSelectedIcon(selectedIcon);
editorComponent.setIcon(icon);
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-dlight-nativeexecution-nb
private void connectionSettingsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_connectionSettingsActionPerformed
connectionSettingsPanel.setVisible(connectionSettings.isSelected());
connectionSettings.setIcon(connectionSettings.isSelected() ? getExpandedIcon() : getCollapsedIcon());
}//GEN-LAST:event_connectionSettingsActionPerformed
代码示例来源:origin: stackoverflow.com
JCheckBox b = new JCheckBox();
b.setPressedIcon(pressedIcon)
b.setIcon(defaultIcon);
b.setDisabledIcon(disabledIcon)
代码示例来源:origin: stackoverflow.com
Icon normal = new ImageIcon(...);
Icon selected = new ImageIcon(...);
JTable table = new JTable(...);
table.setRowHeight(...);
TableCellRenderer renderer = table.getDefaultRenderer(Boolean.class);
JCheckBox checkBoxRenderer = (JCheckBox)renderer;
checkBoxRenderer.setIcon( normal );
checkBoxRenderer.setSelectedIcon( selected );
DefaultCellEditor editor = (DefaultCellEditor)table.getDefaultEditor(Boolean.class);
JCheckBox checkBoxEditor = (JCheckBox)editor.getComponent();
checkBoxEditor.setIcon( normal );
checkBoxEditor.setSelectedIcon( selected );
代码示例来源:origin: MrCrayfish/ModelCreator
public static JCheckBox createCheckBox(String text, String tooltip, boolean selected)
{
JCheckBox checkBox = new JCheckBox(text);
checkBox.setToolTipText(tooltip);
checkBox.setSelected(selected);
checkBox.setIcon(Icons.light_off);
checkBox.setRolloverIcon(Icons.light_off);
checkBox.setSelectedIcon(Icons.light_on);
checkBox.setRolloverSelectedIcon(Icons.light_on);
return checkBox;
}
代码示例来源:origin: stackoverflow.com
public class TestPane extends JPanel {
public TestPane() {
try {
JCheckBox cb = new JCheckBox();
cb.setSelectedIcon(new ImageIcon(ImageIO.read(...)));
cb.setIcon(new ImageIcon(ImageIO.read(...)));
cb.setBackground(Color.RED);
cb.setOpaque(true);
add(cb);
} catch (IOException ex) {
ex.printStackTrace();
}
}
}
代码示例来源:origin: otros-systems/otroslogviewer
private void createPauseCheckBox() {
boolean play = configuration.getBoolean(ConfKeys.TAILING_PANEL_PLAY);
playTailing = new JCheckBox("", play ? Icons.TAILING_LIVE : Icons.TAILING_PAUSE, play);
playTailing.setToolTipText("Pause adding new data");
playTailing.addActionListener(e -> {
boolean play1 = playTailing.isSelected();
playTailing.setIcon(play1 ? Icons.TAILING_LIVE : Icons.TAILING_PAUSE);
final LoadingDetails loadingDetails = logLoader.getLoadingDetails(dataTableModel);
final Stream<LogLoadingSession> stream = loadingDetails.getLogLoadingSessions().stream();
if (play1) {
stream.forEach(logLoader::resume);
} else {
stream.forEach(logLoader::pause);
}
});
}
代码示例来源:origin: org.nuiton.jaxx/jaxx-runtime
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent rendered = (JComponent) rendererDelegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (rendered instanceof JCheckBox) {
JCheckBox checkBox = (JCheckBox)rendered;
checkBox.setHorizontalAlignment(JLabel.CENTER);
checkBox.setVerticalTextPosition(JLabel.TOP);
checkBox.setBorderPainted(true);
checkBox.setIcon(icon);
}
return rendered;
}
代码示例来源:origin: io.ultreia.java4all.jaxx/jaxx-runtime
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
JComponent rendered = (JComponent) rendererDelegate.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
if (rendered instanceof JCheckBox) {
JCheckBox checkBox = (JCheckBox) rendered;
checkBox.setHorizontalAlignment(JLabel.CENTER);
checkBox.setVerticalTextPosition(JLabel.TOP);
checkBox.setBorderPainted(true);
checkBox.setIcon(icon);
}
return rendered;
}
代码示例来源:origin: stackoverflow.com
boxFontMetrics.getHeight(), boxFontMetrics.getHeight(), Image.SCALE_SMOOTH
);
checkbox.setIcon(new ImageIcon(finalBoxImage));
代码示例来源:origin: org.rwshop/org.rwshop.swing.common
private static void makeCellCheckBox(JCheckBox cb, Icon icon, Icon selIcon, String tooltip){
cb.setHorizontalAlignment(JCheckBox.CENTER);
if(icon != null){
cb.setIcon(icon);
}
if(selIcon != null){
cb.setSelectedIcon(selIcon);
}
cb.setOpaque(true);
cb.setToolTipText(tooltip);
}
代码示例来源:origin: MegaMek/mekhq
private JCheckBox createOptionCheckBox(String text, Icon checkboxIcon, Icon checkboxSelectedIcon) {
JCheckBox checkBox = new JCheckBox(text);
checkBox.setOpaque(false);
checkBox.setForeground(new Color(150, 220, 255));
checkBox.setFocusable(false);
checkBox.setFont(checkBox.getFont().deriveFont(Font.BOLD));
checkBox.setPreferredSize(new Dimension(150, 20));
checkBox.setIcon(checkboxIcon);
checkBox.setSelectedIcon(checkboxSelectedIcon);
checkBox.setSelected(false);
checkBox.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
repaint();
}
});
return checkBox;
}
代码示例来源:origin: igniterealtime/Spark
private JPanel createCheckBoxes() {
JPanel panel = new JPanel();
panel.setLayout(new GridBagLayout());
panel.setBorder(BorderFactory.createTitledBorder(Res.getString("privacy.border.block")));
_blockPIn = new JCheckBox(Res.getString("privacy.label.pin.desc"));
_blockPIn.setIcon(SparkRes.getImageIcon("PRIVACY_PIN_ALLOW"));
_blockPIn.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_PIN_DENY"));
_blockPIn.setRolloverEnabled(false);
_blockPOout = new JCheckBox(Res.getString("privacy.label.pout.desc"));
_blockPOout.setIcon(SparkRes.getImageIcon("PRIVACY_POUT_ALLOW"));
_blockPOout.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_POUT_DENY"));
_blockPOout.setRolloverEnabled(false);
_blockMsg = new JCheckBox(Res.getString("privacy.label.msg.desc"));
_blockMsg.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_MSG_DENY"));
_blockMsg.setIcon(SparkRes.getImageIcon("PRIVACY_MSG_ALLOW"));
_blockMsg.setRolloverEnabled(false);
_blockIQ = new JCheckBox(Res.getString("privacy.label.iq.desc"));
_blockIQ.setSelectedIcon(SparkRes.getImageIcon("PRIVACY_QUERY_DENY"));
_blockIQ.setIcon(SparkRes.getImageIcon("PRIVACY_QUERY_ALLOW"));
_blockIQ.setRolloverEnabled(false);
panel.add(_blockPIn, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
panel.add(_blockPOout, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
panel.add(_blockMsg, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
panel.add(_blockIQ, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
return panel;
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
@Override
public void configurarCores()
{
if(WeblafUtils.weblafEstaInstalado())
{
WeblafUtils.configuraWebLaf(seletorPlugin);
}
setBackground(ColorController.FUNDO_CLARO);
labelPluginInstalado.setBackground(ColorController.PROGRESS_BAR);
labelPluginInstalado.setForeground(ColorController.COR_LETRA);
seletorPlugin.setSelectedIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "selected.png"));
seletorPlugin.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected.png"));
}
代码示例来源:origin: atarw/material-ui-swing
@Override
public void installUI (JComponent c) {
super.installUI (c);
JCheckBox checkBox = (JCheckBox) c;
checkBox.setFont (UIManager.getFont ("CheckBox.font"));
checkBox.setBackground (UIManager.getColor ("CheckBox.background"));
checkBox.setForeground (UIManager.getColor ("CheckBox.foreground"));
checkBox.setIcon (UIManager.getIcon ("CheckBox.icon"));
checkBox.setSelectedIcon (UIManager.getIcon ("CheckBox.selectedIcon"));
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
public AbaGerenciadorBibliotecas(AbaCodigoFonte abaCodigoFonte) {
super("Bibliotecas", IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "biblioteca.png"), false);
this.abaCodigoFonte = abaCodigoFonte;
initComponents();
List<String> libs = GerenciadorBibliotecas.getInstance().getBibliotecasDisponiveis();
for (String lib : libs) {
JCheckBox check = new JCheckBox(lib);
check.setForeground(ColorController.COR_LETRA);
check.setSelectedIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "selected.png"));
check.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected.png"));
FabricaDicasInterface.criarTooltipEstatica(check, lib);
if(abaCodigoFonte.getPortugolDocumento().getCodigoFonte().contains("inclua biblioteca "+lib)){
check.setSelected(true);
}
check.addItemListener(new ItemListener() {
@Override
public void itemStateChanged(ItemEvent ie) {
if(ie.getStateChange() == ItemEvent.SELECTED){
abaCodigoFonte.adicionarBiblioteca(((JCheckBox)ie.getItem()).getText());
}else{
abaCodigoFonte.removerBiblioteca(((JCheckBox)ie.getItem()).getText());
}
}
});
painelCheckBox.add(check);
}
configurarCores();
}
代码示例来源:origin: org.codehaus.izpack/izpack-panel
CheckBoxRenderer()
{
if (com.izforge.izpack.util.OsVersion.IS_UNIX && !com.izforge.izpack.util.OsVersion.IS_OSX)
{
checkbox.setIcon(new LFIndependentIcon());
checkbox.setDisabledIcon(new LFIndependentIcon());
checkbox.setSelectedIcon(new LFIndependentIcon());
checkbox.setDisabledSelectedIcon(new LFIndependentIcon());
}
checkbox.setHorizontalAlignment(CENTER);
}
代码示例来源:origin: UNIVALI-LITE/Portugol-Studio
marcarCheckBox.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected.png"));
diferenciarCheckBox.setSelectedIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "selected.png"));
diferenciarCheckBox.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected.png"));
palavraInteiraCheckBox.setSelectedIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "selected.png"));
palavraInteiraCheckBox.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected.png"));
expressaoCheckBox.setSelectedIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "selected.png"));
expressaoCheckBox.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected.png"));
avancarRadioButton.setSelectedIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "selected_rounded.png"));
avancarRadioButton.setIcon(IconFactory.createIcon(IconFactory.CAMINHO_ICONES_PEQUENOS, "unselected_rounded.png"));
内容来源于网络,如有侵权,请联系作者删除!