package com.dwave.gui; import javax.swing.JLabel; import javax.swing.Icon; import java.awt.Font; import com.javaworld.BrowserControl; /** * A Serializable JLabel which uses the Lucida Sans font by * default because fonts on linux are wierd */ public class DLabel extends JLabel implements java.io.Serializable { private static final long serialVersionUID = -8891116851990298056L; public static final Font theFont = new java.awt.Font("Lucida Sans", 0, 12), theFontBold = new java.awt.Font("Lucida Sans", 1, 12), theLargerFont = new java.awt.Font("Lucida Sans", 0, 14), theLargerFontBold = new java.awt.Font("Lucida Sans", 1, 14), theSmallerFont = new java.awt.Font("Lucida Sans", 0, 10), theSmallerFontBold = new java.awt.Font("Lucida Sans", 1, 10); /** * Constructs a new label */ public DLabel() { super(); if(!BrowserControl.isWindowsPlatform()) this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } /** * Constructs a new label with an icon * @param icon an icon */ public DLabel(Icon icon) { super(icon); if(!BrowserControl.isWindowsPlatform()) this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } /** * Constructs a new label with an icon * @param image an icon * @param horizontalAlignment horizontal alignmenr */ public DLabel(Icon image, int horizontalAlignment) { super(image, horizontalAlignment); if(!BrowserControl.isWindowsPlatform()) this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } /** * Constructs a new label with text * @param text some text */ public DLabel(String text) { super(text); if(!BrowserControl.isWindowsPlatform()) this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } /** * Constructs a new label with text * @param text some text * @param bold if true, text will be bold */ public DLabel(String text, boolean bold) { super(text); if(!BrowserControl.isWindowsPlatform()) { if(bold) this.setFont(new java.awt.Font("Lucida Sans", 1, 12)); else this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } } /** * Constructs a new label with text * @param text some text * @param font a font */ public DLabel(String text, Font font) { super(text); if(!BrowserControl.isWindowsPlatform()) this.setFont(font); } /** * Constructs a new label with text * @param text some text * @param font a font * @param horizontalAlignment horizontal alignment */ public DLabel(String text, Font font, int horizontalAlignment) { super(text, horizontalAlignment); if(!BrowserControl.isWindowsPlatform()) this.setFont(font); } /** * Constructs a new label with text and an icon * @param text some text * @param icon an icon * @param horizontalAlignment horizontal alignment */ public DLabel(String text, Icon icon, int horizontalAlignment) { super(text, icon, horizontalAlignment); if(!BrowserControl.isWindowsPlatform()) this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } /** * Constructs a new label with text * @param text some text * @param horizontalAlignment horizontal alignment */ public DLabel(String text, int horizontalAlignment) { super(text, horizontalAlignment); if(!BrowserControl.isWindowsPlatform()) this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } /** * Constructs a new label with text * @param text some text * @param horizontalAlignment horizontal alignment * @param bold if true, text will be bold */ public DLabel(String text, int horizontalAlignment, boolean bold) { super(text, horizontalAlignment); if(!BrowserControl.isWindowsPlatform()) { if(bold) this.setFont(new java.awt.Font("Lucida Sans", 1, 12)); else this.setFont(new java.awt.Font("Lucida Sans", 0, 12)); } } }