本文整理汇总了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;
}
示例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 );
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
示例8: addTip
import javax.swing.JCheckBox; //导入方法依赖的package包/类
void addTip(PropertyDescriptor p, JCheckBox label) {
label.setToolTipText(getTip(p));
label.setForeground(Color.BLUE);
}
示例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));
}