Java Code Examples for javax.swing.JLabel.setBackground()

The following are Jave code examples for showing how to use setBackground() of the javax.swing.JLabel class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: hearthstone   File: HeroiView.java   View Source Code Vote up 6 votes
private void init() {
    setBackground(new Color(0, 0, 0, 0));
    setOpaque(false);
    JLabel modelo = new JLabel() {
        @Override
        public String toString() {
            return hero.getToString();
        }
    };
    modelo.setBackground(new Color(0, 0, 0, 0));
    modelo.setHorizontalAlignment(SwingConstants.CENTER);
    modelo.setIcon(Images.ARENA_HEROI);
    add(hero.getPanelHeroi(), AbsolutesConstraints.HEROI_PANEL_IMAGEM, 0);
    add(modelo, AbsolutesConstraints.ZERO, 0);
    add(hero.getPanelAtaque(), AbsolutesConstraints.HEROI_PANEL_ATAQUE, 0);
    add(hero.getPanelEscudo(), AbsolutesConstraints.HEROI_PANEL_SHIELD, 0);
    add(hero.getPanelVida(), AbsolutesConstraints.HEROI_PANEL_VIDA, 0);
    add(hero.getPanelPoder(), AbsolutesConstraints.HEROI_PANEL_PODER, 0);
    add(hero.getPanelArma(), AbsolutesConstraints.HEROI_PANEL_ARMA, 0);
    add(hero.getPanelSegredo(), AbsolutesConstraints.HEROI_PANEL_SEGREDO, 0);
    add(hero.getPanelDanoMagico(), AbsolutesConstraints.HEROI_PANEL_DANO_MAGICO, 0);
}
 
Example 2
Project: incubator-netbeans   File: SummaryCellRenderer.java   View Source Code Vote up 6 votes
@Override
public Component getListCellRendererComponent (JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    Action[] actions = ((AbstractSummaryView.ActionsItem) value).getParent().getUserData().getActions();
    id = ((AbstractSummaryView.ActionsItem) value).getItemId();
    removeAll();
    labels = new HashMap<Component, Action>(actions.length);
    Component comp = dlcr.getListCellRendererComponent(list, "<html><a href=\"action\">ACTION_NAME</a>", index, isSelected, cellHasFocus); //NOI18N
    setBackground(comp.getBackground());
    for (Action a : actions) {
        JLabel label = getLabelFor((String) a.getValue(Action.NAME), isSelected ? comp.getForeground() : LINK_COLOR);
        label.setForeground(comp.getForeground());
        label.setBackground(comp.getBackground());
        label.setBorder(BorderFactory.createEmptyBorder());
        labels.put(label, a);
        add(label);
    }
    if (linkerSupport.getLinker(ActionHyperlink.class, id) == null) {
        linkerSupport.add(new ActionHyperlink(), id);
    }
    return this;
}
 
Example 3
Project: incubator-netbeans   File: InitPanel.java   View Source Code Vote up 6 votes
protected void initComponents() {        
    if (!oPanel.isPrepared()) {
        initComponent = new JLabel(NbBundle.getMessage(InitPanel.class, "LBL_computing")); // NOI18N
        initComponent.setPreferredSize(new Dimension(850, 450));
        // avoid flicking ?
        Color c = UIManager.getColor("Tree.background"); // NOI18N
        if (c == null) {
            //GTK 1.4.2 will return null for Tree.background
            c = Color.WHITE;
        }
        initComponent.setBackground(c);    // NOI18N               
        initComponent.setHorizontalAlignment(SwingConstants.CENTER);
        initComponent.setOpaque(true);
        
        CardLayout card = new CardLayout();
        setLayout(card);            
        add(initComponent, "init");    // NOI18N
        card.show(this, "init"); // NOI18N        
        Utilities.attachInitJob(this, this);
    } else {
        finished();  
    }
}
 
Example 4
Project: OpenDA   File: Query.java   View Source Code Vote up 6 votes
/** Create a choice menu.
 *  @param name The name used to identify the entry (when calling get).
 *  @param label The label to attach to the entry.
 *  @param values The list of possible choices.
 *  @param defaultChoice Default choice.
 *  @param editable True if an arbitrary choice can be entered, in addition
 *   to the choices in values.
 *  @param background The background color for the editable part.
 */
