我已经看到,在photoshop文本中只需拖动即可轻松调整大小.我们如何在Java中做同样的事情?关于如何在java中调整文本大小的任何想法?添加了在photoshop中调整大小的字母"A"的快照

请告诉我这段代码有什么问题?
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 …Run Code Online (Sandbox Code Playgroud)