Computer Science Canada

Trouble with Font

Author:  Apito [ Wed Apr 30, 2008 6:33 pm ]
Post subject:  Trouble with Font

I am having trouble with a font thing in Java. My class is using JCreator 1.4.2 I believe.

I am trying to change a section of my program to display in Wingdings, but for the life of me I cannot figure out how.

This is the section of code I have:

Java:

       public static String doZeStarz(double factor, double armsNum){
                String starz;
                starz = "";     
               
                double sniff = factor * armsNum;
                for (int x = 1; x <= sniff; x++){
                        starz = starz + "M";
                }//end for
                return starz;
        }//end doZeStarz



The variable I want to make display in wingdings font is starz.
Can anyone help with this?

Author:  HeavenAgain [ Wed Apr 30, 2008 8:36 pm ]
Post subject:  RE:Trouble with Font

i'm assuming you are doing this with graphics?

there is a method in the Graphics class called setFont() which takes Font as parameter, so all you have to do is make a new Font of your desire and pass that in, then drawString() and it should be all good Neutral


: