1 19 package org.lucane.applications.calendar.widget.freebusy; 20 21 import java.awt.Color ; 22 import java.awt.Dimension ; 23 import java.awt.Font ; 24 25 import javax.swing.JLabel ; 26 27 public class FreeBusyLabel extends JLabel 28 { 29 public FreeBusyLabel(String text, boolean bold) 30 { 31 super(text); 32 if(bold) 33 setFont(getFont().deriveFont(Font.BOLD)); 34 else 35 setFont(getFont().deriveFont(Font.PLAIN)); 36 37 setOpaque(true); 38 setBackground(Color.WHITE); 39 } 40 41 public Dimension getPreferredSize() 42 { 43 Dimension d = super.getPreferredSize(); 44 d.height = FreeBusyPanel.HEIGHT; 45 if(d.width < FreeBusyPanel.HOUR_WIDTH*2) 46 d.width = FreeBusyPanel.HOUR_WIDTH*2; 47 48 return d; 49 } 50 } | Popular Tags |