Results 1 to 2 of 2
  1. #1
    reis3k is offline Member
    Join Date
    Aug 2009
    Posts
    12
    Rep Power
    0

    Default clearing/reseting text fields in GUI

    Hi All!

    I have some text field filed in when an item in the list field is selected:
    Java Code:
     private void jList1ValueChanged(javax.swing.event.ListSelectionEvent evt) {                                    
    
            String fileName = new Filename(jList1.getSelectedValue().toString(),'\\', '.').filenamext();
    
            SearchFiles searchfiles = new SearchFiles();
            try {
                searchfiles.SearchIndex(fileName);
            } catch (Exception ex) {
                Logger.getLogger(EBookView.class.getName()).log(Level.SEVERE, null, ex);
            }
    
            jTextField1.setText(jList1.getSelectedValue().toString());
            jTextField2.setText(searchfiles.title);
            jTextField3.setText(searchfiles.author);
            jTextField4.setText(searchfiles.comments);
            jTextField5.setText(searchfiles.keywords);
            jTextField6.setText(searchfiles.description);
    }
    When i select one item from list field 6 text fields are getting full with some text. Afterward, when I select another item from list field, onlt the first field is getting updated but the rest stay with older values.

    I tried to add jTextField2.setText(""); to the begining to reset but didn't work. What can i do?

  2. #2
    erversteeg is offline Member
    Join Date
    Dec 2010
    Posts
    12
    Rep Power
    0

    Default

    If you post runnable code it would be easier to help you. Have you tried JComponent.revalidate() on the parent component?

Similar Threads

  1. reseting text fields; .setText("") best option?
    By Unsub in forum Java Applets
    Replies: 2
    Last Post: 02-23-2010, 02:48 AM
  2. searching a row using text fields
    By bigj in forum New To Java
    Replies: 1
    Last Post: 02-03-2010, 11:28 AM
  3. Problem With Text Fields!
    By freshoreo in forum AWT / Swing
    Replies: 3
    Last Post: 08-04-2008, 09:52 PM
  4. Demonstration of text fields in SWT
    By Java Tip in forum SWT
    Replies: 0
    Last Post: 07-25-2008, 02:20 PM
  5. Help with text fields in Java
    By romina in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 05:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •