KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > memoire > vainstall > builder > gui > ProductStepLanguagePanel


1 /*
2  * $RCSfile: ProductStepLanguagePanel.java,v $
3  * @modification $Date: 2001/09/28 19:35:30 $
4  * @version $Id: ProductStepLanguagePanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
5  *
6  */

7
8 package com.memoire.vainstall.builder.gui;
9
10 import com.memoire.vainstall.VAGlobals;
11 import com.memoire.vainstall.builder.*;
12
13 import java.awt.*;
14 import java.awt.event.*;
15
16 import javax.swing.*;
17 import javax.swing.border.*;
18
19 /**
20  * This panel is shown in the product dialog
21  *
22  * This is not just a view panel because it has a reference to the
23  * VAIProductModel.
24  *
25  *
26  * @see com.memoire.vainstall.builder.gui.VAIProductInternalFrame
27  * @see javax.swing.JPanel
28  *
29  * @author Henrik Falk
30  * @version $Id: ProductStepLanguagePanel.java,v 1.1 2001/09/28 19:35:30 hfalk Exp $
31  */

32 public class ProductStepLanguagePanel extends JPanel implements FocusListener {
33
34     private VAIProductModel model;
35
36     private final static Border loweredBorder = new SoftBevelBorder(BevelBorder.LOWERED);
37
38     RequiredTextField installFileNameField;
39
40     JComboBox uiInstallerBox;
41
42     public ProductStepLanguagePanel() {
43
44         setBorder(loweredBorder);
45
46         GridBagLayout layout = new GridBagLayout();
47         setLayout(layout);
48
49         GridBagConstraints contraint=new GridBagConstraints();
50
51         // Filename
52
JLabel installFileNameLabel = new JLabel();
53         installFileNameLabel.setText("Filename of generated package:");
54         contraint.fill = GridBagConstraints.BOTH;
55         contraint.insets = new Insets(16,16,0,16);
56         contraint.anchor = GridBagConstraints.WEST;
57         contraint.gridx = 0;
58         contraint.gridy = 0;
59         contraint.gridwidth = 1;
60         contraint.gridheight = 1;
61         contraint.weightx = 0;
62         contraint.weighty = 0;
63         layout.setConstraints(installFileNameLabel,contraint);
64         add(installFileNameLabel);
65
66         installFileNameField = new RequiredTextField();
67         contraint.fill=GridBagConstraints.HORIZONTAL;
68         contraint.insets=new Insets(16,16,0,16);
69         contraint.anchor=GridBagConstraints.CENTER;
70         contraint.gridx=1;
71         contraint.gridy=0;
72         contraint.gridwidth=1;
73         contraint.gridheight=1;
74         contraint.weightx=1;
75         contraint.weighty=0;
76         layout.setConstraints(installFileNameField,contraint);
77         add(installFileNameField);
78
79         // Installer UI
80
JLabel uiInstallerLabel = new JLabel();
81         uiInstallerLabel.setText("Installtion UI:");
82         contraint.fill = GridBagConstraints.BOTH;
83         contraint.insets = new Insets(16,16,0,16);
84         contraint.anchor = GridBagConstraints.WEST;
85         contraint.gridx = 0;
86         contraint.gridy = 1;
87         contraint.gridwidth = 1;
88         contraint.gridheight = 1;
89         contraint.weightx = 0;
90         contraint.weighty = 0;
91         layout.setConstraints(uiInstallerLabel,contraint);
92         add(uiInstallerLabel);
93
94         uiInstallerBox = new JComboBox();
95         uiInstallerBox.addItem("Graphics");
96         uiInstallerBox.addItem("Enhanced Graphics");
97         uiInstallerBox.addItem("Text");
98         uiInstallerBox.addItem("Ansi");
99         uiInstallerBox.setSelectedIndex(0);
100         contraint.fill=GridBagConstraints.HORIZONTAL;
101         contraint.insets=new Insets(16,16,0,16);
102         contraint.anchor=GridBagConstraints.CENTER;
103         contraint.gridx=1;
104         contraint.gridy=1;
105         contraint.gridwidth=1;
106         contraint.gridheight=1;
107         contraint.weightx=1;
108         contraint.weighty=0;
109         layout.setConstraints(uiInstallerBox,contraint);
110         add(uiInstallerBox);
111
112         JPanel fillPanel = new JPanel();
113         contraint.fill=GridBagConstraints.BOTH;
114         contraint.insets=new Insets(4,4,4,4);
115         contraint.anchor=GridBagConstraints.CENTER;
116         contraint.gridx=0;
117         contraint.gridy=2;
118         contraint.gridwidth=1;
119         contraint.gridheight=1;
120         contraint.weightx=0;
121         contraint.weighty=1;
122         layout.setConstraints(fillPanel,contraint);
123         add(fillPanel);
124
125     }
126
127
128     /**
129      * save
130      */

131     public void save() {
132     }
133
134     /**
135      * initialize the panel
136      */

137     public void initialize(VAIProductModel model) {
138         this.model = model;
139
140         installFileNameField.addFocusListener(this);
141 // installFileNameField.initialize(model,"Install Filename");
142
/*
143         if (model.getLicenseName() != null) {
144             licenseFileNameField.setText(model.getLicenseName());
145         }
146         if (model.getLicenseEncoding() != null) {
147             encodingField.setText(model.getLicenseEncoding());
148         }
149 */

150     }
151
152     /**
153      * stop
154      */

155     public void stop() {
156     }
157
158     public void focusGained(FocusEvent evt) {
159     }
160
161     public void focusLost(FocusEvent evt) {
162
163         if (evt.getSource() == installFileNameField && installFileNameField.hasChanged() == true) {
164             model.setPackageName(installFileNameField.getText());
165             installFileNameField.setChanged(false);
166         }
167     }
168 }
169
Popular Tags