无法为 JLabel 设置 VerticalTextPosition?

cannot setVerticalTextPosition for JLabel?

我有一个带有 JLabel 文本的图标,我试图将文本垂直放置在底部,但这行不通,这是我的全部 class:

import java.awt.FlowLayout;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

public class Test {
    public static void main(String[] args) {
        JFrame frame = new JFrame("my frame");
        frame.setLayout(new FlowLayout());
        JLabel label = new JLabel("my label");
        ImageIcon mouse = new ImageIcon("mouse.jpg");
        label.setIcon(mouse);
        label.setVerticalTextPosition(SwingConstants.BOTTOM);
        frame.add(label);
        frame.setVisible(true);
        frame.setSize(500, 500);


    }
}

import java.awt.FlowLayout;

import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;

public class Test {
    public static void main(String[] args) {
        JFrame frame = new JFrame("my frame");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLayout(new FlowLayout());
        JLabel label = new JLabel("my label");
        ImageIcon mouse = new ImageIcon("mouse.jpeg");
        label.setIcon(mouse);
        label.setHorizontalTextPosition(JLabel.CENTER);
        label.setVerticalTextPosition(JLabel.BOTTOM);
        frame.add(label);
        frame.setVisible(true);
        frame.setSize(500, 500);


    }
}

参考: LabelTextPosition