当前位置: 首页>>代码示例>>Java>>正文


Java JCheckBox.setForeground方法代码示例

本文整理汇总了Java中javax.swing.JCheckBox.setForeground方法的典型用法代码示例。如果您正苦于以下问题:Java JCheckBox.setForeground方法的具体用法?Java JCheckBox.setForeground怎么用?Java JCheckBox.setForeground使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JCheckBox的用法示例。


在下文中一共展示了JCheckBox.setForeground方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getListCellRendererComponent

import javax.swing.JCheckBox; //导入方法依赖的package包/类
@Override
public Component getListCellRendererComponent(
    JList<? extends JCheckBox> list, JCheckBox value, int index,
    boolean isSelected, boolean cellHasFocus) {
  JPanel panel = new JPanel(new BorderLayout());

  JCheckBox checkbox = value;
  final JCheckBox newCheck = new JCheckBox();
  final JLabel newLabel = new JLabel(checkbox.getText());
  newCheck.setSelected(checkbox.isSelected());
  // Drawing checkbox, change the appearance here
  newCheck.setBackground(isSelected ? getSelectionBackground()
      : getBackground());
  newCheck.setForeground(isSelected ? getSelectionForeground()
      : getForeground());
  newCheck.setEnabled(isEnabled());
  newCheck.setFont(getFont());
  newCheck.setFocusPainted(false);
  newCheck.setBorderPainted(true);
  newCheck.setBorder(isSelected ? UIManager
      .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
  newLabel.setOpaque(true);
  newLabel.setBackground(isSelected ? getSelectionBackground()
      : getBackground());
  newLabel.setForeground(isSelected ? getSelectionForeground()
      : getForeground());
  newLabel.setEnabled(isEnabled());
  newLabel.setFocusable(false);
  newLabel.setFont(getFont());
  newLabel.setBorder(isSelected ? UIManager
      .getBorder("List.focusCellHighlightBorder") : noFocusBorder);
  newLabel.setIcon(checkbox.getIcon());

  panel.add(newCheck, BorderLayout.WEST);
  panel.add(newLabel, BorderLayout.CENTER);
  return panel;
}
 
开发者ID:gurkenlabs,项目名称:litiengine,代码行数:38,代码来源:JCheckBoxList.java

示例2: ShowNextTime

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/** Creates a new instance of RecentProjects */
public ShowNextTime() {
    super( new BorderLayout() );
    setOpaque(false);

    button = new JCheckBox( BundleSupport.getLabel( "ShowOnStartup" ) ); // NOI18N
    button.setSelected( WelcomeOptions.getDefault().isShowOnStartup() );
    button.setOpaque( false );
    button.setForeground( Color.white );
    button.setHorizontalTextPosition( SwingConstants.LEFT );
    BundleSupport.setAccessibilityProperties( button, "ShowOnStartup" ); //NOI18N
    add( button, BorderLayout.CENTER );
    button.addActionListener( this );
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:ShowNextTime.java

示例3: createComponent

import javax.swing.JCheckBox; //导入方法依赖的package包/类
private JCheckBox createComponent(JTable table, Object value,
        boolean isSelected, boolean hasFocus, int row, int column) {
    EclipseProject project = projects[row];
    JCheckBox chb = new JCheckBox();
    chb.setSelected(selectedProjects.contains(project) ||
            requiredProjects.contains(project));
    chb.setToolTipText(null);
    if (project.isImportSupported() && !requiredProjects.contains(project)) {
        chb.setEnabled(true);
    } else {
        // required and non-java project are disabled
        chb.setEnabled(false);
        if (!project.isImportSupported()) {
            chb.setToolTipText(ProjectImporterWizard.getMessage(
                    "MSG_NonJavaProject", project.getName())); // NOI18N
        }
    }
    if (isSelected) {
        chb.setOpaque(true);
        chb.setForeground(table.getSelectionForeground());
        chb.setBackground(table.getSelectionBackground());
    } else {
        chb.setOpaque(false);
        chb.setForeground(table.getForeground());
        chb.setBackground(table.getBackground());
    }
    return chb;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:29,代码来源:ProjectSelectionPanel.java

示例4: addTip

import javax.swing.JCheckBox; //导入方法依赖的package包/类
void addTip(Controllable f, JCheckBox label) {
    String s = f.getPropertyTooltip(label.getText());
    if (s == null) {
        return;
    }
    label.setToolTipText(s);
    label.setForeground(Color.BLUE);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:ControlPanel.java

示例5: addTip

import javax.swing.JCheckBox; //导入方法依赖的package包/类
void addTip(ParameterContainer f, JCheckBox label) {
    String s = f.getPropertyTooltip(label.getText());
    if (s == null) {
        return;
    }
    label.setToolTipText(s);
    label.setForeground(Color.BLUE);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:ParameterBrowserPanel.java

示例6: addTip

import javax.swing.JCheckBox; //导入方法依赖的package包/类
void addTip(EventFilter f, JCheckBox label) {
    String s = f.getPropertyTooltip(label.getText());
    if (s == null) {
        return;
    }
    label.setToolTipText(s);
    label.setForeground(Color.BLUE);

}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:10,代码来源:FilterPanel.java

示例7: createJCheckBoxForTable

import javax.swing.JCheckBox; //导入方法依赖的package包/类
/**
 * It creates a new check box for inclusion in a table and sets 
 * its "is selected" attribute to the given value.
 * 
 * @param selected It determines whether the newly-created check box
 * will be selected or not.
 * @return A new check box for inclusion in a table.
 */
static public JCheckBox createJCheckBoxForTable(boolean selected) {
    JCheckBox checkBox = new JCheckBox();
    checkBox.setOpaque(true);
    checkBox.setHorizontalAlignment(SwingConstants.CENTER);
    checkBox.setForeground(TABLE_COMPONENT_FG_COLOR);
    checkBox.setBackground(TABLE_COMPONENT_BG_COLOR);
    checkBox.setSelected(selected);
    return checkBox;
}
 
开发者ID:vimerzhao,项目名称:gchisto,代码行数:18,代码来源:GUIUtilities.java

示例8: addTip

import javax.swing.JCheckBox; //导入方法依赖的package包/类
void addTip(PropertyDescriptor p, JCheckBox label) {
    label.setToolTipText(getTip(p));
    label.setForeground(Color.BLUE);
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:5,代码来源:ParameterControlPanel.java

示例9: itemStateChanged

import javax.swing.JCheckBox; //导入方法依赖的package包/类
@Override
public void itemStateChanged(ItemEvent e) {

	JCheckBox element = (JCheckBox)e.getItemSelectable();
	
	element.setForeground(element.isSelected() ? new Color(0,110,198,255) : new Color(169,192,210,255));
	
	lblAddShortcutTo.setForeground(csdesktop.isSelected() || csquickstart.isSelected() || csprogrammenu.isSelected() ? 
			new Color(0,110,198,255) : new Color(169,192,210,255));
	
	
}
 
开发者ID:davovoid,项目名称:faitic-checker,代码行数:13,代码来源:FirstStart.java


注:本文中的javax.swing.JCheckBox.setForeground方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。