Results 1 to 3 of 3
Thread: GroupLayout - Spring Gap Issue
- 08-10-2012, 08:15 AM #1
Member
- Join Date
- Jul 2012
- Posts
- 9
- Rep Power
- 0
GroupLayout - Spring Gap Issue
Ok guys i built this group layout, which is a custom cell renderer for my JList.Java Code:+---------------------------------------------------------------------------+ |[5] [image=16px] [5] [label1][spring gap max=av_sp,min=5]+[label2] [5] | | [5] [label3] | +---------------------------------------------------------------------------+ av_sp = Available Space left to the right margin
I have somehow to compute the available space that is left from label1/label3 to the right margin.
Java Code:GroupLayout cell = new GroupLayout(this); setLayout(cell); cell.setAutoCreateGaps(true); cell.setAutoCreateContainerGaps(true); int pPathWidth=(ProjectList.LISTWIDTH-16-20)/2; //that's something i tried, not a solution... SequentialGroup s1 = cell.createSequentialGroup(); cell.setHorizontalGroup(s1); s1.addGap(5); s1.addComponent(pTypeIcon, 16, 16, 16); ParallelGroup p1 = cell.createParallelGroup(GroupLayout.Alignment.LEADING,false); s1.addGap(5); s1.addGroup(p1); p1.addComponent(pName,0,172,172); SequentialGroup s2 = cell.createSequentialGroup(); p1.addGroup(s2); //Status icons if (statusLabels != null) for (int i = 0; i < statusLabels.length; i++) s2.addComponent(statusLabels[i]); else s2.addComponent(correct); s2.addComponent(jSeparator, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); //Branch s2.addComponent(branchName); //Push/Pull if (ppLabel != null){ s2.addComponent(jSeparator2, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE); for (int i = 0; i < ppLabel.length; i++) s2.addComponent(ppLabel[i]); } s1.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,5, 172); //not good, i was just trying to find a solution int prefWidth = pPath.getPreferredSize().width > 172 ? 230 : pPath.getPreferredSize().width; //not good, i was just trying to find a solution s1.addComponent(pPath,0,prefWidth,250);//not good, i was just trying to find a solution s1.addGap(5); SequentialGroup s11 = cell.createSequentialGroup(); cell.setVerticalGroup(s11); s11.addGap(5); ParallelGroup p11 = cell.createParallelGroup(GroupLayout.Alignment.CENTER); s11.addGroup(p11); p11.addComponent(pTypeIcon); p11.addComponent(pName); p11.addComponent(pPath); ParallelGroup p22 = cell.createParallelGroup(); s11.addGroup(p22); //Status icons if (statusLabels != null) for (int i = 0; i < statusLabels.length; i++) p22.addComponent(statusLabels[i]); else p22.addComponent(correct); p22.addComponent(jSeparator); //Branch p22.addComponent(branchName); //Pulls/pushes if (ppLabel != null) { p22.addComponent(jSeparator2); for (int i = 0; i < ppLabel.length; i++) p22.addComponent(ppLabel[i]);} s11.addGap(5);Last edited by doru.chiulan; 08-10-2012 at 08:43 AM.
- 08-12-2012, 03:49 PM #2
Re: GroupLayout - Spring Gap Issue
um, since I do not have the full code and I cannot run this, what is your current issue or question? Are there errors? What glitches have you found? Where does the gap become apparent?
My API:Java Code:cat > a.out || cat > main.class
- 08-12-2012, 07:26 PM #3
Member
- Join Date
- Jul 2012
- Posts
- 9
- Rep Power
- 0
Re: GroupLayout - Spring Gap Issue
i will post a picture later
The problem is that i cannot get the gap as i want(if the label width is less than the space left to the right margin, that gap should push the label to the right, if the label is too long , my scrollable pane should not extend and "cut" last part of the label)
You will see in the picture what's wrong. Thank you for reply and sorry for my bad question :D.
Similar Threads
-
session expire issue in spring
By thirish in forum Web FrameworksReplies: 2Last Post: 01-07-2012, 10:12 AM -
GroupLayout
By Itun in forum AWT / SwingReplies: 3Last Post: 03-24-2011, 05:19 PM -
GroupLayout Issue
By m_patten2 in forum AWT / SwingReplies: 2Last Post: 11-10-2010, 10:50 PM -
Spring Configuration Error - XML issue?
By hofsoc in forum New To JavaReplies: 0Last Post: 09-20-2010, 03:21 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks