javax.swing.JCheckBox.setBackground()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中javax.swing.JCheckBox.setBackground()方法的一些代码示例,展示了JCheckBox.setBackground()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JCheckBox.setBackground()方法的具体详情如下:
包路径:javax.swing.JCheckBox
类名称:JCheckBox
方法名:setBackground

JCheckBox.setBackground介绍

暂无

代码示例

代码示例来源:origin: runelite/runelite

private JPanel buildCheckboxPanel(SkillDataBonus bonus)
{
  JPanel uiOption = new JPanel(new BorderLayout());
  JLabel uiLabel = new JLabel(bonus.getName());
  JCheckBox uiCheckbox = new JCheckBox();
  uiLabel.setForeground(Color.WHITE);
  uiLabel.setFont(FontManager.getRunescapeSmallFont());
  uiOption.setBorder(BorderFactory.createEmptyBorder(3, 7, 3, 0));
  uiOption.setBackground(ColorScheme.DARKER_GRAY_COLOR);
  // Adjust XP bonus depending on check-state of the boxes.
  uiCheckbox.addActionListener(event -> adjustCheckboxes(uiCheckbox, bonus));
  uiCheckbox.setBackground(ColorScheme.MEDIUM_GRAY_COLOR);
  uiOption.add(uiLabel, BorderLayout.WEST);
  uiOption.add(uiCheckbox, BorderLayout.EAST);
  bonusCheckBoxes.add(uiCheckbox);
  return uiOption;
}

代码示例来源:origin: marytts/marytts

private void setSelected(boolean newSelected) {
  if (!isSelected && newSelected) {
    isSelected = true;
    this.setBackground(selectedColor);
    cbSelected.setBackground(selectedColor);
    if (voiceUpdate != null && desc instanceof LanguageComponentDescription) {
      voiceUpdate.updateVoices((LanguageComponentDescription) desc, false);
    }
  } else if (isSelected && !newSelected) {
    isSelected = false;
    this.setBackground(unselectedColor);
    cbSelected.setBackground(unselectedColor);
  }
}

代码示例来源:origin: marytts/marytts

private void setSelected(boolean newSelected) {
  if (!isSelected && newSelected) {
    isSelected = true;
    this.setBackground(selectedColor);
    cbSelected.setBackground(selectedColor);
    if (voiceUpdate != null && desc instanceof LanguageComponentDescription) {
      voiceUpdate.updateVoices((LanguageComponentDescription) desc, false);
    }
  } else if (isSelected && !newSelected) {
    isSelected = false;
    this.setBackground(unselectedColor);
    cbSelected.setBackground(unselectedColor);
  }
}

代码示例来源:origin: stanfordnlp/CoreNLP

public FileTreeNode(File file, FileTreeNode parent) {
 super(file);
 this.setParent(parent);
 this.file = file;
 boolean isLeaf = file.isFile();
 if(isLeaf) {
  check = new JCheckBox(this.toString(),isLeaf);
  check.setOpaque(true);
  check.setBackground(Color.WHITE);
 }
 else
  label = new JLabel(this.toString());
 this.setAllowsChildren(!isLeaf);
}

代码示例来源:origin: runelite/runelite

checkbox.setBackground(ColorScheme.LIGHT_GRAY_COLOR);
checkbox.setSelected(Boolean.parseBoolean(configManager.getConfiguration(cd.getGroup().value(), cid.getItem().keyName())));
checkbox.addActionListener(ae -> changeConfiguration(listItem, config, checkbox, cd, cid));

代码示例来源:origin: marytts/marytts

jCheckBox_SystemLookAndFeel.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_SystemLookAndFeel.setText("Use system look and feel (requires tool restart)");
jCheckBox_SystemLookAndFeel.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_ShowTestOutput.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_ShowTestOutput.setText("Display test output in console");
jCheckBox_ShowTestOutput.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_ShowTranscription.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_ShowTranscription.setText("Show transcription");
jCheckBox_ShowTranscription.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_ShowPromptCount.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_ShowPromptCount.setText("Show prompt count and progress bar in Speaker Window");
jCheckBox_ShowPromptCount.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
jCheckBox_RedAlertMode.setBackground(javax.swing.UIManager.getDefaults().getColor("TabbedPane.highlight"));
jCheckBox_RedAlertMode.setText("Red alert mode");
jCheckBox_RedAlertMode.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));

代码示例来源:origin: ron190/jsql-injection

