KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > syntax > jedit > TextAreaDefaults


1 /*
2  * Copyright (C) 2005 - 2006 JasperSoft Corporation. All rights reserved.
3  * http://www.jaspersoft.com.
4  *
5  * Unless you have purchased a commercial license agreement from JasperSoft,
6  * the following license terms apply:
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License version 2 as published by
10  * the Free Software Foundation.
11  *
12  * This program is distributed WITHOUT ANY WARRANTY; and without the
13  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program; if not, see http://www.gnu.org/licenses/gpl.txt
18  * or write to:
19  *
20  * Free Software Foundation, Inc.,
21  * 59 Temple Place - Suite 330,
22  * Boston, MA USA 02111-1307
23  *
24  *
25  *
26  *
27  * TextAreaDefaults.java
28  *
29  */

30
31 package org.syntax.jedit;
32
33 import javax.swing.JPopupMenu JavaDoc;
34 import java.awt.Color JavaDoc;
35
36 /**
37  * Encapsulates default settings for a text area. This can be passed
38  * to the constructor once the necessary fields have been filled out.
39  * The advantage of doing this over calling lots of set() methods after
40  * creating the text area is that this method is faster.
41  */

42 public class TextAreaDefaults
43 {
44     private static TextAreaDefaults DEFAULTS;
45
46     public InputHandler inputHandler;
47     public SyntaxDocument document;
48     public boolean editable;
49
50     public boolean caretVisible;
51     public boolean caretBlinks;
52     public boolean blockCaret;
53     public int electricScroll;
54
55     public int cols;
56     public int rows;
57     public SyntaxStyle[] styles;
58     public Color JavaDoc caretColor;
59     public Color JavaDoc selectionColor;
60     public Color JavaDoc lineHighlightColor;
61     public boolean lineHighlight;
62     public Color JavaDoc bracketHighlightColor;
63     public boolean bracketHighlight;
64     public Color JavaDoc eolMarkerColor;
65     public boolean eolMarkers;
66     public boolean paintInvalid;
67
68     public JPopupMenu JavaDoc popup;
69
70     /**
71      * Returns a new TextAreaDefaults object with the default values filled
72      * in.
73      */

74     public static TextAreaDefaults getDefaults()
75     {
76         if(DEFAULTS == null)
77         {
78             DEFAULTS = new TextAreaDefaults();
79
80             DEFAULTS.inputHandler = new DefaultInputHandler();
81             DEFAULTS.inputHandler.addDefaultKeyBindings();
82             DEFAULTS.document = new SyntaxDocument();
83             DEFAULTS.editable = true;
84
85             DEFAULTS.blockCaret = false;
86             DEFAULTS.caretVisible = true;
87             DEFAULTS.caretBlinks = true;
88             DEFAULTS.electricScroll = 3;
89
90             DEFAULTS.cols = 80;
91             DEFAULTS.rows = 25;
92             DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles();
93             DEFAULTS.caretColor = Color.black; // Color.red;
94
DEFAULTS.selectionColor = new Color JavaDoc(0xccccff);
95             DEFAULTS.lineHighlightColor = new Color JavaDoc(0xe0e0e0);
96             DEFAULTS.lineHighlight = true;
97             DEFAULTS.bracketHighlightColor = Color.black;
98             DEFAULTS.bracketHighlight = true;
99             DEFAULTS.eolMarkerColor = new Color JavaDoc(0x009999);
100             DEFAULTS.eolMarkers = false; // true;
101
DEFAULTS.paintInvalid = false; //true;
102
}
103
104         return DEFAULTS;
105     }
106 }
107
Popular Tags