netBeans gui问题 [英] netBeans gui problem

查看:137
本文介绍了netBeans gui问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在netBeans中设计了这个gui,它有一个画布,一些JtextAreas和一个Jbutton。它在预览中看起来很棒,问题是当我运行实际程序时文本区域被淹没,直到程序在其中打印出一些东西,然后它们扩展到它们的完整大小,Jbutton是不可见的,直到我将鼠标移到它上面然后它保持可见,还有一个Jlabel,只是在预览中才会出现在程序中。我之前已经在netbeans中设计了一个程序,但没有遇到这些问题。知道我可能做错了吗?

I have designed this gui in netBeans which has a canvas , a couple of JtextAreas and a Jbutton. It looks great in preview, the problem is when I run the actual program the text areas are shurnk until the program prints something in them, then they expand to their full size, the Jbutton is invisible until I mouse over it then it stays visible, there is also a Jlabel which just doesnt show up in the program at all only in preview. I have designed one more program in netbeans before but did not have these problems. Any idea what I could be doing wrong?

推荐答案

不知道什么是错的,但你不应该使用Canvas。这是一个AWT组件,你不应该在Swing应用程序中使用AWT组件。

No idea whats wrong, but you should NOT be using a Canvas. That is an AWT component and you should not be using AWT components in a Swing application.

实际上Canvas可能是问题所在。 AWT组件被绘制在Swing组件的顶部,这可能导致问题。这可能就是为什么鼠标强制按钮通过画布显示的原因。我从未混合过AWT / SWING组件,所以我不知道你会遇到什么奇怪的绘画文物。

Actually the Canvas could be the problem. AWT components are painted on top of Swing components which could be causing the problem. That might be why the mouse over forces the button to show through the Canvas. I've never mixed AWT/SWING components so I don't know what wierd painting artifacts you will encounter.

这篇关于netBeans gui问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