PageRenderTime 290ms CodeModel.GetById 280ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/org/gjt/sp/jedit/options/PrintOptionPane.java

#
Java | 97 lines | 52 code | 11 blank | 34 comment | 0 complexity | 431160063fec9dd4c47f2bf8afd93e61 MD5 | raw file
 1/*
 2 * PrintOptionPane.java - Printing options panel
 3 * :tabSize=8:indentSize=8:noTabs=false:
 4 * :folding=explicit:collapseFolds=1:
 5 *
 6 * Copyright (C) 2000 Slava Pestov
 7 *
 8 * This program is free software; you can redistribute it and/or
 9 * 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
23package org.gjt.sp.jedit.options;
24
25//{{{ Imports
26import javax.swing.*;
27import java.awt.*;
28import org.gjt.sp.jedit.gui.FontSelector;
29import org.gjt.sp.jedit.*;
30//}}}
31
32public class PrintOptionPane extends AbstractOptionPane
33{
34	//{{{ PrintOptionPane constructor
35	public PrintOptionPane()
36	{
37		super("print");
38	} //}}}
39
40	//{{{ _init() method
41	protected void _init()
42	{
43		/* Font */
44		font = new FontSelector(jEdit.getFontProperty("print.font"));
45		addComponent(jEdit.getProperty("options.print.font"),font);
46
47		/* Header */
48		printHeader = new JCheckBox(jEdit.getProperty("options.print"
49			+ ".header"));
50		printHeader.setSelected(jEdit.getBooleanProperty("print.header"));
51		addComponent(printHeader);
52
53		/* Footer */
54		printFooter = new JCheckBox(jEdit.getProperty("options.print"
55			+ ".footer"));
56		printFooter.setSelected(jEdit.getBooleanProperty("print.footer"));
57		addComponent(printFooter);
58
59		/* Line numbering */
60		printLineNumbers = new JCheckBox(jEdit.getProperty("options.print"
61			+ ".lineNumbers"));
62		printLineNumbers.setSelected(jEdit.getBooleanProperty("print.lineNumbers"));
63		addComponent(printLineNumbers);
64
65		/* Color */
66		color = new JCheckBox(jEdit.getProperty("options.print"
67			+ ".color"));
68		color.setSelected(jEdit.getBooleanProperty("print.color"));
69		addComponent(color);
70
71		/* Tab size */
72		String[] tabSizes = { "2", "4", "8" };
73		tabSize = new JComboBox(tabSizes);
74		tabSize.setEditable(true);
75		tabSize.setSelectedItem(jEdit.getProperty("print.tabSize"));
76		addComponent(jEdit.getProperty("options.print.tabSize"),tabSize);
77	} //}}}
78
79	//{{{ _save() method
80	protected void _save()
81	{
82		jEdit.setFontProperty("print.font",font.getFont());
83		jEdit.setBooleanProperty("print.header",printHeader.isSelected());
84		jEdit.setBooleanProperty("print.footer",printFooter.isSelected());
85		jEdit.setBooleanProperty("print.lineNumbers",printLineNumbers.isSelected());
86		jEdit.setBooleanProperty("print.color",color.isSelected());
87	} //}}}
88
89	//{{{ Private members
90	private FontSelector font;
91	private JCheckBox printHeader;
92	private JCheckBox printFooter;
93	private JCheckBox printLineNumbers;
94	private JCheckBox color;
95	private JComboBox tabSize;
96	//}}}
97}