KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > apps > svgbrowser > SVGOptionPanel


1 /*
2
3    Copyright 2001-2003 The Apache Software Foundation
4
5    Licensed under the Apache License, Version 2.0 (the "License");
6    you may not use this file except in compliance with the License.
7    You may obtain a copy of the License at
8
9        http://www.apache.org/licenses/LICENSE-2.0
10
11    Unless required by applicable law or agreed to in writing, software
12    distributed under the License is distributed on an "AS IS" BASIS,
13    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14    See the License for the specific language governing permissions and
15    limitations under the License.
16
17  */

18 package org.apache.batik.apps.svgbrowser;
19
20 import java.awt.Component JavaDoc;
21 import java.awt.BorderLayout JavaDoc;
22
23 import javax.swing.JLabel JavaDoc;
24 import javax.swing.JCheckBox JavaDoc;
25
26 /**
27  * This class represents a panel to control svg encoding options.
28  *
29  * @author <a HREF="mailto:tkormann@apache.org">Thierry Kormann</a>
30  * @version $Id: SVGOptionPanel.java,v 1.2 2005/03/29 10:48:02 deweese Exp $
31  */

32 public class SVGOptionPanel extends OptionPanel {
33     /**
34      * The svg encoding options.
35      */

36     protected JCheckBox JavaDoc xmlbaseCB;
37     protected JCheckBox JavaDoc prettyPrintCB;
38
39     /**
40      * Creates a new panel.
41      */

42     public SVGOptionPanel() {
43     super(new BorderLayout JavaDoc());
44     add(new JLabel JavaDoc(resources.getString("SVGOptionPanel.label")),
45         BorderLayout.NORTH);
46
47         xmlbaseCB = new JCheckBox JavaDoc
48             (resources.getString("SVGOptionPanel.UseXMLBase"));
49         xmlbaseCB.setSelected
50             (resources.getBoolean("SVGOptionPanel.UseXMLBaseDefault"));
51         add(xmlbaseCB, BorderLayout.CENTER);
52              
53         prettyPrintCB = new JCheckBox JavaDoc
54             (resources.getString("SVGOptionPanel.PrettyPrint"));
55         prettyPrintCB.setSelected
56             (resources.getBoolean("SVGOptionPanel.PrettyPrintDefault"));
57         add(prettyPrintCB, BorderLayout.SOUTH);
58     }
59
60     /**
61      * Returns true if the output should use xml:base.
62      */

63     public boolean getUseXMLBase() {
64     return xmlbaseCB.isSelected();
65     }
66
67     /**
68      * Returns true if the output should use xml:base.
69      */

70     public boolean getPrettyPrint() {
71     return prettyPrintCB.isSelected();
72     }
73
74     /**
75      * Shows a dialog to choose the jpeg encoding quality and return
76      * the quality as a float.
77      */

78     public static SVGOptionPanel showDialog(Component JavaDoc parent) {
79         String JavaDoc title = resources.getString("SVGOptionPanel.dialog.title");
80         SVGOptionPanel panel = new SVGOptionPanel();
81     Dialog dialog = new Dialog(parent, title, panel);
82     dialog.pack();
83     dialog.show();
84     return panel;
85     }
86 }
87
Popular Tags