001 // This file is part of the Attempto Java Packages. 002 // Copyright 2008, Attempto Group, University of Zurich (see http://attempto.ifi.uzh.ch). 003 // 004 // The Attempto Java Packages is free software: you can redistribute it and/or modify it under the 005 // terms of the GNU Lesser General Public License as published by the Free Software Foundation, 006 // either version 3 of the License, or (at your option) any later version. 007 // 008 // The Attempto Java Packages is distributed in the hope that it will be useful, but WITHOUT ANY 009 // WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 010 // PURPOSE. See the GNU Lesser General Public License for more details. 011 // 012 // You should have received a copy of the GNU Lesser General Public License along with the Attempto 013 // Java Packages. If not, see http://www.gnu.org/licenses/. 014 015 package ch.uzh.ifi.attempto.echocomp; 016 017 import nextapp.echo2.app.Extent; 018 import nextapp.echo2.app.Font; 019 import nextapp.echo2.app.ImageReference; 020 021 /** 022 * This is a convenience class for easy creation of labels. 023 * 024 * @author Tobias Kuhn 025 */ 026 public class Label extends nextapp.echo2.app.Label { 027 028 /** 029 * Creates a new empty label. 030 */ 031 public Label() { 032 super(); 033 initLabel(Font.PLAIN, 13); 034 } 035 036 /** 037 * Creates a new label containing only an image. 038 * 039 * @param image The image. 040 */ 041 public Label(ImageReference image) { 042 super(image); 043 initLabel(Font.PLAIN, 13); 044 } 045 046 /** 047 * Creates a new label. 048 * 049 * @param text The text of the label. 050 */ 051 public Label(String text) { 052 super(text); 053 initLabel(Font.PLAIN, 13); 054 } 055 056 /** 057 * Creates a new label of the given style. 058 * 059 * @param text The text of the label. 060 * @param style The style of the label. 061 */ 062 public Label(String text, int style) { 063 super(text); 064 initLabel(style, 13); 065 } 066 067 /** 068 * Creates a new label of the given style with the given text size. 069 * 070 * @param text The text of the label. 071 * @param style The style of the label. 072 * @param size The size of the text. 073 */ 074 public Label(String text, int style, int size) { 075 super(text); 076 initLabel(style, size); 077 } 078 079 void initLabel(int style, int size) { 080 setFont(new Font(Style.fontTypeface, style, new Extent(size))); 081 } 082 083 }