01: /*
02: * AntiAlias.java - a small helper class for AntiAlias settings.
03: * :tabSize=8:indentSize=8:noTabs=false:
04: * :folding=explicit:collapseFolds=1:
05: *
06: * Copyright (C) 2006 Alan Ezust
07: *
08: * This program is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU General Public License
10: * as published by the Free Software Foundation; either version 2
11: * of the License, or any later version.
12: *
13: * This program is distributed in the hope that it will be useful,
14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: * GNU General Public License for more details.
17: *
18: * You should have received a copy of the GNU General Public License
19: * along with this program; if not, write to the Free Software
20: * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21: */
22: package org.gjt.sp.jedit.textarea;
23:
24: /**
25: * Class for representing AntiAlias values. The following modes are supported:
26: * none standard lcd subpixel (JDK 1.6 only)
27: *
28: * @author ezust
29: * @since jedit 4.3pre4
30: */
31: public class AntiAlias extends Object {
32: public static final Object NONE = "none";
33:
34: public static final Object STANDARD = "standard";
35:
36: public static final Object SUBPIXEL = "subpixel";
37:
38: public static final Object comboChoices[] = new Object[] { NONE,
39: STANDARD, SUBPIXEL };
40:
41: public void set(int newValue) {
42: m_val = newValue;
43: }
44:
45: public AntiAlias(boolean isEnabled) {
46: m_val = isEnabled ? 1 : 0;
47: }
48:
49: public AntiAlias(int val) {
50: m_val = val;
51: }
52:
53: public AntiAlias(String v) {
54: fromString(v);
55: }
56:
57: public boolean equals(Object other) {
58: return toString().equals(other.toString());
59:
60: }
61:
62: public void fromString(String v) {
63: for (int i = 0; i < comboChoices.length; ++i) {
64: if (comboChoices[i].equals(v)) {
65: m_val = i;
66: }
67: }
68: }
69:
70: public String toString() {
71: return comboChoices[m_val].toString();
72: }
73:
74: public int val() {
75: return m_val;
76: }
77:
78: private int m_val = 0;
79: }
|