抱歉标题含糊不清但我想不出我想在标题中做什么.无论如何,对于文本覆盖图像,我使用了JLabel文本并将其添加到Icon中.
JLabel icon = new JLabel(new ImageIcon);
icon.setLayout(new GridBagLayout());
add(icon);
JLabel text = new JLabel();
text.setText(language.getString("translation"));
text.setLocation(10, 10);
text.setSize(text.getPreferredSize());
icon.add(text);
Run Code Online (Sandbox Code Playgroud)
我正在为我的应用程序做i18n,每次切换区域设置时,它都会将相同的JLabel添加到上一个,这样您就可以看到彼此重叠的文本了.如何使用相同的Jlabel而不是在顶部添加新的Jlabel?
谢谢