Results 1 to 12 of 12
- 09-17-2010, 11:29 AM #1
Member
- Join Date
- Apr 2010
- Posts
- 32
- Rep Power
- 0
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:
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...Java Code:int count = myBeanPanelCount1.getCount(); myBeanPanelCount1.setCount(++count); jTextField2.setText(Integer.toString(myBeanPanelCount1.getCount()));
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 descriptLast edited by banhbaochay; 09-17-2010 at 11:36 AM.
- 09-20-2010, 02:43 AM #2
Member
- Join Date
- Apr 2010
- Posts
- 32
- Rep Power
- 0
Anybody help me, please :( :(
- 09-20-2010, 05:12 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
The things is most of the people are lazy to run your code and test.
- 09-20-2010, 05:12 AM #4
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Can you show me your getCount() ?
- 09-20-2010, 11:01 AM #5
Member
- Join Date
- Apr 2010
- Posts
- 32
- Rep Power
- 0
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; }
- 09-20-2010, 04:03 PM #6
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 09-20-2010, 04:05 PM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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.
- 09-21-2010, 02:30 AM #8
Member
- Join Date
- Apr 2010
- Posts
- 32
- Rep Power
- 0
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
- 09-21-2010, 02:34 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
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
- 09-21-2010, 06:45 AM #10
Member
- Join Date
- Apr 2010
- Posts
- 32
- Rep Power
- 0
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.
- 09-23-2010, 01:37 AM #11
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
- 09-28-2010, 05:59 AM #12
Member
- Join Date
- Apr 2010
- Posts
- 32
- Rep Power
- 0
Similar Threads
-
thered sync
By miko5054 in forum Threads and SynchronizationReplies: 2Last Post: 05-25-2010, 10:51 AM -
vertical sync
By afraidofdark in forum Java 2DReplies: 0Last Post: 03-25-2010, 08:54 PM -
Thread sync problems!
By barusk in forum Threads and SynchronizationReplies: 9Last Post: 04-30-2009, 05:08 PM -
How to make Beans Lazily-instantiating beans
By Java Tip in forum Java TipReplies: 0Last Post: 03-30-2008, 10:10 AM -
How to make Beans Lazily-instantiating beans
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:41 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks