avatar
simple swing question# Java - 爪哇娇娃
c*u
1
I tried to draw a graph on a jpanel, then put jtextareas and
jlabels onto that jpanel, the textareas and jlabels form an area, which
always cover my grphics completely and mess it up. Any solution?
avatar
c*u
2
ft. when I changed jtextarea to textarea, it works fine.

【在 c****u 的大作中提到】
: I tried to draw a graph on a jpanel, then put jtextareas and
: jlabels onto that jpanel, the textareas and jlabels form an area, which
: always cover my grphics completely and mess it up. Any solution?

avatar
c*t
3
Textarea is AWT. Mixing Swing with AWT is not good.
Perhaps, if you give a few screen shots, we will better understand
your problem.

【在 c****u 的大作中提到】
: ft. when I changed jtextarea to textarea, it works fine.
avatar
g*y
4
You need to set the size and location of components, if you didn't set the
LayoutManager. By default, Java use flowlayout.

【在 c****u 的大作中提到】
: I tried to draw a graph on a jpanel, then put jtextareas and
: jlabels onto that jpanel, the textareas and jlabels form an area, which
: always cover my grphics completely and mess it up. Any solution?

avatar
c*u
5
yeah, I know it's no good. but deadline is approaching, gotta have a working
version first. I get graphics from a jpanel, draw something,
then put some text areas onto the graph for user input. To my surprise,
jtextextareas always form a partial "new panel" which covers my graph.
I set layout as null and just give the coordinates and size of the
text areas. Also, when I set background color of that jpanel,
I can't display my graphics properly as well. Perhaps I
should reimplement my drawgraph me

【在 c*****t 的大作中提到】
: Textarea is AWT. Mixing Swing with AWT is not good.
: Perhaps, if you give a few screen shots, we will better understand
: your problem.

avatar
m*t
6

I know you probably have taken care of the basics, but just to get
the insanity out of the way - you are inserting your j*** components
into the rootpane of the jpanel not the jpanel itself, right?

【在 c****u 的大作中提到】
: yeah, I know it's no good. but deadline is approaching, gotta have a working
: version first. I get graphics from a jpanel, draw something,
: then put some text areas onto the graph for user input. To my surprise,
: jtextextareas always form a partial "new panel" which covers my graph.
: I set layout as null and just give the coordinates and size of the
: text areas. Also, when I set background color of that jpanel,
: I can't display my graphics properly as well. Perhaps I
: should reimplement my drawgraph me

avatar
m*t
7
Alas! never mind, jpanel doesn't have the rootpane issue. It's JFrame,etc.
Sorry for the confusion. (talk about the "insanity"...)
相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。