List of usage examples for javax.swing JPanel getForeground
@Transient
public Color getForeground()
From source file:org.trzcinka.intellitrac.view.toolwindow.tickets.ticket_editor.AttachmentsListCellRenderer.java
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { if (!(value instanceof Attachment)) { throw new IllegalArgumentException( "AttachmentsListCellRenderer may render only Attachments, not " + value.getClass().getName()); }//from w w w .ja va 2 s .co m Attachment attachment = (Attachment) value; final JPanel panel = new JPanel(new FlowLayout(FlowLayout.LEFT)); ListCellRendererUtils.applyDefaultDisplaySettings(list, index, isSelected, cellHasFocus, panel); JLabel fileName = new JLabel(attachment.getFileName()); fileName.setForeground(panel.getForeground()); panel.add(fileName); String additionalTextString = MessageFormat.format( BundleLocator.getBundle() .getString("tool_window.tickets.ticket_editor.attachments.attachment_info"), FileUtils.byteCountToDisplaySize(attachment.getSize()), attachment.getAuthor()); JLabel additionalText = new JLabel(additionalTextString); additionalText.setForeground(panel.getForeground()); panel.add(additionalText); return panel; }