- java.lang.Object
-
- javax.swing.GroupLayout.Group
-
- javax.swing.GroupLayout.ParallelGroup
-
- Enclosing class:
- GroupLayout
public class GroupLayout.ParallelGroup extends GroupLayout.Group
AGroupthat aligns and sizes it's children.ParallelGroupaligns it's children in four possible ways: along the baseline, centered, anchored to the leading edge, or anchored to the trailing edge.Baseline
AParallelGroupthat aligns it's children along the baseline must first decide where the baseline is anchored. The baseline can either be anchored to the top, or anchored to the bottom of the group. That is, the distance between the baseline and the beginning of the group can be a constant distance, or the distance between the end of the group and the baseline can be a constant distance. The possible choices correspond to theBaselineResizeBehaviorconstantsCONSTANT_ASCENTandCONSTANT_DESCENT.The baseline anchor may be explicitly specified by the
createBaselineGroupmethod, or determined based on the elements. If not explicitly specified, the baseline will be anchored to the bottom if all the elements with a baseline, and that are aligned to the baseline, have a baseline resize behavior ofCONSTANT_DESCENT; otherwise the baseline is anchored to the top of the group.Elements aligned to the baseline are resizable if they have have a baseline resize behavior of
CONSTANT_ASCENTorCONSTANT_DESCENT. Elements with a baseline resize behavior ofOTHERorCENTER_OFFSETare not resizable.The baseline is calculated based on the preferred height of each of the elements that have a baseline. The baseline is calculated using the following algorithm:
max(maxNonBaselineHeight, maxAscent + maxDescent), where themaxNonBaselineHeightis the maximum height of all elements that do not have a baseline, or are not aligned along the baseline.maxAscentis the maximum ascent (baseline) of all elements that have a baseline and are aligned along the baseline.maxDescentis the maximum descent (preferred height - baseline) of all elements that have a baseline and are aligned along the baseline.A
ParallelGroupthat aligns it's elements along the baseline is only useful along the vertical axis. If you create a baseline group and use it along the horizontal axis anIllegalStateExceptionis thrown when you askGroupLayoutfor the minimum, preferred or maximum size or attempt to layout the components.Elements that are not aligned to the baseline and smaller than the size of the
ParallelGroupare positioned in one of three ways: centered, anchored to the leading edge, or anchored to the trailing edge.Non-baseline ParallelGroup
ParallelGroups created with an alignment other thanBASELINEalign elements that are smaller than the size of the group in one of three ways: centered, anchored to the leading edge, or anchored to the trailing edge.The leading edge is based on the axis and
ComponentOrientation. For the vertical axis the top edge is always the leading edge, and the bottom edge is always the trailing edge. When theComponentOrientationisLEFT_TO_RIGHT, the leading edge is the left edge and the trailing edge the right edge. AComponentOrientationofRIGHT_TO_LEFTflips the left and right edges. Child elements are aligned based on the specified alignment the element was added with. If you do not specify an alignment, the alignment specified for theParallelGroupis used.To align elements along the baseline you
createBaselineGroup, orcreateParallelGroupwith an alignment ofBASELINE. If the group was not created with a baseline alignment, and you attempt to add an element specifying a baseline alignment, anIllegalArgumentExceptionis thrown.- Since:
- 1.6
- See Also:
GroupLayout.createParallelGroup(),GroupLayout.createBaselineGroup(boolean,boolean)
-
-
Method Summary
Methods Modifier and Type Method and Description GroupLayout.ParallelGroupaddComponent(Component component)Adds aComponentto thisGroup.GroupLayout.ParallelGroupaddComponent(Component component, GroupLayout.Alignment alignment)Adds aComponentto thisParallelGroupwith the specified alignment.GroupLayout.ParallelGroupaddComponent(Component component, GroupLayout.Alignment alignment, int min, int pref, int max)Adds aComponentto thisParallelGroupwith the specified alignment and size.GroupLayout.ParallelGroupaddComponent(Component component, int min, int pref, int max)Adds aComponentto thisGroupwith the specified size.GroupLayout.ParallelGroupaddGap(int pref)Adds a rigid gap to thisGroup.GroupLayout.ParallelGroupaddGap(int min, int pref, int max)Adds a gap to thisGroupwith the specified size.GroupLayout.ParallelGroupaddGroup(GroupLayout.Alignment alignment, GroupLayout.Group group)Adds aGroupto thisParallelGroupwith the specified alignment.GroupLayout.ParallelGroupaddGroup(GroupLayout.Group group)Adds aGroupto thisGroup.
-
-
-
Method Detail
-
addGroup
public GroupLayout.ParallelGroup addGroup(GroupLayout.Group group)
Adds aGroupto thisGroup.- Overrides:
addGroupin classGroupLayout.Group- Parameters:
group- theGroupto add- Returns:
- this
Group
-
addComponent
public GroupLayout.ParallelGroup addComponent(Component component)
Adds aComponentto thisGroup.- Overrides:
addComponentin classGroupLayout.Group- Parameters:
component- theComponentto add- Returns:
- this
Group
-
addComponent
public GroupLayout.ParallelGroup addComponent(Component component, int min, int pref, int max)
Adds aComponentto thisGroupwith the specified size.- Overrides:
addComponentin classGroupLayout.Group- Parameters:
component- theComponentto addmin- the minimum size or one ofDEFAULT_SIZEorPREFERRED_SIZEpref- the preferred size or one ofDEFAULT_SIZEorPREFERRED_SIZEmax- the maximum size or one ofDEFAULT_SIZEorPREFERRED_SIZE- Returns:
- this
Group
-
addGap
public GroupLayout.ParallelGroup addGap(int pref)
Adds a rigid gap to thisGroup.- Overrides:
addGapin classGroupLayout.Group- Parameters:
pref- the size of the gap- Returns:
- this
Group
-
addGap
public GroupLayout.ParallelGroup addGap(int min, int pref, int max)
Adds a gap to thisGroupwith the specified size.- Overrides:
addGapin classGroupLayout.Group- Parameters:
min- the minimum size of the gappref- the preferred size of the gapmax- the maximum size of the gap- Returns:
- this
Group
-
addGroup
public GroupLayout.ParallelGroup addGroup(GroupLayout.Alignment alignment, GroupLayout.Group group)
Adds aGroupto thisParallelGroupwith the specified alignment. If the child is smaller than theGroupit is aligned based on the specified alignment.- Parameters:
alignment- the alignmentgroup- theGroupto add- Returns:
- this
ParallelGroup - Throws:
IllegalArgumentException- ifalignmentisnull
-
addComponent
public GroupLayout.ParallelGroup addComponent(Component component, GroupLayout.Alignment alignment)
Adds aComponentto thisParallelGroupwith the specified alignment.- Parameters:
alignment- the alignmentcomponent- theComponentto add- Returns:
- this
Group - Throws:
IllegalArgumentException- ifalignmentisnull
-
addComponent
public GroupLayout.ParallelGroup addComponent(Component component, GroupLayout.Alignment alignment, int min, int pref, int max)
Adds aComponentto thisParallelGroupwith the specified alignment and size.- Parameters:
alignment- the alignmentcomponent- theComponentto addmin- the minimum sizepref- the preferred sizemax- the maximum size- Returns:
- this
Group - Throws:
IllegalArgumentException- ifalignmentisnull
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/swing/GroupLayout.ParallelGroup.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.