• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Assigning variables with dynamic names in Javafx level

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,

I am working on a specific project that includes javafx(visualization) and Java SE.Unfortunately ı couldn't solve one problem

The problem is;

I would like to assign variables with dynamic name like "label1,label2,label3,label4".In this case I wanted to define "label" string and add other numbers automatically near this string using "for loop" (In instance ; "label"+1 , "label"+2, "label"+3 ).

Ofcourse I tried to use "arraylist" and "Hashmap" class.But I dont want to define any integer number to these variables.I just would like to create these variable names dynamically.Because ı will have almost 100 Label and all labels will be assigned like label1,label2,label3,label4,label5......

The reason of not defining any integer numbers to these labels i ; I will use them in java fx scene builder to initialize and set some textfields to them.

My code is;



After getting correct label , I will make : label1.setText(Global.variable.get()); -> it will set Global.variable string value to labe1 ,label2, label3 ................label100

Thank you in advance.
 
I knew that guy would be trouble! Thanks tiny ad!
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic