KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > de > java2html > Java2HtmlApplication


1 package de.java2html;
2
3 import java.awt.BorderLayout JavaDoc;
4 import java.awt.FlowLayout JavaDoc;
5 import java.awt.event.ActionEvent JavaDoc;
6 import java.awt.event.ActionListener JavaDoc;
7
8 import javax.swing.Box JavaDoc;
9 import javax.swing.JButton JavaDoc;
10 import javax.swing.JFrame JavaDoc;
11 import javax.swing.JPanel JavaDoc;
12 import javax.swing.JTabbedPane JavaDoc;
13
14 import de.java2html.gui.DirectTextConversionPanel;
15 import de.java2html.gui.FileConversionPanel;
16 import de.java2html.gui.GuiTools;
17 import de.java2html.gui.IStatisticsView;
18 import de.java2html.gui.Java2HtmlOptionsPanel;
19 import de.java2html.javasource.JavaSourceStatistic;
20
21 /**
22  * Main application for the Java2Html converter.
23  *
24  * For questions, suggestions, bug-reports, enhancement-requests etc. I may be
25  * contacted at: <a HREF="mailto:markus@jave.de">markus@jave.de</a>
26  *
27  * The Java2html home page is located at: <a HREF="http://www.java2html.de">
28  * http://www.java2html.de</a>
29  *
30  * @author <a HREF="mailto:markus@jave.de">Markus Gebhard</a>
31  * @version 2.1, 06/30/02
32  *
33  * Copyright (C) Markus Gebhard 2000-2002
34  *
35  * This program is free software; you can redistribute it and/or modify it
36  * under the terms of the GNU General Public License as published by the Free
37  * Software Foundation; either version 2 of the License, or (at your option)
38  * any later version.
39  *
40  * This program is distributed in the hope that it will be useful, but WITHOUT
41  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
42  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
43  * more details.
44  *
45  * You should have received a copy of the GNU General Public License along with
46  * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
47  * Place - Suite 330, Boston, MA 02111-1307, USA.
48  */

49 public class Java2HtmlApplication {
50
51   private final JFrame JavaDoc frame;
52
53   private final JButton JavaDoc bExit;
54   private final Java2HtmlOptionsPanel optionsPanel = new Java2HtmlOptionsPanel();
55
56   public Java2HtmlApplication() {
57     final JTabbedPane JavaDoc tabbedPane = new JTabbedPane JavaDoc();
58     tabbedPane.addTab("File Conversion", new FileConversionPanel(optionsPanel).getContent());
59     tabbedPane.addTab("Direct Text Conversion", new DirectTextConversionPanel(
60         optionsPanel,
61         new IStatisticsView() {
62           public void setStatistics(JavaSourceStatistic statistic) {
63             //nothing to do
64
}
65         }).getContent());
66
67     bExit = new JButton JavaDoc("Exit");
68     bExit.addActionListener(new ActionListener JavaDoc() {
69       public void actionPerformed(ActionEvent JavaDoc evt) {
70         System.exit(0);
71       }
72     });
73
74     final JPanel JavaDoc southPanel = new JPanel JavaDoc(new FlowLayout JavaDoc(FlowLayout.RIGHT));
75     southPanel.add(bExit);
76
77     final JPanel JavaDoc pOptions = GuiTools.createBorderedPanel("Options");
78     pOptions.setLayout(new BorderLayout JavaDoc());
79     pOptions.add(optionsPanel.getContent(), BorderLayout.CENTER);
80
81     JPanel JavaDoc p = new JPanel JavaDoc(new BorderLayout JavaDoc());
82     p.add(pOptions, BorderLayout.NORTH);
83     p.add(Box.createVerticalGlue(), BorderLayout.CENTER);
84
85     frame = new JFrame JavaDoc(Version.getJava2HtmlConverterTitle());
86     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
87     frame.getContentPane().setLayout(new BorderLayout JavaDoc(4, 4));
88     frame.getContentPane().add(p, BorderLayout.EAST);
89     frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
90     frame.getContentPane().add(southPanel, BorderLayout.SOUTH);
91   }
92
93   private void show() {
94     frame.pack();
95     GuiTools.centerOnScreen(frame);
96     frame.setVisible(true);
97   }
98
99   public static void main(String JavaDoc args[]) {
100     if (args != null && args.length > 0) {
101       Java2Html.main(args);
102       return;
103     }
104     GuiTools.setNativeLookAndFeel();
105     Java2HtmlApplication application = new Java2HtmlApplication();
106     application.show();
107   }
108 }
Popular Tags