001: package de.java2html;
002:
003: import java.awt.BorderLayout;
004: import java.awt.FlowLayout;
005: import java.awt.event.ActionEvent;
006: import java.awt.event.ActionListener;
007:
008: import javax.swing.Box;
009: import javax.swing.JButton;
010: import javax.swing.JFrame;
011: import javax.swing.JPanel;
012: import javax.swing.JTabbedPane;
013:
014: import de.java2html.gui.DirectTextConversionPanel;
015: import de.java2html.gui.FileConversionPanel;
016: import de.java2html.gui.GuiTools;
017: import de.java2html.gui.IStatisticsView;
018: import de.java2html.gui.Java2HtmlOptionsPanel;
019: import de.java2html.javasource.JavaSourceStatistic;
020:
021: /**
022: * Main application for the Java2Html converter.
023: *
024: * For questions, suggestions, bug-reports, enhancement-requests etc. I may be
025: * contacted at: <a href="mailto:markus@jave.de">markus@jave.de</a>
026: *
027: * The Java2html home page is located at: <a href="http://www.java2html.de">
028: * http://www.java2html.de</a>
029: *
030: * @author <a href="mailto:markus@jave.de">Markus Gebhard</a>
031: * @version 2.1, 06/30/02
032: *
033: * Copyright (C) Markus Gebhard 2000-2002
034: *
035: * This program is free software; you can redistribute it and/or modify it
036: * under the terms of the GNU General Public License as published by the Free
037: * Software Foundation; either version 2 of the License, or (at your option)
038: * any later version.
039: *
040: * This program is distributed in the hope that it will be useful, but WITHOUT
041: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
042: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
043: * more details.
044: *
045: * You should have received a copy of the GNU General Public License along with
046: * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
047: * Place - Suite 330, Boston, MA 02111-1307, USA.
048: */
049: public class Java2HtmlApplication {
050:
051: private final JFrame frame;
052:
053: private final JButton bExit;
054: private final Java2HtmlOptionsPanel optionsPanel = new Java2HtmlOptionsPanel();
055:
056: public Java2HtmlApplication() {
057: final JTabbedPane tabbedPane = new JTabbedPane();
058: tabbedPane.addTab("File Conversion", new FileConversionPanel(
059: optionsPanel).getContent());
060: tabbedPane.addTab("Direct Text Conversion",
061: new DirectTextConversionPanel(optionsPanel,
062: new IStatisticsView() {
063: public void setStatistics(
064: JavaSourceStatistic statistic) {
065: //nothing to do
066: }
067: }).getContent());
068:
069: bExit = new JButton("Exit");
070: bExit.addActionListener(new ActionListener() {
071: public void actionPerformed(ActionEvent evt) {
072: System.exit(0);
073: }
074: });
075:
076: final JPanel southPanel = new JPanel(new FlowLayout(
077: FlowLayout.RIGHT));
078: southPanel.add(bExit);
079:
080: final JPanel pOptions = GuiTools.createBorderedPanel("Options");
081: pOptions.setLayout(new BorderLayout());
082: pOptions.add(optionsPanel.getContent(), BorderLayout.CENTER);
083:
084: JPanel p = new JPanel(new BorderLayout());
085: p.add(pOptions, BorderLayout.NORTH);
086: p.add(Box.createVerticalGlue(), BorderLayout.CENTER);
087:
088: frame = new JFrame(Version.getJava2HtmlConverterTitle());
089: frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
090: frame.getContentPane().setLayout(new BorderLayout(4, 4));
091: frame.getContentPane().add(p, BorderLayout.EAST);
092: frame.getContentPane().add(tabbedPane, BorderLayout.CENTER);
093: frame.getContentPane().add(southPanel, BorderLayout.SOUTH);
094: }
095:
096: private void show() {
097: frame.pack();
098: GuiTools.centerOnScreen(frame);
099: frame.setVisible(true);
100: }
101:
102: public static void main(String args[]) {
103: if (args != null && args.length > 0) {
104: Java2Html.main(args);
105: return;
106: }
107: GuiTools.setNativeLookAndFeel();
108: Java2HtmlApplication application = new Java2HtmlApplication();
109: application.show();
110: }
111: }
|