testconfigurationdialog.java.svn-base
来自「cqME :java framework for TCK test.」· SVN-BASE 代码 · 共 351 行 · 第 1/2 页
SVN-BASE
351 行
}
});
jCancelButton.setText("Cancel");
jCancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jCancelButtonActionPerformed(evt);
}
});
org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jLabel1)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jCurTestPkgTextField, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 333, Short.MAX_VALUE))
.add(jLabel2)
.add(jLabel3)
.add(layout.createSequentialGroup()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
.add(jTestedAppScrollPane, 0, 0, Short.MAX_VALUE)
.add(jTestedPlatformScrollPane, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 364, Short.MAX_VALUE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jRemoveAppCpButton)
.add(jAddAppCpButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)
.add(jRemovePlatformCpButton)
.add(jAddPlatformCpButton, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 73, Short.MAX_VALUE)))
.add(org.jdesktop.layout.GroupLayout.TRAILING, layout.createSequentialGroup()
.add(jOkButton, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 74, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jCancelButton)))
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.addContainerGap()
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jLabel1)
.add(jCurTestPkgTextField, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel2)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(jTestedPlatformScrollPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 96, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
.add(layout.createSequentialGroup()
.add(jAddPlatformCpButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jRemovePlatformCpButton)))
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jLabel3)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
.add(layout.createSequentialGroup()
.add(jAddAppCpButton)
.addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
.add(jRemoveAppCpButton))
.add(jTestedAppScrollPane, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 93, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
.add(37, 37, 37)
.add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
.add(jCancelButton)
.add(jOkButton))
.addContainerGap())
);
pack();
}// </editor-fold>//GEN-END:initComponents
private void jCancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jCancelButtonActionPerformed
dispose();
}//GEN-LAST:event_jCancelButtonActionPerformed
private Vector getDataFromJTable(JTable table) {
Vector data = new Vector();
int iRowCount = table.getRowCount();
for (int i = 0; i < iRowCount; i++) {
data.add(table.getModel().getValueAt(i, 0));
}
return data;
}
private void jRemoveAppCpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRemoveAppCpButtonActionPerformed
int iRow = jTestedAppTable.getSelectedRow();
if (iRow == -1) {
return;
}
((DefaultTableModel)jTestedAppTable.getModel()).removeRow(iRow);
}//GEN-LAST:event_jRemoveAppCpButtonActionPerformed
private void jAddAppCpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAddAppCpButtonActionPerformed
JFileChooser f = new JFileChooser();
f.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
f.showOpenDialog(this);
File selFile = f.getSelectedFile();
if (selFile != null) {
String path = selFile.getAbsolutePath();
((DefaultTableModel)jTestedAppTable.getModel()).addRow(new String[] {path});
}
}//GEN-LAST:event_jAddAppCpButtonActionPerformed
private void jRemovePlatformCpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jRemovePlatformCpButtonActionPerformed
int iRow = jTestedPlatformTable.getSelectedRow();
if (iRow == -1) {
return;
}
((DefaultTableModel)jTestedPlatformTable.getModel()).removeRow(iRow);
}//GEN-LAST:event_jRemovePlatformCpButtonActionPerformed
private void jAddPlatformCpButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jAddPlatformCpButtonActionPerformed
JFileChooser f = new JFileChooser();
f.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
f.showOpenDialog(this);
File selFile = f.getSelectedFile();
if (selFile == null) {
return;
}
String path = selFile.getAbsolutePath();
((DefaultTableModel)jTestedPlatformTable.getModel()).addRow(new String[] {path});
}//GEN-LAST:event_jAddPlatformCpButtonActionPerformed
private void jOkButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jOkButtonActionPerformed
Vector platformCp = getDataFromJTable(jTestedPlatformTable);
Vector appCp = getDataFromJTable(jTestedAppTable);
TestConfiguration conf = new TestConfiguration(
jCurTestPkgTextField.getText() + "/test.config",
platformCp,
appCp);
if (!initConf.equals(conf)) {
conf.store();
}
dispose();
}//GEN-LAST:event_jOkButtonActionPerformed
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new TestConfigurationDialog(new javax.swing.JFrame(), true).setVisible(true);
}
});
}
private TestConfiguration initConf;
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton jAddAppCpButton;
private javax.swing.JButton jAddPlatformCpButton;
private javax.swing.JButton jCancelButton;
private javax.swing.JTextField jCurTestPkgTextField;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JButton jOkButton;
private javax.swing.JButton jRemoveAppCpButton;
private javax.swing.JButton jRemovePlatformCpButton;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JTable jTable1;
private javax.swing.JScrollPane jTestedAppScrollPane;
private javax.swing.JTable jTestedAppTable;
private javax.swing.JScrollPane jTestedPlatformScrollPane;
private javax.swing.JTable jTestedPlatformTable;
// End of variables declaration//GEN-END:variables
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?