Hello,
the program writes point on the screen. Now i want the pointnumbers on
the screen besides the points too.
The Problem: The textsize of 1 till 3 pt is unreadable. I choosed
textsize of 100 pt and scaled the textobjects back to normal. Now i
want to change the textsize without moving the text position with the
help of a JComboBox.
Any suggestions?
/Lars
NumberFormat nfl =
NumberFormat.getInstance(java.util.Locale.ENGLISH);
all_text2D=new TransformGroup();
all_text2D.setCapability( TransformGroup.ALLOW_TRANSFORM_READ);
all_text2D.setCapability( TransformGroup.ALLOW_TRANSFORM_WRITE);
TransformGroup tg_text2D=null;
for(int i=0;i<pkt.length;i++){
translation=new Transform3D();
translation.setScale(0.05);
translation.setTranslation(new Vector3d(pkt[i].x, pkt[i].y,
pkt[i].z));
tg_text2D=new TransformGroup();
tg_text2D.setTransform(translation);
tg_text2D.addChild(new Text2D(nfl.format(pkt[i].nr), new
Color3f(0f, 0f, 0f), "Helvetica", 100, Font.PLAIN));
all_text2D.addChild(tg_text2D);
}
contentsTransGr.addChild(all_text2D);
Lars Johannes - 28 Jan 2004 09:48 GMT
I've found one possible solution.
Below the Stimulus-Function from the behavior.
public void processStimulus(Enumeration criteria){
for(int i=0;i<targetTG.numChildren();i++){
TransformGroup tfg=(TransformGroup)targetTG.getChild(i);
tfg.getTransform(scale);
try{
scale.setScale(Double.parseDouble((String)cb_textSize.getSelectedItem())/100.0);
}catch(NumberFormatException nfe){
}
tfg.setTransform(scale);
}
wakeupOn(criterion);
}