Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / Java 3D / January 2004

Tip: Looking for answers? Try searching our database.

text2D change size at the same position

Thread view: 
Lars Johannes - 26 Jan 2004 21:32 GMT
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);
       }


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.