0

i think i've chosen the longest way to add the deletion onto my system, is there any other way which is more efficient ? and im wondering why only mPane.JTextFields are working, but the rest like lPane.JTextFields aren't working ?

.
.    
menuItemDelete = new JMenuItem();
         menuItemDelete.setText("Delete");
         menuItemDelete.setMnemonic(KeyEvent.VK_D);
         menuItemDelete.addActionListener(
                            new DeleteActionAdapter(this));
         menuEdit.add(menuItemDelete);
      
.
.
.
	// create objects for each panels or classes to call theirs panel to add into contentPane panel
      MainTabbed mPane = new MainTabbed();
      DiverTabbed dPane=new DiverTabbed();
      LocationTabbed lPane=new LocationTabbed();
      BuddyTabbed bPane= new BuddyTabbed();
      SearchTabbed sPane= new SearchTabbed();
      
      JTextField virtual = new JTextField();

.
.
.
class DeleteActionAdapter implements ActionListener{
         UIAFrame adaptee;
        
         //JTextArea jTextArea = new JTextArea(textArea);
         
          DeleteActionAdapter(UIAFrame adaptee){
            this.adaptee = adaptee;
         }
         
          public void actionPerformed( ActionEvent e ) 
         {
            mPane.area.replaceSelection("");
            mPane.locField.replaceSelection("");
            mPane.dateField.replaceSelection("");
            mPane.ndBuddyField.replaceSelection("");
            mPane.depthField.replaceSelection("");
            mPane.firstBuddy.replaceSelection("");
            mPane.weightField.replaceSelection("");
            mPane.timeInField.replaceSelection("");
            mPane.tOutField.replaceSelection("");
            mPane.startTimeField.replaceSelection("");
            mPane.sTimeField.replaceSelection("");
            mPane.bTimeField.replaceSelection("");
            mPane.startField.replaceSelection("");
            mPane.finishField.replaceSelection("");
            mPane.airField.replaceSelection("");
            mPane.surfaceField.replaceSelection("");
            mPane.bottomField.replaceSelection("");
            mPane.equipmentArea.replaceSelection("");
            mPane.waterTypeField.replaceSelection("");
            mPane.visiField.replaceSelection("");
            mPane.diveLogField.replaceSelection("");
            mPane.diveNoField.replaceSelection("");
         
         //location panel
            lPane.nameField.replaceSelection("");
            lPane.addrField.replaceSelection("");
            lPane.cityField.replaceSelection("");
            lPane.stateField.replaceSelection("");
            lPane.zipField.replaceSelection("");
            lPane.countryField.replaceSelection("");
            lPane.emailField.replaceSelection("");
            lPane.webSiteField.replaceSelection("");
            lPane.faxField.replaceSelection("");
            lPane.offPhoneField.replaceSelection("");
            lPane.locArea.replaceSelection("");
         
         //diver panel 
            dPane.firNameField.replaceSelection("");
            dPane.lasName.replaceSelection("");
            dPane.mariStatusField.replaceSelection("");
            dPane.eAddressField.replaceSelection("");
            dPane.ageField.replaceSelection("");
            dPane.addField.replaceSelection("");
            dPane.cField.replaceSelection("");
            dPane.statField.replaceSelection("");
            dPane.zField.replaceSelection("");
            dPane.hPhoneField.replaceSelection("");
            dPane.homePField.replaceSelection("");
            dPane.bDateField.replaceSelection("");
            dPane.diveInsuranceField.replaceSelection("");
            dPane.noField.replaceSelection("");
            dPane.contactField.replaceSelection("");
            dPane.phon.replaceSelection("");
            dPane.ctyField.replaceSelection("");
         
         // buddy panel 
            bPane.first_name_Label.replaceSelection("");
            bPane.last_name_label.replaceSelection("");
            bPane.address_label.replaceSelection("");
            bPane.city_label.replaceSelection("");
            bPane.state_label.replaceSelection("");
            bPane.zip_label.replaceSelection("");
            bPane.phone_label.replaceSelection("");
            bPane.age_label.replaceSelection("");
            bPane.sex_label.replaceSelection("");
         
         //search
            sPane.keyword_label.replaceSelection("");
            sPane.log_label.replaceSelection("");
         
         }
      }
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Ezzaral
0

Well, replace selection only replaces selected text. Why are you not using setText()?

You may want to consider grouping the text entry components into a collection (List or Map perhaps) to make mass operations like that easier to handle.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.