01: package net.xoetrope.builder.editor.syntaxhighlight;
02:
03: /*
04: * TextAreaDefaults.java - Encapsulates default values for various settings
05: * Copyright (C) 1999 Slava Pestov
06: *
07: * You may use and modify this package for any purpose. Redistribution is
08: * permitted, in both source and binary form, provided that this notice
09: * remains intact in all source distributions of this package.
10: */
11:
12: import javax.swing.JPopupMenu;
13: import java.awt.Color;
14:
15: /**
16: * Encapsulates default settings for a text area. This can be passed
17: * to the constructor once the necessary fields have been filled out.
18: * The advantage of doing this over calling lots of set() methods after
19: * creating the text area is that this method is faster.
20: */
21: public class TextAreaDefaults {
22: private static TextAreaDefaults DEFAULTS;
23:
24: public InputHandler inputHandler;
25: public SyntaxDocument document;
26: public boolean editable;
27:
28: public boolean caretVisible;
29: public boolean caretBlinks;
30: public boolean blockCaret;
31: public int electricScroll;
32:
33: public int cols;
34: public int rows;
35: public SyntaxStyle[] styles;
36: public Color caretColor;
37: public Color selectionColor;
38: public Color lineHighlightColor;
39: public boolean lineHighlight;
40: public Color bracketHighlightColor;
41: public boolean bracketHighlight;
42: public Color eolMarkerColor;
43: public boolean eolMarkers;
44: public boolean paintInvalid;
45:
46: public JPopupMenu popup;
47:
48: /**
49: * Returns a new TextAreaDefaults object with the default values filled
50: * in.
51: */
52: public static TextAreaDefaults getDefaults() {
53: if (DEFAULTS == null) {
54: DEFAULTS = new TextAreaDefaults();
55:
56: DEFAULTS.inputHandler = new DefaultInputHandler();
57: DEFAULTS.inputHandler.addDefaultKeyBindings();
58: DEFAULTS.document = new SyntaxDocument();
59: DEFAULTS.editable = true;
60:
61: DEFAULTS.caretVisible = true;
62: DEFAULTS.caretBlinks = true;
63: DEFAULTS.electricScroll = 3;
64:
65: DEFAULTS.cols = 80;
66: DEFAULTS.rows = 25;
67: DEFAULTS.styles = SyntaxUtilities.getDefaultSyntaxStyles();
68: DEFAULTS.caretColor = Color.red;
69: DEFAULTS.selectionColor = new Color(0xccccff);
70: DEFAULTS.lineHighlightColor = new Color(0xe0e0e0);
71: DEFAULTS.lineHighlight = true;
72: DEFAULTS.bracketHighlightColor = Color.black;
73: DEFAULTS.bracketHighlight = true;
74: DEFAULTS.eolMarkerColor = new Color(0x009999);
75: DEFAULTS.eolMarkers = true;
76: DEFAULTS.paintInvalid = true;
77: }
78:
79: return DEFAULTS;
80: }
81: }
|