01: /*
02: * Copyright 2000,2005 wingS development team.
03: *
04: * This file is part of wingS (http://wingsframework.org).
05: *
06: * wingS is free software; you can redistribute it and/or modify
07: * it under the terms of the GNU Lesser General Public License
08: * as published by the Free Software Foundation; either version 2.1
09: * of the License, or (at your option) any later version.
10: *
11: * Please see COPYING for the complete licence.
12: */
13: package org.wings;
14:
15: import java.io.Serializable;
16:
17: /**
18: * Defines and represents a customized font (font name, style and size).
19: *
20: * @author <a href="mailto:haaf@mercatis.de">Armin Haaf</a>
21: */
22: public class SFont implements Serializable {
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 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 face, int style, int size) {
56: setFace(face);
57: setStyle(style);
58: setSize(size);
59: }
60:
61: public void setFace(String f) {
62: face = f;
63: if (face != null && face.trim().length() == 0)
64: face = null;
65: }
66:
67: public String 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: }
|