View unanswered posts | View active topics It is currently Mon May 01, 2017 1:24 am



Reply to topic  [ 8 posts ] 
 "split" problems 
Author Message

Joined: Wed Oct 26, 2011 10:22 am
Posts: 4
Post "split" problems
Hello, everyone.
In UI designing, I want the effect as follows:
a a a a a a
a a a a a a
a a a a aaa a a
a a a a a a
in which per "a" stands for a component, ie, JLabel, JTextField, or a cumtomed componet.
But when I use the "split" the actual effect is what I cannot align them!
How to solve this problem?
Thanks.


Attachments:
Actual.png
Actual.png [ 25.18 KiB | Viewed 15001 times ]


Last edited by lifetaste on Thu Oct 27, 2011 3:29 am, edited 1 time in total.

Wed Oct 26, 2011 11:12 am
Profile
Site Admin

Joined: Mon Dec 06, 2004 4:24 pm
Posts: 2485
Location: Sweden
Post Re: "split" problems
Hello,

Split means putting one or more components in the same cell. Within that cell they can be aligned.

What do you want to align and with what?

Cheers,
Mikael


Wed Oct 26, 2011 2:37 pm
Profile WWW

Joined: Wed Oct 26, 2011 10:22 am
Posts: 4
Post Re: "split" problems
Thanks for your reply.
When I split on the third panel at third line, as you see, the "floatRate" label, I use "split 2" here, and I add a combox later. At last, I try to adjust it by "setPreferredSize(E.getPreferredSize)" ,but I failed. The failed picture as follows. The desired effect is to align them.
How to do?


Attachments:
Actual_New1.png
Actual_New1.png [ 26.52 KiB | Viewed 14999 times ]
Thu Oct 27, 2011 3:52 am
Profile
Site Admin

Joined: Mon Dec 06, 2004 4:24 pm
Posts: 2485
Location: Sweden
Post Re: "split" problems
It's hard to know exactly what's going on without the source, but this is how I understand it.

"split 2" means that the component will split the cell with the next component added to that container. If you add that component later, as you are implying, it will probably split it with the wrong component.

Instead of split you can add the component to the same cell using the "cell" keyword. It is the same thing as split.

Cheers,
Mikael


Thu Oct 27, 2011 8:58 am
Profile WWW

Joined: Wed Oct 26, 2011 10:22 am
Posts: 4
Post Re: "split" problems
Thanks.
And I post my codes which I rewrite from a actual project, I'm sorry it's so messy..
I expect the six columns of two panels are aligned but it seems not to be easy.


Attachments:
TestDTBPanel.png
TestDTBPanel.png [ 22.13 KiB | Viewed 14994 times ]
TestDTBPanel.java [7.05 KiB]
Downloaded 502 times
Thu Oct 27, 2011 10:48 am
Profile
Site Admin

Joined: Mon Dec 06, 2004 4:24 pm
Posts: 2485
Location: Sweden
Post Re: "split" problems
Sorry, but I don't have the time to check code.

But please add "debug" to the MigLayout constructor and you'll visually see what component goes into which cell.

Cheers,


Thu Oct 27, 2011 7:01 pm
Profile WWW
Post Однофорумчане покопипастим лучшие цитаты
Любовь — это попытка мужчины удовлетвориться
женщиной.


Wed Nov 16, 2011 5:37 pm

Joined: Wed Oct 26, 2011 10:22 am
Posts: 4
Post Re: "split" problems
Thanks.
I 've solved it.
Using setMinmumSize() and setPreferredSize() is enough!


Fri Nov 18, 2011 1:08 pm
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 8 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.