public void addChoice(
        String name,
        String label,
        String[] values,
        String defaultChoice,
        boolean editable,
        Color background) {
    JLabel lbl = new JLabel(label + ": ");
    lbl.setBackground(_background);
    JComboBox combobox = new JComboBox(values);
    combobox.setEditable(editable);
    // FIXME: Typical of Swing, the following does not set
    // the background color.  How does one set the background
    // color?
    combobox.setBackground(background);
    combobox.setSelectedItem(defaultChoice);
    _addPair(name, lbl, combobox, combobox);
    // Add the listener last so that there is no notification
    // of the first value.
    combobox.addItemListener(new QueryItemListener(name));
}
 
Example 5
Project: rapidminer   File: ParameterErrorInfoBubble.java   View Source Code Vote up 6 votes
/**
 * Decorates the given parameter editor panel with a "mandatory parameter" hint.
 *
 * @param parameterEditor
 *            the parameter editor panel
 * @return the decorated panel
 */
private JPanel decorateParameterPanel(final JPanel parameterEditor) {
	JPanel parentPanel = new JPanel(new GridBagLayout());
	GridBagConstraints gbc = new GridBagConstraints();
	gbc.gridx = 0;
	gbc.gridy = 0;
	gbc.weightx = 1.0;
	gbc.weighty = 1.0;
	gbc.fill = GridBagConstraints.BOTH;
	parentPanel.add(parameterEditor, gbc);

	JLabel warningLabel = new JLabel(I18N.getGUIMessage("gui.bubble." + decorateI18N + ".label"));
	boolean isError = getStyle() == BubbleStyle.ERROR;
	warningLabel.setIcon(isError ? ERROR_ICON : WARNING_ICON);
	warningLabel.setBackground(isError ? BubbleStyle.ERROR.getColor() : BubbleStyle.WARNING.getColor());
	warningLabel.setOpaque(true);
	warningLabel.setBorder(new EmptyBorder(1, 1, 1, 0));
	gbc.gridy += 1;
	gbc.weighty = 0.0;
	gbc.fill = GridBagConstraints.HORIZONTAL;
	gbc.insets = new Insets(2, 0, 0, 0);
	parentPanel.add(warningLabel, gbc);

	return parentPanel;
}
 
Example 6
Project: litiengine   File: JCheckBoxList.java   View Source Code Vote up 5 votes
@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;
}
 
Example 7
Project: VISNode   File: AboutVISNodePanel.java   View Source Code Vote up 5 votes
/**
     * Builds the tool information
     *
     * @return JComponent
     */
    private JComponent buildInfo() {
        JPanel info = new JPanel();
        info.setLayout(new BoxLayout(info, BoxLayout.Y_AXIS));
        JLabel title = new JLabel("VISNode");
        title.setFont(new Font("Segoe UI", Font.PLAIN, 32));
        JLabel version = new JLabel(VERSION);
        version.setBackground(Color.red);
        
//        github = new JButton();
//        github.setIcon(IconFactory.get().create("fa:github"));
//        github.setText(GITHUB_URL);
//        github.setBorder(BorderFactory.createEmptyBorder());
//        github.setBorderPainted(false);
//        github.setContentAreaFilled(false);
//        github.setFocusPainted(false);
//        github.setOpaque(false);
        info.add(title);
        info.add(version);
        info.add(Labels.create(GITHUB_URL).icon(IconFactory.get().create("fa:github")).onClick((ev) -> {
            try {
                Desktop.getDesktop().browse(new URL(GITHUB_URL).toURI());
            } catch (IOException | URISyntaxException e) {
                ExceptionHandler.get().handle(e);
            }
        }));
        return info;
    }
 
Example 8
Project: cuttlefish   File: GroupPanel.java   View Source Code Vote up 5 votes
/**
 * This method initializes this with the default user interface options
 * @return void
 */
