27 package org.nexusformat.nxvalidate;
30 import java.util.ResourceBundle;
38 private File nxs = null;
39 private File nxdl = null;
42 private ResourceBundle bundle = null;
48 bundle = ResourceBundle.getBundle(
49 "org/nexusformat/nxvalidate/resources/nxvalidate");
57 @SuppressWarnings(
"unchecked")
59 private
void initComponents() {
61 jFileChooser1 =
new javax.swing.JFileChooser();
62 messageOptionPane =
new javax.swing.JOptionPane();
63 jPanel1 =
new javax.swing.JPanel();
64 nxsLabel =
new javax.swing.JLabel();
65 nxsTextField =
new javax.swing.JTextField();
66 openButton1 =
new javax.swing.JButton();
67 nxdlLabel =
new javax.swing.JLabel();
68 nxdcTextField =
new javax.swing.JTextField();
69 openButton2 =
new javax.swing.JButton();
70 cancelButton =
new javax.swing.JButton();
71 OKButton =
new javax.swing.JButton();
73 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
74 setTitle(
"Open Files");
77 jPanel1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
79 nxsLabel.setText(
"Load NXS:");
81 nxsTextField.setEditable(
false);
83 openButton1.setText(
"Open");
84 openButton1.addActionListener(
new java.awt.event.ActionListener() {
85 public void actionPerformed(java.awt.event.ActionEvent evt) {
86 openButton1ActionPerformed(evt);
90 nxdlLabel.setText(
"Load NXDL:");
92 nxdcTextField.setEditable(
false);
94 openButton2.setText(
"Open");
95 openButton2.addActionListener(
new java.awt.event.ActionListener() {
96 public void actionPerformed(java.awt.event.ActionEvent evt) {
97 openButton2ActionPerformed(evt);
101 cancelButton.setText(
"CANCEL");
102 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
103 public void actionPerformed(java.awt.event.ActionEvent evt) {
104 cancelButtonActionPerformed(evt);
108 OKButton.setText(
"OK");
109 OKButton.addActionListener(
new java.awt.event.ActionListener() {
110 public void actionPerformed(java.awt.event.ActionEvent evt) {
111 OKButtonActionPerformed(evt);
115 javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
116 jPanel1.setLayout(jPanel1Layout);
117 jPanel1Layout.setHorizontalGroup(
118 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
119 .addGroup(jPanel1Layout.createSequentialGroup()
121 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
122 .addGroup(jPanel1Layout.createSequentialGroup()
123 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
124 .addComponent(nxsLabel)
125 .addComponent(nxdlLabel))
126 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
127 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
128 .addComponent(nxdcTextField)
129 .addComponent(nxsTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)))
130 .addComponent(cancelButton))
132 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
133 .addComponent(openButton1)
134 .addComponent(openButton2)
135 .addComponent(OKButton))
138 jPanel1Layout.setVerticalGroup(
139 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
140 .addGroup(jPanel1Layout.createSequentialGroup()
142 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
143 .addComponent(nxsLabel)
144 .addComponent(nxsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
145 .addComponent(openButton1))
147 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
148 .addComponent(nxdlLabel)
149 .addComponent(nxdcTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
150 .addComponent(openButton2))
152 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
153 .addComponent(cancelButton)
154 .addComponent(OKButton))
155 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
158 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
159 getContentPane().setLayout(layout);
160 layout.setHorizontalGroup(
161 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
162 .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
164 layout.setVerticalGroup(
165 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
166 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
172 private void openButton1ActionPerformed(java.awt.event.ActionEvent evt) {
174 if (evt.getSource() == openButton1) {
176 int returnVal = jFileChooser1.showOpenDialog(
this);
178 if (returnVal == jFileChooser1.APPROVE_OPTION) {
179 nxs = jFileChooser1.getSelectedFile();
182 nxsTextField.setText(nxs.getAbsolutePath());
183 nxsTextField.setToolTipText(nxs.getAbsolutePath());
186 messageOptionPane.showMessageDialog(
this,
187 bundle.getString(
"notNXDLFileMessage"));
198 private void openButton2ActionPerformed(java.awt.event.ActionEvent evt) {
200 if (evt.getSource() == openButton2) {
202 int returnVal = jFileChooser1.showOpenDialog(
this);
204 if (returnVal == jFileChooser1.APPROVE_OPTION) {
205 nxdl = jFileChooser1.getSelectedFile();
208 nxdcTextField.setText(nxdl.getAbsolutePath());
209 nxdcTextField.setToolTipText(nxdl.getAbsolutePath());
212 messageOptionPane.showMessageDialog(
this,
213 bundle.getString(
"notNXDLFileMessage"));
224 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
225 if (evt.getSource() == cancelButton) {
227 this.setVisible(
false);
231 private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {
232 if (evt.getSource() == OKButton) {
234 this.setVisible(
false);
253 public static void main(String args[]) {
254 java.awt.EventQueue.invokeLater(
new Runnable() {
258 dialog.addWindowListener(
new java.awt.event.WindowAdapter() {
260 public void windowClosing(java.awt.event.WindowEvent e) {
264 dialog.setVisible(
true);
269 private javax.swing.JButton OKButton;
270 private javax.swing.JButton cancelButton;
271 private javax.swing.JFileChooser jFileChooser1;
272 private javax.swing.JPanel jPanel1;
273 private javax.swing.JOptionPane messageOptionPane;
274 private javax.swing.JTextField nxdcTextField;
275 private javax.swing.JLabel nxdlLabel;
276 private javax.swing.JLabel nxsLabel;
277 private javax.swing.JTextField nxsTextField;
278 private javax.swing.JButton openButton1;
279 private javax.swing.JButton openButton2;