KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > wings > SFont


1 /*
2  * $Id: SFont.java,v 1.9 2005/05/26 13:18:08 neurolabs Exp $
3  * Copyright 2000,2005 wingS development team.
4  *
5  * This file is part of wingS (http://www.j-wings.org).
6  *
7  * wingS is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU Lesser General Public License
9  * as published by the Free Software Foundation; either version 2.1
10  * of the License, or (at your option) any later version.
11  *
12  * Please see COPYING for the complete licence.
13  */

14 package org.wings;
15
16 import java.io.Serializable JavaDoc;
17
18 /**
19  * @author <a HREF="mailto:haaf@mercatis.de">Armin Haaf</a>
20  * @version $Revision: 1.9 $
21  */

22 public class SFont implements Serializable JavaDoc {
23     /**
24      * Plain font style for {@link SFont#setStyle(int)}. Can be combined with adding (i.e. SFont.BOLD+SFont.ITALIC)
25      */

26     public final static int PLAIN = java.awt.Font.PLAIN;
27     /**
28      * Italic font style for {@link SFont#setStyle(int)}. Can be combined with adding (i.e. SFont.BOLD+SFont.ITALIC)
29      */

30     public final static int ITALIC = java.awt.Font.ITALIC;
31     /**
32      * Bold font style for {@link SFont#setStyle(int)}. Can be combined with adding (i.e. SFont.BOLD+SFont.ITALIC)
33      */

34     public final static int BOLD = java.awt.Font.BOLD;
35
36     /**
37      * Default font size for {@link SFont} constructor.
38      */

39     public final static int DEFAULT_SIZE = -1;
40
41     protected int style = PLAIN;
42     protected String JavaDoc face = null;
43     protected int size = DEFAULT_SIZE;
44
45     public SFont() {
46     }
47
48     public SFont(int style) {
49         setStyle(style);
50     }
51
52     /*
53      * @parameter size if Integer.MIN_VALUE the size is ignored
54      */

55     public SFont(String JavaDoc face, int style, int size) {
56         setFace(face);
57         setStyle(style);
58         setSize(size);
59     }
60     
61     public void setFace(String JavaDoc f) {
62         face = f;
63         if (face != null && face.trim().length() == 0)
64             face = null;
65     }
66
67     public String JavaDoc getFace() {
68         return face;
69     }
70
71     public void setStyle(int s) {
72         style = s;
73     }
74
75     public int getStyle() {
76         return style;
77     }
78
79     public void setSize(int s) {
80         size = s;
81     }
82
83     public int getSize() {
84         return size;
85     }
86 }
87
88
89
Popular Tags