This topic has been archived. It cannot be replied.
-
工作学习 / 专业技术讨论 / Appreciate some help with a Java Swing techniqueI am not a Swing expert, and appreciate some help from an expert.
I want to have two components (fields, labels) to occupy the same location and area on the screen. Under one condition, only component A is visible, and under another conditioin, only component B is visible. But both are there , with only one is visible at a time. Both components contain data from database, even though only one component is visible at a time.
Thanks so much for your help. You are very appreciated!
-goer(goer);
2005-8-28
{489}
(#2475021@0)
-
setVisible(boolean)不就可以吗
-markriver(markriver);
2005-8-28
(#2475057@0)
-
That is my first thought.But I am a newbie to Swing. (I know web pretty well). Will the invisible and the visible components interfere each other since one is on top of another (adding them to a JPanel has some kind of order, you know. )?
Thanks for answering.
-goer(goer);
2005-8-28
{236}
(#2475488@0)
-
我想不会,你可以 设置一个可见或不可见的同时,设置另一个。
mylabel.setVisible(true/false);
mytextfield.setvisible(!mylabel.isVisible());
如果你有很多控件同时需要可见,另外很多需要不可见.....你可以使用cardLayout
-markriver(markriver);
2005-8-28
(#2475562@0)
-
use cardlayout,there is a function some thing like cardlayout.show(componentname);
-super__7(中奖大家有份);
2005-8-28
(#2475640@0)