Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Alvinkiang

macrumors newbie
Original poster
Apr 24, 2006
14
0
Does anyone knows how to set the text field to editable of non-editable according to what it read in the XML??
e.g if XML reads
<edit> True</edit>

for(int l=total;l<2*total1;l++)
{
text1=new JTextField(newString[l]);
text1.setBounds(newPos[l],newPos[l+1],100,30);
text1.setEditable(false);<--------------------------- can be set to true
text1.setText("123");
panel.add(text1);
 

Alvinkiang

macrumors newbie
Original poster
Apr 24, 2006
14
0
therevolution said:
How are you reading in the XML?


i read whether inside this line <edit></edit> is it true or false... and i want the textfield editable to go according to it...

any idea?
 

frood

macrumors newbie
Nov 13, 2003
6
0
earth
When you're reading in the XML you could create an boolean array to store whether or not the textfields should be editable. Then when you loop through creating them read back the array values.

But your description wasn't very clear, so I'm not sure if this is what you want.
 

therevolution

macrumors 6502
May 12, 2003
468
0
So, if you have the value somewhere already...

Code:
boolean isTextFieldEditable;
// set isTextFieldEditable to the value you read in from the XML

text1.setEditable(isTextFieldEditable);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.