1
2
3
4
5
6
7
8
9
10 package org.syntax.jedit;
11
12 import java.awt.Color;
13
14 import javax.swing.JPopupMenu;
15
16 /***
17 * Encapsulates default settings for a text area. This can be passed
18 * to the constructor once the necessary fields have been filled out.
19 * The advantage of doing this over calling lots of set() methods after
20 * creating the text area is that this method is faster.
21 */
22 public class TextAreaDefaults
23 {
24
25
26 public InputHandler inputHandler;
27 public SyntaxDocument document;
28 public boolean editable;
29
30 public boolean caretVisible;
31 public boolean caretBlinks;
32 public boolean blockCaret;
33 public int electricScroll;
34
35 public int cols;
36 public int rows;
37 public SyntaxStyle[] styles;
38 public Color caretColor;
39 public Color selectionColor;
40 public Color lineHighlightColor;
41 public boolean lineHighlight;
42 public Color bracketHighlightColor;
43 public boolean bracketHighlight;
44 public Color eolMarkerColor;
45 public boolean eolMarkers;
46 public boolean paintInvalid;
47
48 public JPopupMenu popup;
49
50 /***
51 * Returns a new TextAreaDefaults object with the default values filled
52 * in.
53 */
54 public static TextAreaDefaults getDefaults()
55 {
56
57
58 TextAreaDefaults DEFAULTS = new TextAreaDefaults();
59
60 DEFAULTS.inputHandler = new DefaultInputHandler();
61 DEFAULTS.inputHandler.addDefaultKeyBindings();
62 DEFAULTS.document = new SyntaxDocument();
63 DEFAULTS.editable = true;
64
65 DEFAULTS.blockCaret = false;
66 DEFAULTS.caretVisible = true;
67 DEFAULTS.caretBlinks = true;
68 DEFAULTS.electricScroll = 3;
69
70 DEFAULTS.cols = 80;
71 DEFAULTS.rows = 25;
72 DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles();
73 DEFAULTS.caretColor = Color.black;
74 DEFAULTS.selectionColor = new Color(0xccccff);
75 DEFAULTS.lineHighlightColor = new Color(0xe0e0e0);
76 DEFAULTS.lineHighlight = true;
77 DEFAULTS.bracketHighlightColor = Color.black;
78 DEFAULTS.bracketHighlight = true;
79 DEFAULTS.eolMarkerColor = new Color(0x009999);
80 DEFAULTS.eolMarkers = false;
81 DEFAULTS.paintInvalid = false;
82
83
84 return DEFAULTS;
85 }
86 }