@Override
public Component getComponent(
  final JTree tree, Object nodeRenderer, final boolean isSelected, boolean isLeaf, boolean hasFocus
) {
  JCheckBox checkbox = new JCheckBox(this.toString(), this.isSelected());
  checkbox.setFont(
    checkbox.getFont().deriveFont(
      Font.PLAIN | Font.ITALIC,
      checkbox.getFont().getSize()
    )
  );
  
  checkbox.setText(StringUtil.detectUtf8HtmlNoWrap(this.toString()));
  
  if (isSelected) {
    if (hasFocus) {
      checkbox.setBackground(HelperUi.COLOR_FOCUS_GAINED);
      checkbox.setBorder(HelperUi.BORDER_FOCUS_GAINED);
    } else {
      checkbox.setBackground(HelperUi.COLOR_FOCUS_LOST);
      checkbox.setBorder(HelperUi.BORDER_FOCUS_LOST);
    }
  } else {
    checkbox.setBackground(Color.WHITE);
    checkbox.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
  }
  
  checkbox.setComponentOrientation(ComponentOrientation.getOrientation(I18n.getLocaleDefault()));
  return checkbox;
}

代码示例来源:origin: pentaho/mondrian

booleanRenderer.setBackground(Color.white);
integerRenderer = new JLabel();
integerRenderer.setHorizontalAlignment(JTextField.RIGHT);

代码示例来源:origin: pentaho/mondrian

booleanEditor.setBackground(Color.white);

代码示例来源:origin: org.jspresso.framework/jspresso-swing-application

/**
 * {@inheritDoc}
 */
@Override
public void setBackground(Color bg) {
 super.setBackground(bg);
 unselectedBackground = bg;
}

代码示例来源:origin: com.jidesoft/jide-oss

@Override
public void setBackground(Color bg) {
  if (bg instanceof ColorUIResource) {
    return;
  }
  super.setBackground(bg);
}

代码示例来源:origin: igvteam/igv

@Override
public void setBackground(Color value) {
  super.setBackground(value);
  if (jCheckBox1 != null) {
    jCheckBox1.setBackground(value);
  }
}

代码示例来源:origin: Exslims/MercuryTrade

public JCheckBox getCheckBox(boolean value) {
    JCheckBox checkBox = new JCheckBox();
    checkBox.setSelected(value);
//        checkBox.setUI(new WindowsButtonUI());
    checkBox.setFocusPainted(false);
    checkBox.setBackground(AppThemeColor.TRANSPARENT);
    return checkBox;
  }

代码示例来源:origin: edu.stanford.protege/ca.uvic.cs.chisel.cajun

@Override
public void setBackground(Color bg) {
  super.setBackground(bg);
  getIconLabel().setBackground(bg);
}

代码示例来源:origin: com.jidesoft/jide-oss

private void clearAttribute() {
  super.setFont(null);
  super.setBackground(null);
  super.setForeground(null);
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-webui-designtime

SelectedCellRenderer() {
  checkBox = new JCheckBox();
  checkBox.setHorizontalAlignment(JCheckBox.CENTER);
  checkBox.setBackground(Color.WHITE);
  radioButton = new JRadioButton();
  radioButton.setHorizontalAlignment(JRadioButton.CENTER);
  radioButton.setBackground(Color.WHITE);
  currentComponent = radioButton;
}

代码示例来源:origin: org.apache.cayenne.modeler/cayenne-modeler

@Override
  public Component getTableCellRendererComponent(JTable table, Object value,
                          boolean isSelected, boolean hasFocus, int row, int column) {
    Color color = isSelected ? table.getSelectionBackground() : table.getBackground();
    renderer.setBackground(color);
    renderer.setEnabled(table.isCellEditable(row, column));
    renderer.setSelected(value != null && (Boolean)value);
    return renderer;
  }
}

代码示例来源:origin: Exslims/MercuryTrade

public JCheckBox getCheckBox(String tooltip) {
    JCheckBox checkBox = new JCheckBox();
    checkBox.setFocusPainted(false);
    checkBox.setBackground(AppThemeColor.TRANSPARENT);
//        checkBox.setUI(new WindowsButtonUI());
    checkBox.addMouseListener(new TooltipMouseListener(tooltip));
    return checkBox;
  }

代码示例来源:origin: igniterealtime/Spark

/**
 * Create new CheckRenderer.
 */
public CheckRenderer() {
  setLayout(null);
  add(check = new JCheckBox());
  add(label = new TreeLabel());
  check.setBackground(UIManager.getColor("Tree.textBackground"));
  label.setForeground(UIManager.getColor("Tree.textForeground"));
}

代码示例来源:origin: org.biojava.thirdparty/forester

void addJCheckBox( final JCheckBox jcb, final JPanel p ) {
  jcb.setFocusPainted( false );
  jcb.setFont( ControlPanel.jcb_font );
  if ( !_configuration.isUseNativeUI() ) {
    jcb.setBackground( getConfiguration().getGuiBackgroundColor() );
    jcb.setForeground( getConfiguration().getGuiCheckboxTextColor() );
  }
  p.add( jcb, "Center" );
  jcb.addActionListener( this );
}

相关文章

JCheckBox类方法