This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information

Probleme mit UIFormLayout

Allgemeine Fragen zur Entwicklung von und mit JVx.

Probleme mit UIFormLayout

Postby Mihail121 » Tue Feb 07, 2012 2:05 am

Hallo, liebes JVx-Team!

Ich kämpfe seit einer Stunde mit der UIFormLayout, um folgendes zu bewirken: zwei Elemente nebeneinander, die gleichmäßig (also zu 50%) expanden, um den verfügbaren Raum in der horizontalen Richtung zu befüllen. Mit einer Komponente ist das einfach: add(comp, fl.getConstraints(0, 0, -1, 0)), aber wie würde es dann mit 2 oder n funktionieren?

Vielen Dank!
Last edited by Mihail121 on Tue Feb 07, 2012 12:48 pm, edited 2 times in total.
Mihail121
 
Posts: 7
Joined: Tue Nov 22, 2011 8:12 pm

Re: Probleme mit UIFlowLayout

Postby Mihail121 » Tue Feb 07, 2012 2:19 am

Hallo nochmal!

Ich habe soeben das versucht:

Code: Select all
IAnchor h = flAssignments.createAnchor(flAssignments.getLeftAnchor(), flAssignments.getRightAnchor(), 1);

IConstraints c1 = flAssignments.getMaximizedConstraints();
c1.setRightAnchor(h);

IConstraints c2 = flAssignments.getMaximizedConstraints();
c2.setLeftAnchor(h);

gpAssignedItems.add(pItems, c1);
gpAssignedItems.add(pAssignedItems, c2);


was mir ein Exception gibt in createAnchor und zwar "Not yet anymore supported!".
Mihail121
 
Posts: 7
Joined: Tue Nov 22, 2011 8:12 pm

Re: Probleme mit UIFormLayout

Postby Support@SIB » Tue Feb 07, 2012 11:26 am

Sie meinen bestimmt das UIFormLayout. Als Beispiel können Sie damit arbeiten:

Code: Select all
UIFormLayout folMain = new UIFormLayout();

setLayout(folMain);

UIButton butLeft = new UIButton("Left");
UIButton butRight = new UIButton("Right");

IConstraints center = folMain.getHCenterConstraints(0, 0, -1, 0);

UILabel label = new UILabel();
label.setPreferredSize(5, 0);

add(label, center);
add(butLeft, folMain.getConstraints(center.getTopAnchor(),
             folMain.createAnchor(folMain.getLeftMarginAnchor(), 0),
             center.getBottomAnchor(),
             folMain.createAnchor(center.getLeftAnchor(), 0)));

add(butRight, folMain.getConstraints(center.getTopAnchor(),
              folMain.createAnchor(center.getRightAnchor(), 0),
              center.getBottomAnchor(),
              folMain.createAnchor(folMain.getRightMarginAnchor(), 0)));

Erzeugt folgende Darstellung:

alignment.png
alignment.png (5.03 KiB) Viewed 8590 times
User avatar
Support@SIB
 
Posts: 353
Joined: Mon Sep 28, 2009 1:56 pm

Re: Probleme mit UIFormLayout

Postby Mihail121 » Tue Feb 07, 2012 12:45 pm

Vielen Dank! Werde ich dann so machen, darauf war ich gestern in der Nacht überhaupt nicht gekommen. Ich meinte natürlich UIFormLayout.
Mihail121
 
Posts: 7
Joined: Tue Nov 22, 2011 8:12 pm


Return to Development (DE)