本文整理匯總了Java中java.awt.SystemColor類的典型用法代碼示例。如果您正苦於以下問題:Java SystemColor類的具體用法?Java SystemColor怎麽用?Java SystemColor使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
SystemColor類屬於java.awt包,在下文中一共展示了SystemColor類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getListCellRendererComponent
import java.awt.SystemColor; //導入依賴的package包/類
@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;
}
示例2: determineSelectionBackground
import java.awt.SystemColor; //導入依賴的package包/類
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);
}
示例3: enabledCheckBoxActionPerformed
import java.awt.SystemColor; //導入依賴的package包/類
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);
}
示例4: About
import java.awt.SystemColor; //導入依賴的package包/類
/**
* Create the frame.
*/
public About() {
ImageIcon img = new ImageIcon("icon.PNG");
this.setIconImage(img.getImage());
this.setTitle("About");
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setBounds(100, 100, 705, 335);
contentPane = new JPanel();
contentPane.setBackground(SystemColor.activeCaptionBorder);
contentPane.setToolTipText("erh");
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
setContentPane(contentPane);
contentPane.setLayout(null);
JTextPane txtpnByIkerGarca = new JTextPane();
txtpnByIkerGarca.setBackground(SystemColor.menu);
txtpnByIkerGarca.setEditable(false);
txtpnByIkerGarca.setText("By: Iker Garc\u00EDa Ferrero\r\nDate: 03/01/2017\r\n\r\n--Contact--\r\nMail: [email protected] \r\n\r\nThe source code can be found here:\r\nhttps://github.com/ikergarcia1996/Simple-AI_Ikerg-app_INTELLIGENT_POINTS\r\n\r\nA demostration and explanation can be found here (Spanish):\r\nhttps://www.youtube.com/hardware360grados\r\n\r\nThis program uses Processing 3.2.3\r\n\r\nCopyright 2017 Iker Garc\u00EDa \"Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)\" ");
txtpnByIkerGarca.setToolTipText("");
txtpnByIkerGarca.setBounds(12, 13, 664, 262);
contentPane.add(txtpnByIkerGarca);
}
示例5: createBorderPanel
import java.awt.SystemColor; //導入依賴的package包/類
/**
* 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;
}
示例6: initialize
import java.awt.SystemColor; //導入依賴的package包/類
@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);
}
}
示例7: initialize
import java.awt.SystemColor; //導入依賴的package包/類
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame("Library Book Loan System - My Books and Reservations");
frame.setResizable(false);
frame.setBounds(100, 100, 700, 400);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().setLayout(null);
JLabel label = new JLabel("Library Book Loan System");
label.setHorizontalAlignment(SwingConstants.CENTER);
label.setFont(new Font("Segoe UI Light", Font.PLAIN, 18));
label.setBounds(10, 11, 674, 30);
frame.getContentPane().add(label);
JLabel lblBookReservations = new JLabel("My Books and Reservations");
lblBookReservations.setHorizontalAlignment(SwingConstants.CENTER);
lblBookReservations.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
lblBookReservations.setBounds(10, 42, 674, 22);
frame.getContentPane().add(lblBookReservations);
JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
tabbedPane.setBackground(SystemColor.text);
tabbedPane.setBounds(10, 75, 674, 228);
frame.getContentPane().add(tabbedPane);
initializeCurrentBooks(tabbedPane);
initializeWaitlist(tabbedPane);
initializeHistory(tabbedPane);
frame.setVisible(true);
}
示例8: CameraMonitor
import java.awt.SystemColor; //導入依賴的package包/類
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);
}
示例9: paint
import java.awt.SystemColor; //導入依賴的package包/類
@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);
}
}
示例10: getToolTipBackground
import java.awt.SystemColor; //導入依賴的package包/類
/**
* 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;
}
示例11: ruleNumberEvent
import java.awt.SystemColor; //導入依賴的package包/類
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);
}
}
示例12: getToolTipBackground
import java.awt.SystemColor; //導入依賴的package包/類
/**
* 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;
}
示例13: addBasicDefaults
import java.awt.SystemColor; //導入依賴的package包/類
@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"}));
}
示例14: restoreDisabled
import java.awt.SystemColor; //導入依賴的package包/類
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());
}
示例15: ColoredProgressBar
import java.awt.SystemColor; //導入依賴的package包/類
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);
}