默认
发表评论 2
想开发IM:买成品怕坑?租第3方怕贵?找开源自已撸?尽量别走弯路了... 找站长给点建议
JDK 空指针问题 界面需要拉到窗口外才会显示
阅读(17607) | 评论(2 收藏 淘帖
刚开始只显示Comobox,要鼠标移动到窗口相应位置才会有控件出现,整个面板需要拉到窗口外(例如把一半窗口拉到桌面以外再拉回来才会显示)
小白两星期前才开始真正写代码。。。从零开始望大神帮助哇。。觉得JAVA还是蛮有意思的。。


代码有点多。。。几千行左右就不贴出来了。。不知道是不是因为太多的原因。。



at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:840)
        at java.desktop/javax.swing.RepaintManager.paintDirtyRegions(RepaintManager.java:815)
        at java.desktop/javax.swing.RepaintManager.prePaintDirtyRegions(RepaintManager.java:764)
        at java.desktop/javax.swing.RepaintManager.access$1200(RepaintManager.java:69)
        at java.desktop/javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1880)
        at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:313)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:764)
        at java.desktop/java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:717)
        at java.desktop/java.awt.EventQueue$3.run(EventQueue.java:711)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:89)
        at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:734)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:199)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
        at org.jb2011.lnf.beautyeye.ch1_titlepane.BETitlePane.paintComponent(BETitlePane.java:1018)
        at java.desktop/javax.swing.JComponent.paint(JComponent.java:1075)
        at java.desktop/javax.swing.JComponent.paintChildren(JComponent.java:908)
        at java.desktop/javax.swing.JComponent.paint(JComponent.java:1084)


即时通讯网 - 即时通讯开发者社区! 来源: - 即时通讯开发者社区!

微信截图_20180616010952.png (39.83 KB, 下载次数: 877)

配置路径

配置路径

微信截图_20180616010901.png (96.9 KB, 下载次数: 926)

把下面一半拉到任务栏以下再拉出来

把下面一半拉到任务栏以下再拉出来

微信截图_20180616010809.png (416.99 KB, 下载次数: 920)

刚开始显示的样子

刚开始显示的样子
上一篇:使用BeautyEye如何设置窗体可调节大小?下一篇:使用的BeautyEye后原本设置的透明文本框的边框也没了变透明了,看不出是个文本框
推荐方案
评论 2
你是java什么版本?

另外,读一下BeautyEye源码:“at org.jb2011.lnf.beautyeye.ch1_titlepane.BETitlePane.paintComponent(BETitlePane.java:1018)”,1018行!
引用:JackJiang 发表于 2018-06-16 09:02
你是java什么版本?

另外,读一下BeautyEye源码:“at org.jb2011.lnf.beautyeye.ch1_titlepane.BETitle ...

JDK9.0  我看了一下API文档,也许是我没有建立awt 的Framed导致的吗。。一直不太会用JAVA 的Graphics等会看看文档。。然后我的声明好像也不太规范。。图片好像上传失败了。。不知道加那个首页群能不能联系到大神。。

主类的声明:public class CardLayoutDemo extends JFrame implements ActionListener {  
    public JPanel pane = null;  
    public JPanel p = null;  
    public JPanel pbt = null;
    public JPanel pan,pan1 = null;
    public CardLayout card = null;  
    public JPanel p_1=null,p_2=null,p_3=null,p_4=null,p_5=null,p_6=null,p_7=null,
                    p_12=null,p_22=null,p_32=null,p_42=null,p_52=null,p_62=null,p_72=null;   

构造器里的CardLayout:

        card = new CardLayout(0,0);  
        pane = new JPanel(card);  
        p = new JPanel();  
        pbt = new JPanel(card);
        pan = new JPanel();
        pan1 = new JPanel();

        p_1 = new JPanel();
        p_1.setLayout(new FlowLayout());  
        p_2 = new JPanel();  
        p_2.setLayout(new BorderLayout());
        p_3 = new JPanel();  
        p_3.setLayout(new BorderLayout());
        p_4 = new JPanel();
        p_5 = new JPanel();
        p_5.setLayout(new BorderLayout());

打赏楼主 ×
使用微信打赏! 使用支付宝打赏!

返回顶部