它很难为我解释它,甚至用英语更难......我有这个组件构造函数
Balonik = new BalloonTip(textfield, new JLabel("Do not devide by 0!"),
new RoundedBalloonStyle(5,5,Color.WHITE, Color.BLACK),
BalloonTip.Orientation.RIGHT_BELOW,
BalloonTip.AttachLocation.ALIGNED,
15,
15,
false
);
我把这段代码放在netbeans jFrame项目的框架构造函数中
public oknoo() {
initComponents();
Balonik = new BalloonTip(textfield, new JLabel("Do not devide by 0!"),
new RoundedBalloonStyle(5,5,Color.WHITE, Color.BLACK),
BalloonTip.Orientation.RIGHT_BELOW,
BalloonTip.AttachLocation.ALIGNED,
15,
15,
false
);
}
它正在编译,但是 BalloonTip 没有出现。
有趣的是,当我将项目导出到 eclipse(我可以在其中编辑 initComponent() 函数)并将这个组件构造函数留在 initComponent() 函数中时,它就可以工作了。所以相同的代码在 initComponent() 函数中有效,而在构造函数中无效....
我不明白。我问是因为我不能在 Eclipse 中解决这个问题并导出回 netBeans ......因为这个......
/**
* This method is called from within the constructor to initialize the form.
* WARNING: Do NOT modify this code. The content of this method is always
* regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {