@Override
public Component getListCellRendererComponent (
JList<? extends ColorValue>
list,
ColorValue value,
int index,
boolean isSelected,
boolean cellHasFocus
) {
this.value = value;
setEnabled (list.isEnabled ());
setBackground (isSelected ?
SystemColor.textHighlight : SystemColor.text
//Color.RED
);
setForeground (isSelected ?
SystemColor.textHighlightText : SystemColor.textText
);
return this;
}
java类java.awt.SystemColor的实例源码
ColorComboBoxRenderer.java 文件源码
项目:incubator-netbeans
阅读 18
收藏 0
点赞 0
评论 0
FastListUI.java 文件源码
项目:powertext
阅读 16
收藏 0
点赞 0
评论 0
private Color determineSelectionBackground() {
Color c = UIManager.getColor("List.selectionBackground");
if (c==null) {
c = UIManager.getColor("nimbusSelectionBackground");
if (c==null) { // Not Nimbus, but still need a value - fallback
c = UIManager.getColor("textHighlight");
if (c==null) {
c = SystemColor.textHighlight;
}
}
}
// Nimbus unfortunately requires a Color, not a ColorUIResource, for
// the background override to work. This causes this color to "stick"
// even if the LAF is changed to something else later. "c" here may
// actually be a ColorUIResource
return new Color(c.getRGB());//new ColorUIResource(c);
}
FilterPanel.java 文件源码
项目:jaer
阅读 31
收藏 0
点赞 0
评论 0
private void enabledCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_enabledCheckBoxActionPerformed
boolean yes = enabledCheckBox.isSelected();
if (getFilter() != null) {
getFilter().setFilterEnabled(yes);
}
if (yes) {
((TitledBorder) getBorder()).setTitleColor(SystemColor.textText);
titledBorder.setBorder(redLineBorder);
} else {
((TitledBorder) getBorder()).setTitleColor(SystemColor.textInactiveText);
titledBorder.setBorder(normalBorder);
}
repaint();
getFilter().setSelected(yes);
}
ConnectionDialog.java 文件源码
项目:parabuild-ci
阅读 30
收藏 0
点赞 0
评论 0
/**
* Method declaration
*
*
* @param center
*
* @return
*/
protected static Panel createBorderPanel(Component center) {
Panel p = new Panel();
p.setBackground(SystemColor.control);
p.setLayout(new BorderLayout());
p.add("Center", center);
p.add("North", createLabel(""));
p.add("South", createLabel(""));
p.add("East", createLabel(""));
p.add("West", createLabel(""));
p.setBackground(SystemColor.control);
return p;
}
ConnectionDialog.java 文件源码
项目:parabuild-ci
阅读 27
收藏 0
点赞 0
评论 0
/**
* Method declaration
*
*
* @param center
*
* @return
*/
protected static Panel createBorderPanel(Component center) {
Panel p = new Panel();
p.setBackground(SystemColor.control);
p.setLayout(new BorderLayout());
p.add("Center", center);
p.add("North", createLabel(""));
p.add("South", createLabel(""));
p.add("East", createLabel(""));
p.add("West", createLabel(""));
p.setBackground(SystemColor.control);
return p;
}
WPanelPeer.java 文件源码
项目:openjdk-jdk10
阅读 22
收藏 0
点赞 0
评论 0
@Override
void initialize() {
super.initialize();
insets_ = new Insets(0,0,0,0);
Color c = ((Component)target).getBackground();
if (c == null) {
c = SystemColor.window;
((Component)target).setBackground(c);
setBackground(c);
}
c = ((Component)target).getForeground();
if (c == null) {
c = SystemColor.windowText;
((Component)target).setForeground(c);
setForeground(c);
}
}
CameraMonitor.java 文件源码
项目:wiimote-paintboard
阅读 19
收藏 0
点赞 0
评论 0
public CameraMonitor(WiimoteDataHandler dh) {
super(Application.getInstance(WiimoteWhiteboard.class).getMainFrame(), Util.getResourceMap(CameraMonitor.class).getString("monitor.Action.text"));
getRootPane().putClientProperty("Window.style", "small");
setLayout(new MigLayout());
dh.addWiimoteDataListener(this);
canvas = new JPanel(null, true);
canvas.setOpaque(true);
canvas.setBorder(BorderFactory.createLineBorder(SystemColor.inactiveCaptionBorder));
add(canvas, "w 50sp, h 50sp, grow, push");
addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
setVisible(false);
}
}
});
pack();
setLocationRelativeTo(null);
new Timer(true).schedule(new UpdateTask(), 0, REPAINT_FREQ);
}
JLink.java 文件源码
项目:pumpernickel
阅读 17
收藏 0
点赞 0
评论 0
@Override
public void paint(Graphics g) {
super.paint(g);
if(drawLine) {
LineMetrics m = getFont().getLineMetrics(getText(),frc);
Insets i = getInsets();
int descent = (int)m.getDescent()-4;
if(isEnabled()) {
g.setColor(getForeground());
} else {
g.setColor(SystemColor.textInactiveText);
}
g.drawLine(i.left,getHeight()-i.bottom-descent,getWidth()-i.right-1,getHeight()-i.bottom-descent);
}
}
TipUtil.java 文件源码
项目:ftc
阅读 20
收藏 0
点赞 0
评论 0
/**
* Returns the default background color to use for tool tip windows.
*
* @return The default background color.
*/
public static Color getToolTipBackground() {
Color c = UIManager.getColor("ToolTip.background");
// Tooltip.background is wrong color on Nimbus (!)
boolean isNimbus = isNimbusLookAndFeel();
if (c==null || isNimbus) {
c = UIManager.getColor("info"); // Used by Nimbus (and others)
if (c==null || (isNimbus && isDerivedColor(c))) {
c = SystemColor.info; // System default
}
}
// Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
// with a ColorUIResource does nothing, must be a normal Color
if (c instanceof ColorUIResource) {
c = new Color(c.getRGB());
}
return c;
}
FastListUI.java 文件源码
项目:ftc
阅读 15
收藏 0
点赞 0
评论 0
private Color determineSelectionBackground() {
Color c = UIManager.getColor("List.selectionBackground");
if (c==null) {
c = UIManager.getColor("nimbusSelectionBackground");
if (c==null) { // Not Nimbus, but still need a value - fallback
c = UIManager.getColor("textHighlight");
if (c==null) {
c = SystemColor.textHighlight;
}
}
}
// Nimbus unfortunately requires a Color, not a ColorUIResource, for
// the background override to work. This causes this color to "stick"
// even if the LAF is changed to something else later. "c" here may
// actually be a ColorUIResource
return new Color(c.getRGB());//new ColorUIResource(c);
}
TipUtil.java 文件源码
项目:ftc
阅读 19
收藏 0
点赞 0
评论 0
/**
* Returns the default background color to use for tool tip windows.
*
* @return The default background color.
*/
public static Color getToolTipBackground() {
Color c = UIManager.getColor("ToolTip.background");
// Tooltip.background is wrong color on Nimbus (!)
boolean isNimbus = isNimbusLookAndFeel();
if (c==null || isNimbus) {
c = UIManager.getColor("info"); // Used by Nimbus (and others)
if (c==null || (isNimbus && isDerivedColor(c))) {
c = SystemColor.info; // System default
}
}
// Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
// with a ColorUIResource does nothing, must be a normal Color
if (c instanceof ColorUIResource) {
c = new Color(c.getRGB());
}
return c;
}
EventManager.java 文件源码
项目:cas
阅读 21
收藏 0
点赞 0
评论 0
public void ruleNumberEvent(){
if(validator.isRuleNumberValid()){
int value = Integer.valueOf(main.txtRuleNumber.getText());
main.txtRuleNumber.setBackground(SystemColor.text);
char[] binary = Integer.toBinaryString(value).toCharArray();
int[] states = new int[8];
for(int i = 0; i < states.length; i++){
if(i < binary.length){
states[i] = Integer.parseInt(String.valueOf(binary[binary.length - 1 - i]));
} else {
states[i] = 0;
}
}
main.transitionsView.setStates(states);
}
}
TipUtil.java 文件源码
项目:Tank
阅读 21
收藏 0
点赞 0
评论 0
/**
* Returns the default background color to use for tool tip windows.
*
* @return The default background color.
*/
public static Color getToolTipBackground() {
Color c = UIManager.getColor("ToolTip.background");
// Tooltip.background is wrong color on Nimbus (!)
if (c == null || UIManager.getLookAndFeel().getName().equals("Nimbus")) {
c = UIManager.getColor("info"); // Used by Nimbus (and others)
if (c == null) {
c = SystemColor.info; // System default
}
}
// Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
// with a ColorUIResource does nothing, must be a normal Color
if (c instanceof ColorUIResource) {
c = new Color(c.getRGB());
}
return c;
}
TipUtil.java 文件源码
项目:Tank
阅读 16
收藏 0
点赞 0
评论 0
/**
* Returns the default background color to use for tool tip windows.
*
* @return The default background color.
*/
public static Color getToolTipBackground() {
Color c = UIManager.getColor("ToolTip.background");
// Tooltip.background is wrong color on Nimbus (!)
if (c == null || UIManager.getLookAndFeel().getName().equals("Nimbus")) {
c = UIManager.getColor("info"); // Used by Nimbus (and others)
if (c == null) {
c = SystemColor.info; // System default
}
}
// Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
// with a ColorUIResource does nothing, must be a normal Color
if (c instanceof ColorUIResource) {
c = new Color(c.getRGB());
}
return c;
}
TaskPaneAddon.java 文件源码
项目:swingx
阅读 17
收藏 0
点赞 0
评论 0
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
Font taskPaneFont = UIManagerExt.getSafeFont("Label.font", new Font(
"Dialog", Font.PLAIN, 12));
taskPaneFont = taskPaneFont.deriveFont(Font.BOLD);
Color menuBackground = new ColorUIResource(SystemColor.menu);
defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicTaskPaneUI");
defaults.add("TaskPane.font", new FontUIResource(taskPaneFont));
defaults.add("TaskPane.background", UIManagerExt.getSafeColor("List.background",
new ColorUIResource(Color.decode("#005C5C"))));
defaults.add("TaskPane.specialTitleBackground", new ColorUIResource(menuBackground.darker()));
defaults.add("TaskPane.titleBackgroundGradientStart", menuBackground);
defaults.add("TaskPane.titleBackgroundGradientEnd", menuBackground);
defaults.add("TaskPane.titleForeground", new ColorUIResource(SystemColor.menuText));
defaults.add("TaskPane.specialTitleForeground", new ColorUIResource(SystemColor.menuText.brighter()));
defaults.add("TaskPane.animate", Boolean.TRUE);
defaults.add("TaskPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
"ENTER", "toggleCollapsed",
"SPACE", "toggleCollapsed"}));
}
CachePane.java 文件源码
项目:icedtea-web
阅读 24
收藏 0
点赞 0
评论 0
public void restoreDisabled() {
cleanAll.setEnabled(true);
// If nothing selected then keep deleteButton disabled
if (!cacheTable.getSelectionModel().isSelectionEmpty()) {
deleteButton.setEnabled(true);
}
// Enable buttons
refreshButton.setEnabled(true);
doneButton.setEnabled(true);
// If cacheTable is empty disable it and set background
// color to indicate being disabled
if (cacheTable.getModel().getRowCount() == 0) {
cacheTable.setEnabled(false);
cacheTable.setBackground(SystemColor.control);
}
// Reset cursor
parent.getContentPane().setCursor(Cursor.getDefaultCursor());
}
ColoredProgressBar.java 文件源码
项目:dsworkbench
阅读 22
收藏 0
点赞 0
评论 0
public ColoredProgressBar(int start, int end) {
setMinimum(start);
setMaximum(end);
setForeground(SystemColor.window);
setBackground(SystemColor.window);
setBorder(new EmptyBorder(3, 5, 3, 5));
Dimension size = new Dimension(300, 20);
setPreferredSize(size);
setMaximumSize(size);
setMinimumSize(size);
BasicProgressBarUI ui = new BasicProgressBarUI() {
protected Color getSelectionForeground() {
return Color.BLACK;
}
protected Color getSelectionBackground() {
return Color.BLACK;
}
};
setUI(ui);
}
TableTreeCellRenderer.java 文件源码
项目:typecast
阅读 15
收藏 0
点赞 0
评论 0
public void paint(Graphics g) {
if (_selected) {
g.setColor(SystemColor.textHighlight);
} else if(getParent() != null) {
g.setColor(getParent().getBackground());
} else {
g.setColor(getBackground());
}
Icon icon = getIcon();
int offset = 0;
if (icon != null && getText() != null) {
offset = icon.getIconWidth() + getIconTextGap();
}
g.fillRect(offset, 0, getWidth() - 1 - offset, getHeight() - 1);
super.paint(g);
}
Preview.java 文件源码
项目:AtidDesktop
阅读 25
收藏 0
点赞 0
评论 0
@Override
protected void paintComponent(Graphics g) {
if (thumbnail == null) {
loadImage();
}
if (thumbnail != null) {
setBackground(Color.white);
super.paintComponent(g);
int x = getWidth() / 2 - thumbnail.getIconWidth() / 2;
int y = getHeight() / 2 - thumbnail.getIconHeight() / 2;
if (y < 0) {
y = 0;
}
if (x < 0) {
x = 0;
}
thumbnail.paintIcon(this, g, x, y);
} else {
setBackground(SystemColor.control);
super.paintComponent(g);
}
}
TipUtil.java 文件源码
项目:ESPlorer
阅读 17
收藏 0
点赞 0
评论 0
/**
* Returns the default background color to use for tool tip windows.
*
* @return The default background color.
*/
public static Color getToolTipBackground() {
Color c = UIManager.getColor("ToolTip.background");
// Tooltip.background is wrong color on Nimbus (!)
boolean isNimbus = isNimbusLookAndFeel();
if (c==null || isNimbus) {
c = UIManager.getColor("info"); // Used by Nimbus (and others)
if (c==null || (isNimbus && isDerivedColor(c))) {
c = SystemColor.info; // System default
}
}
// Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
// with a ColorUIResource does nothing, must be a normal Color
if (c instanceof ColorUIResource) {
c = new Color(c.getRGB());
}
return c;
}
FastListUI.java 文件源码
项目:ESPlorer
阅读 14
收藏 0
点赞 0
评论 0
private Color determineSelectionBackground() {
Color c = UIManager.getColor("List.selectionBackground");
if (c==null) {
c = UIManager.getColor("nimbusSelectionBackground");
if (c==null) { // Not Nimbus, but still need a value - fallback
c = UIManager.getColor("textHighlight");
if (c==null) {
c = SystemColor.textHighlight;
}
}
}
// Nimbus unfortunately requires a Color, not a ColorUIResource, for
// the background override to work. This causes this color to "stick"
// even if the LAF is changed to something else later. "c" here may
// actually be a ColorUIResource
return new Color(c.getRGB());//new ColorUIResource(c);
}
TipUtil.java 文件源码
项目:ESPlorer
阅读 16
收藏 0
点赞 0
评论 0
/**
* Returns the default background color to use for tool tip windows.
*
* @return The default background color.
*/
public static Color getToolTipBackground() {
Color c = UIManager.getColor("ToolTip.background");
// Tooltip.background is wrong color on Nimbus (!)
boolean isNimbus = isNimbusLookAndFeel();
if (c==null || isNimbus) {
c = UIManager.getColor("info"); // Used by Nimbus (and others)
if (c==null || (isNimbus && isDerivedColor(c))) {
c = SystemColor.info; // System default
}
}
// Workaround for a bug (?) with Nimbus - calling JLabel.setBackground()
// with a ColorUIResource does nothing, must be a normal Color
if (c instanceof ColorUIResource) {
c = new Color(c.getRGB());
}
return c;
}
InfoPanel.java 文件源码
项目:jplag
阅读 25
收藏 0
点赞 0
评论 0
/**
* This method initializes jTopPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJTopPanel() {
if (jTopPanel == null) {
jTopPanel = new JPanel();
CompoundBorder border = BorderFactory.createCompoundBorder(
BorderFactory.createCompoundBorder(
BorderFactory.createLineBorder(SystemColor.activeCaption,2),
JPlagCreator.titleBorder(Messages.getString(
"InfoPanel.JPlag_progress"))), //$NON-NLS-1$
BorderFactory.createEmptyBorder(0,2,2,2));
jTopPanel.setBorder(border);
Insets insets = border.getBorderInsets(jTopPanel);
jTopPanel.setPreferredSize(
new java.awt.Dimension(490+insets.left+insets.right, 194));
jTopPanel.setLayout(new BorderLayout());
jTopPanel.add(getJPanel2(), java.awt.BorderLayout.NORTH);
jTopPanel.add(getJProgressBar(), java.awt.BorderLayout.EAST);
}
return jTopPanel;
}
TaskPaneAddon.java 文件源码
项目:aibench-project
阅读 19
收藏 0
点赞 0
评论 0
@Override
protected void addBasicDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
Font taskPaneFont = UIManagerExt.getSafeFont("Label.font", new Font(
"Dialog", Font.PLAIN, 12));
taskPaneFont = taskPaneFont.deriveFont(Font.BOLD);
Color menuBackground = new ColorUIResource(SystemColor.menu);
defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.basic.BasicTaskPaneUI");
defaults.add("TaskPane.font", new FontUIResource(taskPaneFont));
defaults.add("TaskPane.background", UIManagerExt.getSafeColor("List.background",
new ColorUIResource(Color.decode("#005C5C"))));
defaults.add("TaskPane.specialTitleBackground", new ColorUIResource(menuBackground.darker()));
defaults.add("TaskPane.titleBackgroundGradientStart", menuBackground);
defaults.add("TaskPane.titleBackgroundGradientEnd", menuBackground);
defaults.add("TaskPane.titleForeground", new ColorUIResource(SystemColor.menuText));
defaults.add("TaskPane.specialTitleForeground", new ColorUIResource(SystemColor.menuText.brighter()));
defaults.add("TaskPane.animate", Boolean.TRUE);
defaults.add("TaskPane.focusInputMap", new UIDefaults.LazyInputMap(new Object[] {
"ENTER", "toggleExpanded",
"SPACE", "toggleExpanded"}));
}
ReportViewComponent.java 文件源码
项目:incubator-taverna-workbench
阅读 16
收藏 0
点赞 0
评论 0
private JPanel wrapComponent(JComponent c) {
JPanel result = new JPanel(new GridBagLayout());
GridBagConstraints gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.anchor = GridBagConstraints.NORTHWEST;
gbc.fill = GridBagConstraints.HORIZONTAL;
gbc.gridwidth = 2;
gbc.weightx = 0.9;
gbc.insets = rightGap;
result.add(c, gbc);
c.setBackground(SystemColor.text);
gbc.weightx = 0.9;
gbc.weighty = 0.9;
gbc.gridx = 0;
gbc.gridy++;
gbc.gridwidth = 2;
gbc.fill = GridBagConstraints.BOTH;
JPanel filler = new JPanel();
filler.setBackground(SystemColor.text);
result.setBackground(SystemColor.text);
result.add(filler, gbc);
return result;
}
ToolBarButton.java 文件源码
项目:S3F
阅读 23
收藏 0
点赞 0
评论 0
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
// g.clearRect(29, 0, 55, 35);
g.setColor((mouseOver || button.isSelected())
// ? SystemColor.controlDkShadow
// : SystemColor.activeCaptionBorder);
? SystemColor.activeCaptionBorder
: SystemColor.control);
g.drawLine(29, 7, 29, 27);
if (ToolBarButton.this.actionListener != null) {
// g.setColor(SystemColor.activeCaptionBorder);
g.setColor(SystemColor.controlDkShadow);
}
int x = 24 + 13;
int y = this.getHeight() / 2 + 1;
int aw = 4;
int ah = 2;
g.fillPolygon(new int[]{x - aw, x + aw, x}, new int[]{y - ah, y - ah, y + ah}, 3);
}
View2D.java 文件源码
项目:energy2d
阅读 15
收藏 0
点赞 0
评论 0
private void showTipPopupMenu(String msg, int x, int y, int time) {
if (tipPopupMenu == null) {
tipPopupMenu = new JPopupMenu("Tip");
tipPopupMenu.setBorder(BorderFactory.createLineBorder(Color.black));
tipPopupMenu.setBackground(SystemColor.info);
JLabel l = new JLabel(msg);
l.setFont(new Font(null, Font.PLAIN, 10));
l.setBorder(BorderFactory.createEmptyBorder(2, 4, 2, 4));
tipPopupMenu.add(l);
} else {
((JLabel) tipPopupMenu.getComponent(0)).setText(msg);
}
tipPopupMenu.show(this, x, y);
if (time > 0) {
Timer timer = new Timer(time, new ActionListener() {
public void actionPerformed(ActionEvent e) {
tipPopupMenu.setVisible(false);
}
});
timer.setRepeats(false);
timer.setInitialDelay(time);
timer.start();
}
}
WinTextComponent.java 文件源码
项目:cn1
阅读 16
收藏 0
点赞 0
评论 0
public static void drawBackground(Graphics g, TextComponentState s,
WinTheme t) {
Color c = (s.isEnabled() ? s.getBackground() : SystemColor.control);
WinThemeGraphics wgr = new WinThemeGraphics(g);
if (t.isXpThemeActive()) {
wgr.setTheme(t.getXpTheme("Edit")); //$NON-NLS-1$
int flags = (s.isEnabled() ? WindowsConsts.ETS_NORMAL :
WindowsConsts.ETS_DISABLED);
wgr.drawXpBackground(s.getSize(),
WindowsConsts.EP_EDITTEXT, flags);
if (s.isEnabled() && s.isBackgroundSet()) {
fill(s, c, wgr);
}
} else {
g.setColor(c);
fill(s, c, wgr);
wgr.drawEdge(s.getSize(), WindowsDefs.EDGE_SUNKEN);
}
wgr.dispose();
}
AWTHighlighter.java 文件源码
项目:cn1
阅读 49
收藏 0
点赞 0
评论 0
public void paintLayeredHighlights(final Graphics g, final int p0,
final int p1, final Shape viewBounds,
final View view) {
if (start == null || end == null) {
return;
}
int startOffset = getStartOffset();
int endOffset = getEndOffset();
if (endOffset > getDocumentLength() || startOffset > p1
|| endOffset < p0) {
return;
}
TextUtils.paintLayer(g, Math.max(p0, startOffset),
Math.min(p1, endOffset), viewBounds,
SystemColor.textHighlight, view, true);
}
DefaultChoice.java 文件源码
项目:cn1
阅读 17
收藏 0
点赞 0
评论 0
public static Rectangle drawButton(Graphics g, ChoiceState s) {
Dimension size = s.getSize();
Rectangle buttonRect = getButtonRect(size);
int dx = buttonRect.x;
int dy = buttonRect.y;
g.translate(dx, dy);
g.setColor(SystemColor.control);
int buttonWidth = buttonRect.width;
int buttonHeight = buttonRect.height;
g.fillRect(0, 0, buttonWidth, buttonHeight);
DefaultScrollbar.paintArrowButton(g, DefaultScrollbar.SOUTH,
buttonWidth,
buttonHeight,
s.isPressed(), s.isEnabled());
g.translate(-dx, -dy);
return buttonRect;
}