|
What this is
Other links
The source code/* * RenameDialog.java * * Created on November 15, 2002, 6:42 PM */ package org.netbeans.test.editor.app.gui; /** * * @author eh103527 */ public class RenameDialog extends javax.swing.JDialog { String name; boolean state=false; /** Creates new form RenameDialog */ public RenameDialog(java.awt.Frame parent, String name) { super(parent, true); this.name=name; initComponents(); nameF.setText(name); nameF.setSelectionStart(0); nameF.setSelectionEnd(name.length()-1); pack(); setLocation(parent.getX()+(parent.getWidth()-getWidth())/2,parent.getY()+(parent.getHeight()-getHeight())/2); } /** 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. */ private void initComponents() {//GEN-BEGIN:initComponents jPanel1 = new javax.swing.JPanel(); propertyNameL = new javax.swing.JLabel(); nameF = new javax.swing.JTextField(); jPanel2 = new javax.swing.JPanel(); renameB = new javax.swing.JButton(); stornoB = new javax.swing.JButton(); setTitle("Rename"); setModal(true); setResizable(false); addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent evt) { closeDialog(evt); } }); jPanel1.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); propertyNameL.setText("New Name: "); jPanel1.add(propertyNameL); nameF.setColumns(20); jPanel1.add(nameF); getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER); jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.CENTER, 10, 10)); renameB.setText("Rename"); renameB.setSelected(true); renameB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { renameBActionPerformed(evt); } }); jPanel2.add(renameB); stornoB.setText("Storno"); stornoB.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { stornoBActionPerformed(evt); } }); jPanel2.add(stornoB); getContentPane().add(jPanel2, java.awt.BorderLayout.SOUTH); pack(); }//GEN-END:initComponents private void renameBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_renameBActionPerformed // Add your handling code here: name=nameF.getText(); state=true; close(); }//GEN-LAST:event_renameBActionPerformed private void stornoBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_stornoBActionPerformed // Add your handling code here: state=false; close(); }//GEN-LAST:event_stornoBActionPerformed /** Closes the dialog */ private void closeDialog(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_closeDialog state=false; close(); }//GEN-LAST:event_closeDialog private void close() { setVisible(false); dispose(); } /** Getter for property state. * @return Value of property state. * */ public boolean getState() { return state; } /** Getter for property name. * @return Value of property name. * */ public java.lang.String getName() { return name; } // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JTextField nameF; private javax.swing.JLabel propertyNameL; private javax.swing.JButton renameB; private javax.swing.JPanel jPanel2; private javax.swing.JButton stornoB; private javax.swing.JPanel jPanel1; // End of variables declaration//GEN-END:variables } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.