Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
488 views
in Technique[技术] by (71.8m points)

java - resizable layout swing when disappears JPanel

I have many jPanel (panelF) that are added in other jPanel(panelB). jPanelF contain jPanelC. enter image description here

I have set the layout to add them as follows:

    PanelB.setLayout(new BoxLayout(this.PanelB, BoxLayout.PAGE_AXIS));
    PanelF panelF1 = new PanelF(); 
    PanelB.add(panelF1);
    PanelF panelF2 = new PanelF(); 
    PanelB.add(panelF2);

I set visible false in jPanelC1. But JPanelF2 preserves distance and not want to make that blank space

enter image description here What I want is that when disappearing JPanelC1. Distance is maintained between the jPanelF and not be a white space. I tried validate() and change the layout but I fail. What would be the way? Thank you very much. Sorry for my English

know if there are something like $("#panelC1").fadeOut("slow")? would be ideal.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Invoking panelC1.setVisible(false) makes panelC1 invisible, but it doesn't change the geometry defined by the get[Preferred|Maximum|Minimum]Size methods. You can


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...