Results 1 to 5 of 5
  1. #1
    okabeer is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default [SOLVED] using checkbox to set textfeild's un/editable parameter

    Hi

    I am using netbeans since its easier for me to creat the gui.

    now i am working on making it linked with each other

    here is my code where my checkbox controls the text feild i.e. if selected it is not editable but when unchecked it is editable

    for soem reason nothing works

    any hints/tips

    ALSO can i do this using the connection wizard in netbeans

    private void lockCBItemStateChanged(java.awt.event.ItemEvent evt) {
    // this locks and unlocks all the desired textfields
    if(lockCB.isSelected()==true)
    tstepsTF.setEditable(false);
    else
    tstepsTF.setEditable(true);
    }

  2. #2
    okabeer is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default also

    I also tried this

    private void lockCBItemStateChangedtest(java.awt.event.ItemEven t evt) {
    tstepsTF.setEditable(tstepsTF.isEditable());
    }

  3. #3
    OrangeDog's Avatar
    OrangeDog is offline Senior Member
    Join Date
    Jan 2009
    Location
    Cambridge, UK
    Posts
    838
    Rep Power
    6

    Default

    Where is that code? It should be in some kind of ItemListener, with the signature
    Java Code:
    public void itemStateChanged(ItemEvent evt)
    and added to the checkbox with addItemListener() otherwise it will not work.
    Don't forget to mark threads as [SOLVED] and give reps to helpful posts.
    How To Ask Questions The Smart Way

  4. #4
    okabeer is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default yea its present

    yup its present in the auto generated code by netbeans

    lockCB.addItemListener(new java.awt.event.ItemListener() {
    public void itemStateChanged(java.awt.event.ItemEvent evt) {
    lockCBItemStateChanged(evt);
    }
    });

    also

    im using the preview design window that should not be a big deal rather than running it right?

  5. #5
    okabeer is offline Member
    Join Date
    Apr 2009
    Posts
    15
    Rep Power
    0

    Default

    oh my bad everything was good except the preview design... it doesn't represent the same thing as a run mode haha sorry i guess someone can put this as solved...

Similar Threads

  1. Using Editable Pdf form fields in Application
    By jiten.mistry in forum Advanced Java
    Replies: 5
    Last Post: 09-21-2011, 09:37 PM
  2. Auto updation of Editable Column Indexes
    By Gajesh Tripathi in forum AWT / Swing
    Replies: 0
    Last Post: 10-23-2008, 11:23 AM
  3. Creating a non-editable combo box
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-07-2008, 05:45 PM
  4. Jtree - making parts editable
    By kmarie in forum AWT / Swing
    Replies: 1
    Last Post: 07-27-2007, 03:34 AM
  5. Replies: 4
    Last Post: 05-19-2007, 12:15 PM

Posting Permissions

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