我需要有关如何将图像徽标放置在已包含文本的jtextpane顶部的帮助。目前,我正在使用JLabel进行操作,但未显示图像。另外,我知道它甚至不会放在jtextpane的顶部。下面是到目前为止的代码。
JLabel jLab=new JLabel();
private void openActionPerformed(java.awt.event.ActionEvent evt) {
JFileChooser jfc=new JFileChooser();
if(jfc.showOpenDialog(open) == JFileChooser.APPROVE_OPTION{
java.io.File f = jfc.getSelectedFile();
jLab.setIcon(new ImageIcon(f.getAbsolutePath()));
jtextpane.add(jLab);
}
}