954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Applet sizing problem

I was given a font finder program, but I need to resize the applet... any suggestions on where and what code is needed to fit the applet to a specific size? If not, is there a setting in eclipse that will work?

public Dimension getPreferredSize() {
        return new Dimension(800,800);// this will not resize the applet
    }

    public void paintComponent(Graphics g) {
        int x = getWidth()/2 - metrics.stringWidth(text)/2;// this will not resize the applet
        int y = getHeight() - 80; // this will not resize the applet
    }
}

Thanks!

abbyo
Newbie Poster
18 posts since May 2010
Reputation Points: 10
Solved Threads: 1
 

Just realized resizing goes under init().

setSize(500, 500);


It works now!

abbyo
Newbie Poster
18 posts since May 2010
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: