Results 1 to 12 of 12
  1. #1
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Question TextField cannot sync with my beans properties

    In Netbeans 6.9.1, I create a bean "MyBeanPanelCount" which is a class extend javax.swing.JPanel and only have a property "count (type int)" with its getter, setter. I attached it in my post.
    In new project, I use the myBeanPanelCount and 2 JTextField, 1 JButton.
    - jTextField1: bind text with binding source is myBeanPanelCount, update mode is "always sync"
    - jTextField2: display value of myBeanPanelCount's count property.
    - jButton: increase myBeanPanelCount's count property. ActionPerform of button is below:
    Java Code:
    int count = myBeanPanelCount1.getCount();
            myBeanPanelCount1.setCount(++count);
            jTextField2.setText(Integer.toString(myBeanPanelCount1.getCount()));
    Then I run this project. Initial, jTextField1 show 1 and jTextField2 display nothing. I click Count button, jTextField1 still display "1", but jTextField2 display 2, then 3, 4, 5...

    I don't understand jTextField1 not update value of myBeanPanelCount's count property. Can you explain for me?
    Thanks for reading, Sorry for my bad English :)

    DesktopApplycation1.zip is the project which I descript
    Attached Files Attached Files
    Last edited by banhbaochay; 09-17-2010 at 11:36 AM.

  2. #2
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default

    Anybody help me, please :( :(

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  4. #4
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  5. #5
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default

    Thanks Eranga for replying :)
    MyBean 's code here:
    Java Code:
    private int count;
    public int getCount() {
    return count;
    }
    public void setCount(int count) {
    this.count = count;
    }

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  7. #7
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    By the way, I've test our code and it's missing an additional library, seems it's your own. So it's not possible to compile it.

  8. #8
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default

    Hi Eranga, sorry for my later reply. I've just gone to hospital for my broken leg :(
    An additional library you said, it's MyBean.jar which is attached in my first post. You can add it as follow steps:
    - Choose Tool --> Pallete --> Swing/AWT Components
    - In new Dialog, choose Add jar Button and choose MyBean.jar. Next, choose MybeanPanelCount. Then, choose Beans folder and Finish

  9. #9
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    I'm sorry what happen to you. Hope you'll recover soon.

    Your project should contain all the resources, before sent it to anyone else. :D

  10. #10
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

    Default

    Hi eraga,
    It's my fault, I added source to my Project. Here is my project:
    DesktopApplication1.rar
    You can run my project with .jar in dist :)
    Last edited by banhbaochay; 09-21-2010 at 07:36 AM.

  11. #11
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  12. #12
    banhbaochay is offline Member
    Join Date
    Apr 2010
    Posts
    32
    Rep Power
    0

Similar Threads

  1. thered sync
    By miko5054 in forum Threads and Synchronization
    Replies: 2
    Last Post: 05-25-2010, 10:51 AM
  2. vertical sync
    By afraidofdark in forum Java 2D
    Replies: 0
    Last Post: 03-25-2010, 08:54 PM
  3. Thread sync problems!
    By barusk in forum Threads and Synchronization
    Replies: 9
    Last Post: 04-30-2009, 05:08 PM
  4. How to make Beans Lazily-instantiating beans
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 03-30-2008, 10:10 AM
  5. How to make Beans Lazily-instantiating beans
    By JavaBean in forum Java Tip
    Replies: 0
    Last Post: 09-26-2007, 08:41 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
  •