This week's book giveaways are in the Scala and Android forums.
We're giving away four copies each of Machine Learning Systems: Designs that scale and Xamarin in Action: Creating native cross-platform mobile apps and have the authors on-line!
See this thread and this one for details.
Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

static JTextField problem!  RSS feed

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a form for users to complete multiple of them and using some buttons can go back and front between forms... But i have a problem! I have some static fields that i want them to appear on every form and the changes made to them affect all forms, but when i go back to a previous form the fields appear for a sec and then leave immediately! That doesn't happen when i am moving forward...

Any ideas why is that?
 
Rancher
Posts: 2906
18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Components can only have a single parent. You can't add the same component to more than one panel. It only appears like its working as you move forward because you don't see it being removed from the previous panel until you go back to that panel.

you should be able to create multiple components, but share the model. For example with a text field you can do:

 
Antigoni Splash
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oh ok!
But is there a particular reason why a component canno't be added twice?
 
Sheriff
Posts: 21330
87
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Antriani,

Please read your private messages.

Thank you,

Rob
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> But is there a particular reason why a component canno't be added twice?

read the first sentence of the first reply
 
please buy this thing and then I get a fat cut of the action:
Why should you try IntelliJ IDEA ?
https://coderanch.com/wiki/696337/IntelliJ-IDEA
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!