001: /*
002: * TestDesigner.java
003: *
004: * Created on December 7, 2006, 2:54 PM
005: */
006:
007: package it.businesslogic.ireport.data;
008:
009: import javax.swing.JOptionPane;
010:
011: /**
012: *
013: * @author gtoffoli
014: */
015: public class TestDesigner extends javax.swing.JDialog {
016:
017: private String query = "";
018: private int dialogResult = JOptionPane.CANCEL_OPTION;
019:
020: /** Creates new form TestDesigner */
021: public TestDesigner(java.awt.Dialog parent, boolean modal) {
022: super (parent, modal);
023: initComponents();
024: }
025:
026: public void setQuery(String s) {
027: query = s;
028: jTextArea1.setText(s);
029: }
030:
031: public String getQuery() {
032: return query;
033: }
034:
035: /** This method is called from within the constructor to
036: * initialize the form.
037: * WARNING: Do NOT modify this code. The content of this method is
038: * always regenerated by the Form Editor.
039: */
040: // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
041: private void initComponents() {
042: java.awt.GridBagConstraints gridBagConstraints;
043:
044: jScrollPane1 = new javax.swing.JScrollPane();
045: jTextArea1 = new javax.swing.JTextArea();
046: jButton1 = new javax.swing.JButton();
047: jButton2 = new javax.swing.JButton();
048:
049: getContentPane().setLayout(new java.awt.GridBagLayout());
050:
051: setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
052: jScrollPane1.setPreferredSize(new java.awt.Dimension(400, 300));
053: jTextArea1.setColumns(20);
054: jTextArea1.setRows(5);
055: jScrollPane1.setViewportView(jTextArea1);
056:
057: gridBagConstraints = new java.awt.GridBagConstraints();
058: gridBagConstraints.gridwidth = 2;
059: gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
060: gridBagConstraints.weightx = 1.0;
061: gridBagConstraints.weighty = 1.0;
062: gridBagConstraints.insets = new java.awt.Insets(4, 4, 0, 4);
063: getContentPane().add(jScrollPane1, gridBagConstraints);
064:
065: jButton1.setText("OK");
066: jButton1.addActionListener(new java.awt.event.ActionListener() {
067: public void actionPerformed(java.awt.event.ActionEvent evt) {
068: jButton1ActionPerformed(evt);
069: }
070: });
071:
072: gridBagConstraints = new java.awt.GridBagConstraints();
073: gridBagConstraints.gridx = 0;
074: gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
075: gridBagConstraints.weightx = 1.0;
076: gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
077: getContentPane().add(jButton1, gridBagConstraints);
078:
079: jButton2.setText("Cancel");
080: jButton2.addActionListener(new java.awt.event.ActionListener() {
081: public void actionPerformed(java.awt.event.ActionEvent evt) {
082: jButton2ActionPerformed(evt);
083: }
084: });
085:
086: gridBagConstraints = new java.awt.GridBagConstraints();
087: gridBagConstraints.gridx = 1;
088: gridBagConstraints.insets = new java.awt.Insets(4, 4, 4, 4);
089: getContentPane().add(jButton2, gridBagConstraints);
090:
091: pack();
092: }// </editor-fold>//GEN-END:initComponents
093:
094: private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
095:
096: setDialogResult(JOptionPane.CANCEL_OPTION);
097: setVisible(false);
098: dispose();
099: }//GEN-LAST:event_jButton2ActionPerformed
100:
101: private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
102:
103: query = jTextArea1.getText();
104: setDialogResult(JOptionPane.OK_OPTION);
105: setVisible(false);
106: dispose();
107:
108: }//GEN-LAST:event_jButton1ActionPerformed
109:
110: public int getDialogResult() {
111: return dialogResult;
112: }
113:
114: public void setDialogResult(int dialogResult) {
115: this .dialogResult = dialogResult;
116: }
117:
118: // Variables declaration - do not modify//GEN-BEGIN:variables
119: private javax.swing.JButton jButton1;
120: private javax.swing.JButton jButton2;
121: private javax.swing.JScrollPane jScrollPane1;
122: private javax.swing.JTextArea jTextArea1;
123: // End of variables declaration//GEN-END:variables
124:
125: }
|