private void initialize() {
	jLabel = new JLabel();
	jLabel.setText("JLabel");
	jLabel.setBackground(Color.gray);
	jLabel.setForeground(highlightColor);
	jLabel.setHorizontalAlignment(SwingConstants.CENTER);
	this.setSize(300, 200);
	this.setLayout(new BorderLayout());
	this.setBorder(BorderFactory.createLineBorder(Color.gray, 1));
	this.add(getLabelPanel(), BorderLayout.SOUTH);
	this.add(getContentPanel(), BorderLayout.CENTER);
}
 
Example 9
Project: EspressoViews   File: WarningMessage.java   View Source Code Vote up 5 votes
public WarningMessage(String ErrMessage) {
	setBounds(100, 100, 650, 500);
	this.getContentPane().setLayout(new BorderLayout());
	{
		JPanel buttonPane = new JPanel();
		buttonPane.setBackground(new Color(144, 238, 144));
		buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
		getContentPane().add(buttonPane, BorderLayout.SOUTH);
		{
			JButton cancelButton = new JButton("OK");
			cancelButton.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					dispose();
				}
			});
			cancelButton.setFont(new Font("Times New Roman", Font.BOLD, 12));
			cancelButton.setHorizontalAlignment(SwingConstants.LEFT);
			buttonPane.add(cancelButton);
		}
	}
	{
		JLabel label = new JLabel("Warning!");
		label.setBackground(new Color(144, 238, 144));
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setForeground(new Color(100, 0, 0));
		label.setFont(new Font("Times New Roman", Font.BOLD, 24));
		getContentPane().add(label, BorderLayout.NORTH);
	}
	{
		JScrollPane scrollPane = new JScrollPane();
		getContentPane().add(scrollPane, BorderLayout.CENTER);
		{
			JTextArea txtErrMessage = new JTextArea();
			txtErrMessage.setText(ErrMessage);
			txtErrMessage.setFont(new Font("Monospaced", Font.PLAIN, 13));
			txtErrMessage.setBackground(new Color(144, 238, 144));
			scrollPane.setViewportView(txtErrMessage);
			txtErrMessage.setCaretPosition(0);
			txtErrMessage.setEditable(false);
		}
	}
}
 
Example 10
Project: EasyDragDrop   File: MainFrame.java   View Source Code Vote up 5 votes
private void DragFileHandle(final JPanel myPanel) {
    new FileDrop(myPanel, new FileDrop.Listener() {
        public void filesDropped(java.io.File[] files) {
            for (int i = 0; i < files.length; i++) {
                Icon ico = FileSystemView.getFileSystemView().getSystemIcon(files[i]);
                FindFiles(myPanel.getName(), files[i]);
                Image image = ((ImageIcon) ico).getImage();
                ImageIcon icon = new ImageIcon(getScaledImage(image, 45, 45));

                myPanel.removeAll();
                myPanel.setLayout(new BoxLayout(myPanel, BoxLayout.Y_AXIS));

                JLabel label = new JLabel();
                label.setIcon(icon);
                label.setAlignmentX(CENTER_ALIGNMENT);

                myPanel.add(Box.createRigidArea(new Dimension(0, 60)));
                myPanel.add(label, BorderLayout.CENTER);

                GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
                JLabel labe2 = new JLabel(files[i].getName(), SwingConstants.CENTER);
                labe2.setBackground(new Color(240, 240, 240));
                labe2.setForeground(new Color(0, 0, 0));
                labe2.setFont(new Font("Segoe UI Light", Font.PLAIN, 14));
                labe2.setAlignmentX(CENTER_ALIGNMENT);

                myPanel.add(labe2, BorderLayout.LINE_START);
            }
        }
    });
}
 
Example 11
Project: knime-activelearning   File: ClassCellRenderer.java   View Source Code Vote up 5 votes
/**
 * {@inheritDoc}
 */
