/* Copyright (c) 2009 The Regents of the University of California. All rights reserved. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, modify, and distribute this software and its documentation for any purpose, provided that the above copyright notice and the following two paragraphs appear in all copies of this software. IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.. */ /* * findReplace.java * * Created on May 23, 2010, 1:35:55 PM */ package org.clothocad.library.sequencelight; /** * * @author jcanderson */ public class findReplace extends javax.swing.JDialog { /** Creates new form findReplace */ public findReplace(java.awt.Frame parent, boolean modal, seqPanel panel) { super(parent, modal); _panel = panel; setLocationByPlatform(true); setResizable(false); initComponents(); getRootPane().setDefaultButton(FindButton); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the Form Editor. */ @SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents private void initComponents() { jTextField1 = new javax.swing.JTextField(); CancelButton = new javax.swing.JButton(); FindButton = new javax.swing.JButton(); casecheck = new javax.swing.JCheckBox(); revcompcheck = new javax.swing.JCheckBox(); HighlightButton = new javax.swing.JButton(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); CancelButton.setText("Cancel"); CancelButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { CancelButtonActionPerformed(evt); } }); FindButton.setText("Find"); FindButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { FindButtonActionPerformed(evt); } }); casecheck.setText("Match case"); revcompcheck.setText("Also find rev-comp"); HighlightButton.setText("Highlight"); HighlightButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { HighlightButtonActionPerformed(evt); } }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE, 453, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGap(10, 10, 10) .addComponent(casecheck) .addGap(18, 18, 18) .addComponent(revcompcheck) .addGap(18, 18, 18) .addComponent(FindButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(HighlightButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(CancelButton) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 7, Short.MAX_VALUE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(casecheck) .addComponent(revcompcheck) .addComponent(FindButton) .addComponent(HighlightButton) .addComponent(CancelButton)) .addContainerGap()) ); pack(); }// </editor-fold>//GEN-END:initComponents private void FindButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_FindButtonActionPerformed sendSearch(false); }//GEN-LAST:event_FindButtonActionPerformed private void CancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_CancelButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_CancelButtonActionPerformed private void HighlightButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_HighlightButtonActionPerformed sendSearch(true); }//GEN-LAST:event_HighlightButtonActionPerformed private void sendSearch(boolean ishighlight) { setVisible(false); String searchstr = jTextField1.getText(); boolean matchcase = casecheck.isSelected(); boolean revcomp = revcompcheck.isSelected(); _panel.receiveFind(searchstr, matchcase, revcomp, ishighlight); } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton CancelButton; private javax.swing.JButton FindButton; private javax.swing.JButton HighlightButton; private javax.swing.JCheckBox casecheck; private javax.swing.JTextField jTextField1; private javax.swing.JCheckBox revcompcheck; // End of variables declaration//GEN-END:variables private seqPanel _panel; }