Как изменить размер текста в Java

Я видел, что в фотошопе текст можно легко изменить, просто перетаскивая его. Как мы можем сделать то же самое в Java? Любая идея о том, как изменить размер текста в Java? Добавлен снимок буквы "А" изменен в фотошопе

Пожалуйста, дайте мне знать, что не так с этим кодом?

public class ResizeImage extends JFrame {

    public ResizeImage(){
        JPanel panel = new JPanel(){
            public void paintComponent(Graphics g) {
                // In your paint(Graphics g) method
                // Create a buffered image for use as text layer
                BufferedImage textLayer = new BufferedImage(240, 240, 
                                              BufferedImage.TYPE_INT_RGB);

                // Get the graphics instance of the buffered image
            Graphics2D gBuffImg = textLayer.createGraphics();

                // Draw the string
                gBuffImg.drawString("Hello World", 10, 10);

                // Rescale the string the way you want it
                gBuffImg.scale(200, 50);

                // Draw the buffered image on the output's graphics object
                g.drawImage(textLayer, 0, 0, null);
                gBuffImg.dispose();
            }
        };
        add(panel);
    }

    public static void main(String [] args){
        ResizeImage frame = new ResizeImage();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 
        frame.setSize(300, 300);
        frame.setVisible(true);
    }
} 

Ответы на вопрос(5)

Ваш ответ на вопрос