KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > aspectj > tools > ajbrowser > BrowserOptionsPanel


1
2 /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
3  *
4  * This file is part of the IDE support for the AspectJ(tm)
5  * programming language; see http://aspectj.org
6  *
7  * The contents of this file are subject to the Mozilla Public License
8  * Version 1.1 (the "License"); you may not use this file except in
9  * compliance with the License. You may obtain a copy of the License at
10  * either http://www.mozilla.org/MPL/ or http://aspectj.org/MPL/.
11  *
12  * Software distributed under the License is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14  * for the specific language governing rights and limitations under the
15  * License.
16  *
17  * The Original Code is AspectJ.
18  *
19  * The Initial Developer of the Original Code is Xerox Corporation. Portions
20  * created by Xerox Corporation are Copyright (C) 1999-2002 Xerox Corporation.
21  * All Rights Reserved.
22  *
23  * Contributor(s):
24  */

25
26 package org.aspectj.tools.ajbrowser;
27
28 import java.io.*;
29 import javax.swing.*;
30 import java.awt.*;
31 import javax.swing.border.*;
32 import org.aspectj.ajde.ui.swing.*;
33
34 /**
35  * @author Mik Kersten
36  */

37 public class BrowserOptionsPanel extends OptionsPanel {
38     
39     private JPanel runOptions_panel = new JPanel();
40     private JPanel build_panel = new JPanel();
41     private FlowLayout flowLayout1 = new FlowLayout();
42     private JTextField classToRun_field = new JTextField();
43     private JLabel jLabel4 = new JLabel();
44     private BorderLayout borderLayout4 = new BorderLayout();
45     private JPanel buildPaths_panel = new JPanel();
46     private Box compileOptions_box2 = Box.createVerticalBox();
47     private JTextField classpath_field = new JTextField();
48     private JTextField outputPath_field = new JTextField();
49     private JLabel jLabel16 = new JLabel();
50     private JLabel jLabel15 = new JLabel();
51     private Box compileOptions_box3 = Box.createVerticalBox();
52     private BorderLayout borderLayout1 = new BorderLayout();
53     private Border border1;
54     private TitledBorder titledBorder1;
55     private Border border2;
56     private Border border3;
57     private TitledBorder titledBorder2;
58     private Border border4;
59
60     public BrowserOptionsPanel() {
61         try {
62             jbInit();
63             this.setName("AJBrowser Options");
64         } catch (Exception JavaDoc e) {
65             e.printStackTrace();
66         }
67     }
68
69     public void loadOptions() throws IOException {
70         outputPath_field.setText(
71             BrowserManager.getDefault().getBrowserProjectProperties().getOutputPath()
72         );
73         classpath_field.setText(
74             BrowserManager.getDefault().getBrowserProjectProperties().getClasspath()
75         );
76         classToRun_field.setText(
77             BrowserManager.getDefault().getBrowserProjectProperties().getClassToExecute()
78         );
79     }
80     
81     public void saveOptions() throws IOException {
82         BrowserManager.getDefault().getBrowserProjectProperties().setOutputPath(
83             outputPath_field.getText()
84         );
85         BrowserManager.getDefault().getBrowserProjectProperties().setClasspath(
86             classpath_field.getText()
87         );
88         BrowserManager.getDefault().getBrowserProjectProperties().setClassToExecute(
89             classToRun_field.getText()
90         );
91     }
92
93     private void jbInit() throws Exception JavaDoc {
94         border1 =
95             BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
96         titledBorder1 = new TitledBorder(border1, "ajc Build Paths");
97         border2 =
98             BorderFactory.createCompoundBorder(
99                 titledBorder1,
100                 BorderFactory.createEmptyBorder(5, 5, 5, 5));
101         border3 =
102             BorderFactory.createEtchedBorder(Color.white, new Color(156, 156, 158));
103         titledBorder2 = new TitledBorder(border3, "Run Options");
104         border4 =
105             BorderFactory.createCompoundBorder(
106                 titledBorder2,
107                 BorderFactory.createEmptyBorder(5, 5, 5, 5));
108         this.setLayout(borderLayout1);
109         build_panel.setLayout(borderLayout4);
110         classToRun_field.setFont(new java.awt.Font JavaDoc("SansSerif", 0, 11));
111         classToRun_field.setMinimumSize(new Dimension(200, 21));
112         classToRun_field.setPreferredSize(new Dimension(250, 21));
113         jLabel4.setFont(new java.awt.Font JavaDoc("Dialog", 0, 11));
114         jLabel4.setText("Fully qualified name for main class to run: ");
115         buildPaths_panel.setLayout(flowLayout1);
116         runOptions_panel.setBorder(border4);
117         buildPaths_panel.setBorder(border2);
118         classpath_field.setFont(new java.awt.Font JavaDoc("SansSerif", 0, 11));
119         classpath_field.setMinimumSize(new Dimension(100, 21));
120         classpath_field.setPreferredSize(new Dimension(150, 21));
121         outputPath_field.setPreferredSize(new Dimension(225, 21));
122         outputPath_field.setMinimumSize(new Dimension(100, 21));
123         outputPath_field.setFont(new java.awt.Font JavaDoc("SansSerif", 0, 11));
124         jLabel16.setText("Classpath (defaults to current directory): ");
125         jLabel16.setPreferredSize(new Dimension(200, 25));
126         jLabel16.setMaximumSize(new Dimension(400, 25));
127         jLabel16.setFont(new java.awt.Font JavaDoc("Dialog", 0, 11));
128         jLabel15.setMaximumSize(new Dimension(400, 25));
129         jLabel15.setFont(new java.awt.Font JavaDoc("Dialog", 0, 11));
130         jLabel15.setPreferredSize(new Dimension(230, 25));
131         jLabel15.setText("Output path (defaults to current directory): ");
132         titledBorder1.setTitleFont(new java.awt.Font JavaDoc("Dialog", 0, 11));
133         titledBorder2.setTitleFont(new java.awt.Font JavaDoc("Dialog", 0, 11));
134         runOptions_panel.add(jLabel4, null);
135         runOptions_panel.add(classToRun_field, null);
136         build_panel.add(buildPaths_panel, BorderLayout.CENTER);
137         build_panel.add(runOptions_panel, BorderLayout.SOUTH);
138         compileOptions_box2.add(outputPath_field, null);
139         compileOptions_box2.add(classpath_field, null);
140         compileOptions_box3.add(jLabel15, null);
141         compileOptions_box3.add(jLabel16, null);
142         buildPaths_panel.add(compileOptions_box3, null);
143         buildPaths_panel.add(compileOptions_box2, null);
144         this.add(build_panel, BorderLayout.NORTH);
145     }
146
147 }
Popular Tags