@Override
public Component getTableCellRendererComponent(final JTable table,
        final Object value, final boolean isSelected,
        final boolean hasFocus, final int row, final int column) {
    Object newValue = value;

    if (value instanceof String) {
        if (value.equals(ClassModel.NO_CLASS)) {
            if (m_defaultClassModel.isActive()) {
                newValue = m_defaultClassModel.getStringValue();
            } else {
                newValue = "?"; // Not labeled!
            }
        }

        final JLabel label = new JLabel((String) newValue);

        if (isSelected) {
            label.setForeground(table.getSelectionForeground());
            label.setBackground(table.getSelectionBackground());
            label.setOpaque(true);
        }

        if (hasFocus) {
            label.setBorder(table.getBorder());
        }

        return label;
    }

    return new JLabel("non string");
}
 
Example 12
Project: incubator-netbeans   File: GoToPanel.java   View Source Code Vote up 5 votes
/** Creates new form GoToPanel */
public GoToPanel( ContentProvider contentProvider, boolean multiSelection ) throws IOException {
    this.contentProvider = contentProvider;
    initComponents();
    ((AbstractDocument)nameField.getDocument()).setDocumentFilter(UiUtils.newUserInputFilter());
    containsScrollPane = true;
            
    matchesList.setSelectionMode( multiSelection ? ListSelectionModel.MULTIPLE_INTERVAL_SELECTION : ListSelectionModel.SINGLE_SELECTION);
    //matchesList.setPrototypeCellValue("12345678901234567890123456789012345678901234567890123456789012345678901234567890");        
    matchesList.addListSelectionListener(null);
    
    Color bgColorBrighter = new Color(
                                Math.min(getBackground().getRed() + BRIGHTER_COLOR_COMPONENT, 255),
                                Math.min(getBackground().getGreen() + BRIGHTER_COLOR_COMPONENT, 255),
                                Math.min(getBackground().getBlue() + BRIGHTER_COLOR_COMPONENT, 255)
                        );
    
    messageLabel = new JLabel();
    messageLabel.setBackground(bgColorBrighter);
    messageLabel.setHorizontalAlignment(SwingConstants.CENTER);
    messageLabel.setEnabled(true);
    messageLabel.setText(NbBundle.getMessage(GoToPanel.class, "TXT_NoTypesFound")); // NOI18N
    messageLabel.setFont(matchesList.getFont());
    
    // matchesList.setBackground( bgColorBrighter );
    // matchesScrollPane1.setBackground( bgColorBrighter );
    matchesList.setCellRenderer( contentProvider.getListCellRenderer(
            matchesList,
            caseSensitive.getModel()));
    contentProvider.setListModel( this, null );
    
    PatternListener pl = new PatternListener( this );
    nameField.getDocument().addDocumentListener(pl);
    caseSensitive.setSelected(UiOptions.GoToTypeDialog.getCaseSensitive());
    caseSensitive.addItemListener(pl);
    matchesList.addListSelectionListener(pl);                       

    searchHistory = new SearchHistory(GoToPanel.class, nameField);
}
 
Example 13
Project: GameOfSet   File: InfoPanel.java   View Source Code Vote up 5 votes
private JLabel createPossibleSetsJLabel() {
    JLabel label = new JLabel();
    label.setOpaque(true);
    label.setBackground(Color.gray);
    label.setBorder(new EmptyBorder(10, 10, 10, 10));
    return label;
}
 
Example 14
Project: rapidminer   File: ColorRGBComboBoxCellRenderer.java   View Source Code Vote up 5 votes
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {
	JLabel listCellRendererComponent = (JLabel) defaultRenderer.getListCellRendererComponent(list, value, index,
			isSelected, cellHasFocus);

	listCellRendererComponent.setPreferredSize(new Dimension(50, 20));

	if (!(value instanceof Color)) {
		return listCellRendererComponent;
	}

	listCellRendererComponent.setText("");

	Color color = (Color) value;

	Icon iicon = colorMap.get(color);
	if (iicon == null) {
		colorMap.put(color, createColoredRectangleIcon(color));
		iicon = colorMap.get(color);
	}

	listCellRendererComponent.setIcon(iicon);
	listCellRendererComponent.setBackground(color);

	if (isSelected && index != -1) {
		listCellRendererComponent.setBorder(focusBorder);
	} else {
		listCellRendererComponent.setBorder(noFocusBorder);
	}

	return listCellRendererComponent;
}
 
