weimingtom / loon-simple

Automatically exported from code.google.com/p/loon-simple
1 stars 0 forks source link

NullPointerException for Tooltip of LButton #12

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create a class SeanTestScreen extends Screen
2. add following code in constructor:
        LButton button = new LButton("1", 0, 0, 25, 25);
        button.setBackground(Color.white);
        button.setToolTipText("this is a tooltip");
        button.setAlpha(1);
        add(button);
3. Run it.
4. Move cursor into screen.

What is the expected output? What do you see instead?
A NullPointException.

What version of the product are you using? On what operating system?
0.2.7, windows7, jdk 1.6.0.21

Please provide any additional information below.

Exception in thread "LGame-View1" java.lang.NullPointerException
    at org.loon.framework.game.simple.core.graphics.window.LToolTip.show(LToolTip.java:107)
    at org.loon.framework.game.simple.core.graphics.window.LToolTip.update(LToolTip.java:75)
    at org.loon.framework.game.simple.core.graphics.LContainer.update(LContainer.java:175)
    at org.loon.framework.game.simple.core.graphics.Desktop.update(Desktop.java:128)
    at org.loon.framework.game.simple.core.graphics.Screen.runTimer(Screen.java:1112)
    at org.loon.framework.game.simple.Java2DView.run(Java2DView.java:398)
    at java.lang.Thread.run(Thread.java:619)

Original issue reported on code.google.com by yichen1...@gmail.com on 13 Sep 2010 at 4:42

GoogleCodeExporter commented 9 years ago
通常显示LButton需要至少一张图片作为按钮背景,因为您始终�
��有设置相关图片(比如执行setImages(BufferedImage[] 
images)),LButton找不到按钮图,而生成空白背景图的时机又较to
oltip显示为晚,导致在矫正tooltip位置时产生null错误,最终导�
��创建失败。

这种现象可能会影响到用户的正常使用,我刚刚已经增加了��
�关null判定,修正会跟随0.2.8版一起发布,非常感谢您的告知�
��

Original comment by loontest@gmail.com on 13 Sep 2010 at 12:55