Results 1 to 3 of 3

Thread: Grapics =P

  1. #1
    santa's Avatar
    santa is offline Senior Member
    Join Date
    Nov 2009
    Location
    Sweden
    Posts
    208
    Rep Power
    9

    Default Grapics =P

    so ... i have a grapics class that paintsCompnent ...

    my problem is this :

    Java Code:
    Font font = new Font("Helvetica", Font.BOLD,  14);
    
    
        
        public void paintComponent(Graphics g) {
    
    
            g.setFont(font);
            (DRAW STRINGS HERE)
    }
    so ... when i paint the text with setfont there is some delay...
    and when i dont set the font its super fast ... (just outcommect the setFont).. I really want it set a font ... is there a reason for this delay? =P

    thanks =)

  2. #2
    Norm's Avatar
    Norm is online now Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    19,904
    Rep Power
    30

    Default

    Could post a small program the compiles and executes and demonstrates the problem?

  3. #3
    camickr is offline Senior Member
    Join Date
    Jul 2009
    Posts
    1,236
    Rep Power
    10

    Default

    Unless you are using multiple Font's in the paintComponent() method you should not be setting the Font there. You should just be using:

    Java Code:
    MyComponent component = new MyComponent();
    component.setFont(...);
    Then the Graphics object will already be set with the proper Font.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •