List of usage examples for javax.swing UIManager getColor
public static Color getColor(Object key)
From source file:com.github.alexfalappa.nbspringboot.cfgprops.completion.CfgPropValueCompletionItem.java
@Override public void render(Graphics g, Font defaultFont, Color defaultColor, Color backgroundColor, int width, int height, boolean selected) { CompletionUtilities.renderHtml(fieldIcon, getText(), getTextRight(), g, defaultFont, (selected ? UIManager.getColor("List.selectionForeground") : UIManager.getColor("List.foreground")), width, height, selected);// w w w . j a v a 2 s .co m }
From source file:dk.dma.epd.common.prototype.gui.voct.VOCTAdditionalInfoPanel.java
/** * Constructor//ww w. j a v a2 s . c o m * * @param compactLayout * if false, there will be message type selectors in the panel */ public VOCTAdditionalInfoPanel(boolean compactLayout) { super(new BorderLayout()); EPD.getInstance().getVoctHandler().addVoctSarInfoListener(this); // Prepare the title header titleHeader.setBackground(getBackground().darker()); titleHeader.setOpaque(true); titleHeader.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2)); titleHeader.setHorizontalAlignment(SwingConstants.CENTER); add(titleHeader, BorderLayout.NORTH); // Add messages panel scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); messagesPanel.setBackground(UIManager.getColor("List.background")); messagesPanel.setOpaque(false); messagesPanel.setLayout(new GridBagLayout()); messagesPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); add(scrollPane, BorderLayout.CENTER); JPanel sendPanel = new JPanel(new GridBagLayout()); add(sendPanel, BorderLayout.SOUTH); Insets insets = new Insets(2, 2, 2, 2); // Add text area // if (false) { // messageText = new JTextField(); // ((JTextField) messageText).addActionListener(this); // sendPanel.add(messageText, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); // // } else { messageText = new JTextArea(); JScrollPane scrollPane2 = new JScrollPane(messageText); scrollPane2.setPreferredSize(new Dimension(100, 50)); scrollPane2.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane2.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); sendPanel.add(scrollPane2, new GridBagConstraints(0, 0, 1, 2, 1.0, 1.0, NORTH, BOTH, insets, 0, 0)); // } // Add buttons // ButtonGroup group = new ButtonGroup(); if (!compactLayout) { JToolBar msgTypePanel = new JToolBar(); msgTypePanel.setBorderPainted(false); msgTypePanel.setOpaque(true); msgTypePanel.setFloatable(false); sendPanel.add(msgTypePanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } if (compactLayout) { addBtn = new JButton("Add to Log"); sendPanel.add(addBtn, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, NORTH, NONE, insets, 0, 0)); } // addBtn.setEnabled(false); // messageText.setEditable(false); addBtn.addActionListener(this); }
From source file:dk.dma.epd.common.prototype.notification.StrategicRouteNotificationDetailPanelCommon.java
/** * {@inheritDoc}// ww w.j av a2 s.co m */ @Override protected void buildGUI() { setLayout(new GridBagLayout()); setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); // Create the transaction and status labels Insets insets5 = new Insets(5, 5, 5, 5); add(bold(new JLabel("Transaction ID:")), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); add(transactionTxt, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); add(bold(new JLabel("Latest status:")), new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, WEST, NONE, insets5, 0, 0)); add(statusTxt, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); // Create the info panel JPanel infoPanel = createInfoPanel(); add(infoPanel, new GridBagConstraints(0, 2, 2, 1, 1.0, 0.0, WEST, HORIZONTAL, insets5, 0, 0)); // Create the messages panel JScrollPane scrollPane = new JScrollPane(messagesPanel); scrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPane.setBorder(new MatteBorder(1, 1, 1, 1, UIManager.getColor("Separator.shadow"))); messagesPanel.setBackground(UIManager.getColor("List.background")); add(scrollPane, new GridBagConstraints(0, 3, 2, 1, 1.0, 1.0, WEST, BOTH, insets5, 0, 0)); }
From source file:com.mirth.connect.client.ui.components.rsta.ac.js.MirthJavaScriptCellRenderer.java
private String createParamColor() { Color foreground = UIManager.getColor("Label.foreground"); if (foreground == null) { foreground = new JLabel().getForeground(); }// w ww . j a v a 2s.com Color hyperlinkForeground = Util.isLightForeground(foreground) ? new Color(0xd8ffff) : Color.BLUE; return Util.isLightForeground(getForeground()) ? Util.getHexString(hyperlinkForeground) : "#AA0077"; }
From source file:ArrowIcon.java
protected Image getArrowImage() { if (arrowImage == null) { arrowImage = createTranslucentImage(size, size); AffineTransform atx = direction != SOUTH ? new AffineTransform() : null; switch (direction) { case NORTH: atx.setToRotation(Math.PI, size / 2, size / 2); break; case EAST: atx.setToRotation(-(Math.PI / 2), size / 2, size / 2); break; case WEST: atx.setToRotation(Math.PI / 2, size / 2, size / 2); case SOUTH: default: { /* no xform*/ } }//from w ww. j a v a2 s . co m Graphics2D ig = (Graphics2D) arrowImage.getGraphics(); if (atx != null) { ig.setTransform(atx); } int width = size; int height = size / 2 + 1; int xx = (size - width) / 2; int yy = (size - height + 1) / 2; Color base = color != null ? color : UIManager.getColor("controlDkShadow").darker(); paintArrow(ig, base, xx, yy); paintArrowBevel(ig, base, xx, yy); paintArrowBevel(ig, deriveColorHSB(base, 0f, 0f, .20f), xx, yy + 1); } return arrowImage; }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.Utils.java
public static Color getTreeTextBackground() { return UIManager.getColor("Tree.textBackground"); }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.Utils.java
public static Color getListForeground(final boolean selected) { if (selected) { final Color color = UIManager.getColor("List.selectionForeground"); if (color == null) { return UIManager.getColor("List[Selected].textForeground"); // Nimbus }/*from w ww. j a v a2 s. c om*/ return color; } else { return UIManager.getColor("List.foreground"); } }
From source file:org.sbml.bargraph.MainWindow.java
/** * Creates the main application frame.//w ww. jav a 2 s. c om * * @param file A file to read and graph upon start up. If null, nothing * is graphed initially. */ public MainWindow(File file) { Log.note("Creating main application window."); setPlatformProperties(); setBackground(new Color(255, 255, 255)); setMaximumSize(new Dimension(2000, 1000)); setMinimumSize(new Dimension(600, 400)); setTitle("SBML Bar Graph"); setSize(new Dimension(600, 400)); setPreferredSize(new Dimension(600, 400)); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setBounds(100, 100, 550, 400); contentPane = new JPanel(); contentPane.setSize(new Dimension(600, 400)); contentPane.setPreferredSize(new Dimension(600, 400)); contentPane.setMinimumSize(new Dimension(600, 400)); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); contentPane.setLayout(new BorderLayout(0, 0)); setContentPane(contentPane); fileNamePanel = new JPanel(); fileNamePanel.setPreferredSize(new Dimension(590, 20)); fileNamePanel.setMinimumSize(new Dimension(590, 20)); fileNamePanel.setLayout(new BorderLayout(0, 0)); contentPane.add(fileNamePanel, BorderLayout.NORTH); fileNameField = new JTextField(); fileNameField.setHorizontalAlignment(SwingConstants.CENTER); fileNameField.setText("No file selected"); fileNameField.setDisabledTextColor(Color.LIGHT_GRAY); fileNameField.setFont(new Font("Lucida Grande", Font.ITALIC, 11)); fileNameField.setBorder(null); fileNameField.setOpaque(true); fileNameField.setBackground(UIManager.getColor("Separator.foreground")); fileNameField.setEnabled(false); fileNameField.setSize(new Dimension(590, 0)); fileNameField.setPreferredSize(new Dimension(590, 28)); fileNameField.setMinimumSize(new Dimension(590, 28)); fileNameField.setColumns(10); fileNamePanel.add(fileNameField, BorderLayout.CENTER); // The bar graph panel. chartPanel = new ChartPanel(createModelBarGraph(), false); contentPane.add(chartPanel, BorderLayout.CENTER); updatePanelForSBMLFile(file); // Manual additions for File menu. fileMenu = new JMenu(); fileMenu.setText("File"); openFileMenuItem = new JMenuItem(); openFileMenuItem .setAccelerator(javax.swing.KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_O, shortcutKeyMask)); openFileMenuItem.setText("Open..."); openFileMenuItem.setToolTipText("Open file to be graphed"); openFileMenuItem.addActionListener(new java.awt.event.ActionListener() { @Override public void actionPerformed(java.awt.event.ActionEvent evt) { openFileHandler(evt); } }); fileMenu.add(openFileMenuItem); menuBar = new javax.swing.JMenuBar(); menuBar.add(fileMenu); setJMenuBar(menuBar); // Replace the default Java window icon with our own. // This only has an effect on non-Mac OS systems. URL iconImageURL = getClass().getResource(Config.RES_ICON_APP); Toolkit toolkit = Toolkit.getDefaultToolkit(); Image img = toolkit.createImage(iconImageURL); setIconImage(img); Log.note("Finished constructing panel and menu bar"); }
From source file:com.emr.schemas.ButtonColumn.java
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { if (isSelected) { renderButton.setForeground(table.getSelectionForeground()); renderButton.setBackground(table.getSelectionBackground()); } else {// w w w .jav a2 s . co m renderButton.setForeground(table.getForeground()); renderButton.setBackground(UIManager.getColor("Button.background")); } if (hasFocus) { renderButton.setBorder(focusBorder); } else { renderButton.setBorder(originalBorder); } // renderButton.setText( (value == null) ? "" : value.toString() ); renderButton.setText(btnText); return renderButton; }
From source file:com.igormaznitsa.jhexed.swing.editor.ui.Utils.java
public static Color getListBackground(final boolean selected) { if (selected) { if (isUnderNimbusLookAndFeel()) { return UIManager.getColor("List[Selected].textBackground"); // Nimbus }/*from w w w .ja v a 2 s .c o m*/ return UIManager.getColor("List.selectionBackground"); } else { if (isUnderNimbusLookAndFeel()) { final Color color = UIManager.getColor("List.background"); //noinspection UseJBColor return new Color(color.getRed(), color.getGreen(), color.getBlue(), color.getAlpha()); } // Under GTK+ L&F "Table.background" often has main panel color, which looks ugly return isUnderGTKLookAndFeel() ? getTreeTextBackground() : UIManager.getColor("List.background"); } }