28 package org.nexusformat.nxvalidate;
39 private String nxconvert = null;
52 @SuppressWarnings(
"unchecked")
54 private
void initComponents() {
56 jFileChooser1 =
new javax.swing.JFileChooser();
57 jPanel1 =
new javax.swing.JPanel();
58 nxdcLabel =
new javax.swing.JLabel();
59 nxdcTextField =
new javax.swing.JTextField();
60 openButton2 =
new javax.swing.JButton();
61 cancelButton =
new javax.swing.JButton();
62 OKButton =
new javax.swing.JButton();
64 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
65 setTitle(
"Open Files");
68 jPanel1.setBorder(javax.swing.BorderFactory.createCompoundBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5), javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.RAISED)));
70 nxdcLabel.setText(
"Location of nxconvert binary file:");
72 openButton2.setText(
"Open");
73 openButton2.addActionListener(
new java.awt.event.ActionListener() {
74 public void actionPerformed(java.awt.event.ActionEvent evt) {
75 openButton2ActionPerformed(evt);
79 cancelButton.setText(
"CANCEL");
80 cancelButton.addActionListener(
new java.awt.event.ActionListener() {
81 public void actionPerformed(java.awt.event.ActionEvent evt) {
82 cancelButtonActionPerformed(evt);
86 OKButton.setText(
"OK");
87 OKButton.addActionListener(
new java.awt.event.ActionListener() {
88 public void actionPerformed(java.awt.event.ActionEvent evt) {
89 OKButtonActionPerformed(evt);
93 javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
94 jPanel1.setLayout(jPanel1Layout);
95 jPanel1Layout.setHorizontalGroup(
96 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
97 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
99 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
100 .addGroup(jPanel1Layout.createSequentialGroup()
101 .addComponent(cancelButton)
102 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 655, Short.MAX_VALUE)
103 .addComponent(OKButton))
104 .addGroup(jPanel1Layout.createSequentialGroup()
105 .addComponent(nxdcLabel)
106 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
107 .addComponent(nxdcTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 479, Short.MAX_VALUE)
108 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
109 .addComponent(openButton2)))
112 jPanel1Layout.setVerticalGroup(
113 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
114 .addGroup(jPanel1Layout.createSequentialGroup()
116 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
117 .addComponent(nxdcLabel)
118 .addComponent(nxdcTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
119 .addComponent(openButton2))
121 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
122 .addComponent(OKButton)
123 .addComponent(cancelButton))
124 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
127 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
128 getContentPane().setLayout(layout);
129 layout.setHorizontalGroup(
130 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
131 .addGroup(layout.createSequentialGroup()
132 .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
135 layout.setVerticalGroup(
136 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
137 .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
143 private void openButton2ActionPerformed(java.awt.event.ActionEvent evt) {
145 if(evt.getSource() == openButton2){
147 int returnVal = jFileChooser1.showOpenDialog(
this);
149 if (returnVal == jFileChooser1.APPROVE_OPTION) {
150 nxconvert = jFileChooser1.getSelectedFile().getAbsolutePath();
151 nxdcTextField.setText(nxconvert);
152 nxdcTextField.setToolTipText(nxconvert);
160 private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
161 if(evt.getSource() == cancelButton){
163 this.setVisible(
false);
167 private void OKButtonActionPerformed(java.awt.event.ActionEvent evt) {
169 if(evt.getSource() == OKButton){
171 nxconvert = nxdcTextField.getText();
172 this.setVisible(
false);
182 nxconvert = nxconvert;
183 nxdcTextField.setText(nxconvert);
193 public static void main(String args[]) {
194 java.awt.EventQueue.invokeLater(
new Runnable() {
197 dialog.addWindowListener(
new java.awt.event.WindowAdapter() {
198 public void windowClosing(java.awt.event.WindowEvent e) {
202 dialog.setVisible(
true);
208 private javax.swing.JButton OKButton;
209 private javax.swing.JButton cancelButton;
210 private javax.swing.JFileChooser jFileChooser1;
211 private javax.swing.JPanel jPanel1;
212 private javax.swing.JLabel nxdcLabel;
213 private javax.swing.JTextField nxdcTextField;
214 private javax.swing.JButton openButton2;