Example 15
Project: gchisto   File: GUIUtilities.java   View Source Code Vote up 5 votes
/**
 * It creates a new label for inclusion in a table.
 * 
 * @return A new label for inclusion in a table.
 *
 * @see #createJLabelForTable()
 */
static public JLabel createJLabelForTable() {
    JLabel label = new JLabel();
    setPlain(label);
    label.setOpaque(true);
    label.setForeground(TABLE_COMPONENT_FG_COLOR);
    label.setBackground(TABLE_COMPONENT_BG_COLOR);
    return label;
}
 
Example 16
Project: rapidminer   File: PerformanceVectorViewer.java   View Source Code Vote up 5 votes
@Override
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
		boolean cellHasFocus) {
	JLabel listCellRendererComponent = (JLabel) super.getListCellRendererComponent(list,
			value.toString().replace('_', ' '), index, isSelected, cellHasFocus);
	if (!isSelected) {
		listCellRendererComponent.setBackground(Colors.PANEL_BACKGROUND);
	}
	return spacerPanel;
}
 
Example 17
Project: powertext   File: ParameterizedCompletionDescriptionToolTip.java   View Source Code Vote up 5 votes
/**
 * Constructor.
 *
 * @param owner The parent window.
 * @param ac The parent auto-completion.
 * @param pc The completion being described.
 */
public ParameterizedCompletionDescriptionToolTip(Window owner,
		ParameterizedCompletionContext context,
		AutoCompletion ac, ParameterizedCompletion pc) {

	tooltip = new JWindow(owner);

	this.pc = pc;

	descLabel = new JLabel();
	descLabel.setBorder(BorderFactory.createCompoundBorder(
				TipUtil.getToolTipBorder(),
				BorderFactory.createEmptyBorder(2, 5, 2, 5)));
	descLabel.setOpaque(true);
	descLabel.setBackground(TipUtil.getToolTipBackground());
	// It appears that if a JLabel is set as a content pane directly, when
	// using the JDK's opacity API's, it won't paint its background, even
	// if label.setOpaque(true) is called.  You have to have a container
	// underneath it for it to paint its background.  Thus, we embed our
	// label in a parent JPanel to handle this case.
	//tooltip.setContentPane(descLabel);
	JPanel panel = new JPanel(new BorderLayout());
	panel.add(descLabel);
	tooltip.setContentPane(panel);

	// Give apps a chance to decorate us with drop shadows, etc.
	PopupWindowDecorator decorator = PopupWindowDecorator.get();
	if (decorator!=null) {
		decorator.decorate(tooltip);
	}

	updateText(0);

	tooltip.setFocusableWindowState(false);

}
 
Example 18
Project: OpenDA   File: Query.java   View Source Code Vote up 5 votes
/** Create a simple one-line text display, a non-editable value that
 *  is set externally using the setDisplay() method.
 *  @param name The name used to identify the entry (when calling get).
 *  @param label The label to attach to the entry.
 *  @param theValue Default string to display.
 */
public void addDisplay(String name, String label, String theValue) {
    JLabel lbl = new JLabel(label + ": ");
    lbl.setBackground(_background);
    // NOTE: JLabel would be a reasonable choice here, but at
    // least in the current version of swing, JLabel.setText() does
    // not work.
    JTextArea displayField = new JTextArea(theValue, 1, 10);
    displayField.setEditable(false);
    displayField.setBackground(_background);
    _addPair(name, lbl, displayField, displayField);
}
 
