【发布时间】:2012-11-06 00:35:41
【问题描述】:
我有两个 Jtextpane 我想要做的是我从 1 个 Jtextpane 中选择文本,并且我希望它应该在选择菜单项 Edit 后出现在第二个 Jtextpane 中
我做过的
popMenu[i].addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String str = e.getActionCommand();
.....
if (str.equalsIgnoreCase("edit")) {
taSecond.setBackground(new Color(0xFBFCDD));
taSecond.setText(taFirst.getSelectedText());
System.out.println("bounds====>"+taFirst.getBounds());
taFirst.getBounds().setBounds(taFirst.getBounds());
editedText = true;
}
}
});
现在我不知道如何将编辑后的文本放回从我获得文本的位置选择的位置 谁能告诉解决方法
【问题讨论】:
-
想知道你期望它做什么:
taFirst.getBounds().setBounds(taFirst.getBounds());... 它完全没有任何作用。