Example 19
Project: Neukoelln_SER316   File: JNCalendarCellRenderer.java   View Source Code Vote up 4 votes
public Component getTableCellRendererComponent(
      JTable table,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {
      
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String currentPanel = ((AppFrame)App.getFrame()).workPanel.dailyItemsPanel.getCurrentPanel();

if (d == null) {
          label.setEnabled(false);
	label.setIcon(null);
          label.setBackground(new Color(212, 246, 246));
          return label;
      }
      
if (!isSelected) {
	CalendarDate cpsd = CurrentProject.get().getStartDate();
          CalendarDate cped = CurrentProject.get().getEndDate();
          if (!(((d.after(cpsd)) && (d.before(cped))) || (d.equals(cpsd)) || (d.equals(cped)))) {
		label.setBackground(new Color(212, 246, 246));
		return label;
	}
      }		


label.setHorizontalTextPosition(2);
label.setEnabled(true);



      if (d.equals(CalendarDate.today())) {
          label.setBorder(BorderFactory.createLineBorder(new Color(100, 100, 128)));
      }
      
// set foreground color
if (d.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
          label.setForeground(new Color(255, 0, 0));
      }
else { 		
	label.setForeground(Color.BLACK);
}

// set background color
if (currentPanel == null)
	label.setBackground(Color.WHITE);

else if (currentPanel.equals("TASKS") && (t != null) && 
	(d.inPeriod(t.getStartDate(), t.getEndDate()))) 
		label.setBackground(new Color(212, 246, 246));

else if(currentPanel.equals("NOTES") && 
CurrentProject.getNoteList().getNoteForDate(d) != null) 
			label.setBackground(new Color(212, 246, 246));

else if(currentPanel.equals("EVENTS") && 
(!(EventsManager.getEventsForDate(d).isEmpty()))) 
			label.setBackground(new Color(212, 246, 246));

else if(!isSelected)
	label.setBackground(Color.WHITE);
		
// always display NREvents
if (EventsManager.isNREventsForDate(d))
	label.setIcon(evIcon);
else
	label.setIcon(null);

      return label;
  }
 
Example 20
Project: SER316-Dresden   File: JNCalendarCellRenderer.java   View Source Code Vote up 4 votes
/**
   * Based on panel selected show markings and content related to its 
   * duration in the calendar.
   */
  public Component getTableCellRendererComponent(
      JTable table,
      Object value,
      boolean isSelected,
      boolean hasFocus,
      int row,
      int column) {
  	
JLabel label = (JLabel) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
String currentPanel = ((AppFrame)App.getFrame()).workPanel.dailyItemsPanel.getCurrentPanel();
if (d == null) {
          label.setEnabled(false);
	label.setIcon(null);
          label.setBackground(ColorMap.NULLDAY);
          return label;
      }
      
if (!isSelected) {
	CalendarDate cpsd = CurrentProject.get().getStartDate();
          CalendarDate cped = CurrentProject.get().getEndDate();
          if (!(((d.after(cpsd)) && (d.before(cped))) || (d.equals(cpsd)) || (d.equals(cped)))) {
		label.setBackground(ColorMap.NOPROJECT);
		return label;
	}
      }



label.setHorizontalTextPosition(2);
label.setEnabled(true);



      if (d.equals(CalendarDate.today())) {
          label.setBorder(BorderFactory.createLineBorder(ColorMap.TODAY));
      }
      
// set foreground color
if (d.getCalendar().get(Calendar.DAY_OF_WEEK) == Calendar.SUNDAY) {
          label.setForeground(ColorMap.SUNDAYTEXT);
      }
else { 		
	label.setForeground(ColorMap.DAYTEXT);
}

// set background color
if (currentPanel == null)
	label.setBackground(ColorMap.FREEBG);

else if (currentPanel.equals("TASKS") && (t != null) && 
	(d.inPeriod(t.getStartDate(), t.getEndDate()))) 
		label.setBackground(ColorMap.TASKBG);

else if(currentPanel.equals("NOTES") && 
CurrentProject.getNoteList().getNoteForDate(d) != null) 
			label.setBackground(ColorMap.NOTEBG);

else if(currentPanel.equals("EVENTS") && 
(!(EventsManager.getEventsForDate(d).isEmpty()))) 
			label.setBackground(ColorMap.EVENTBG);

else if(!isSelected)
	label.setBackground(ColorMap.FREEBG);
else {
	label.setBackground(ColorMap.DAYSELECT);
}
// always display NREvents
if (EventsManager.isNonRepeatingEventsForDate(d))
	label.setIcon(IconFontSwing.buildIcon(GoogleMaterialDesignIcons.PRIORITY_HIGH, 24, ColorMap.PRIORITY));
else
	label.setIcon(null);

      return label;
  }