Class GridBagBuilder
- java.lang.Object
-
- org.unitConverter.converterGUI.GridBagBuilder
-
final class GridBagBuilder extends java.lang.ObjectA builder for Java'sGridBagConstraintsclass.- Since:
- 2018-11-30, v0.1.0
- Author:
- Adrien Hopkins
-
-
Field Summary
Fields Modifier and Type Field Description private intanchorThe builtGridBagConstraints'sanchorproperty.private intfillThe builtGridBagConstraints'sfillproperty.private intgridheightThe builtGridBagConstraints'sgridheightproperty.private intgridwidthThe builtGridBagConstraints'sgridwidthproperty.private intgridxThe builtGridBagConstraints'sgridxproperty.private intgridyThe builtGridBagConstraints'sgridyproperty.private java.awt.InsetsinsetsThe builtGridBagConstraints'sinsetsproperty.private intipadxThe builtGridBagConstraints'sipadxproperty.private intipadyThe builtGridBagConstraints'sipadyproperty.private doubleweightxThe builtGridBagConstraints'sweightxproperty.private doubleweightyThe builtGridBagConstraints'sweightyproperty.
-
Constructor Summary
Constructors Modifier Constructor Description GridBagBuilder(int gridx, int gridy)GridBagBuilder(int gridx, int gridy, int gridwidth, int gridheight)privateGridBagBuilder(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, java.awt.Insets insets, int ipadx, int ipady)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.awt.GridBagConstraintsbuild()intgetAnchor()intgetFill()intgetGridheight()intgetGridwidth()intgetGridx()intgetGridy()java.awt.InsetsgetInsets()intgetIpadx()intgetIpady()doublegetWeightx()doublegetWeighty()GridBagBuildersetAnchor(int anchor)GridBagBuildersetFill(int fill)GridBagBuildersetInsets(java.awt.Insets insets)GridBagBuildersetIpadx(int ipadx)GridBagBuildersetIpady(int ipady)GridBagBuildersetWeightx(double weightx)GridBagBuildersetWeighty(double weighty)
-
-
-
Field Detail
-
gridx
private final int gridx
The builtGridBagConstraints'sgridxproperty.Specifies the cell containing the leading edge of the component's display area, where the first cell in a row has
gridx=0. The leading edge of a component's display area is its left edge for a horizontal, left-to-right container and its right edge for a horizontal, right-to-left container. The valueRELATIVEspecifies that the component be placed immediately following the component that was added to the container just before this component was added.The default value is
RELATIVE.gridxshould be a non-negative value.- See Also:
Object.clone(),GridBagConstraints.gridy,ComponentOrientation
-
gridy
private final int gridy
The builtGridBagConstraints'sgridyproperty.Specifies the cell at the top of the component's display area, where the topmost cell has
gridy=0. The valueRELATIVEspecifies that the component be placed just below the component that was added to the container just before this component was added.The default value is
RELATIVE.gridyshould be a non-negative value.- See Also:
Object.clone(),GridBagConstraints.gridx
-
gridwidth
private final int gridwidth
The builtGridBagConstraints'sgridwidthproperty.Specifies the number of cells in a row for the component's display area.
Use
REMAINDERto specify that the component's display area will be fromgridxto the last cell in the row. UseRELATIVEto specify that the component's display area will be fromgridxto the next to the last one in its row.gridwidthshould be non-negative and the default value is 1.- See Also:
Object.clone(),GridBagConstraints.gridheight
-
gridheight
private final int gridheight
The builtGridBagConstraints'sgridheightproperty.Specifies the number of cells in a column for the component's display area.
Use
REMAINDERto specify that the component's display area will be fromgridyto the last cell in the column. UseRELATIVEto specify that the component's display area will be fromgridyto the next to the last one in its column.gridheightshould be a non-negative value and the default value is 1.- See Also:
Object.clone(),GridBagConstraints.gridwidth
-
weightx
private double weightx
The builtGridBagConstraints'sweightxproperty.Specifies how to distribute extra horizontal space.
The grid bag layout manager calculates the weight of a column to be the maximum
weightxof all the components in a column. If the resulting layout is smaller horizontally than the area it needs to fill, the extra space is distributed to each column in proportion to its weight. A column that has a weight of zero receives no extra space.If all the weights are zero, all the extra space appears between the grids of the cell and the left and right edges.
The default value of this field is
0.weightxshould be a non-negative value.- See Also:
Object.clone(),GridBagConstraints.weighty
-
weighty
private double weighty
The builtGridBagConstraints'sweightyproperty.Specifies how to distribute extra vertical space.
The grid bag layout manager calculates the weight of a row to be the maximum
weightyof all the components in a row. If the resulting layout is smaller vertically than the area it needs to fill, the extra space is distributed to each row in proportion to its weight. A row that has a weight of zero receives no extra space.If all the weights are zero, all the extra space appears between the grids of the cell and the top and bottom edges.
The default value of this field is
0.weightyshould be a non-negative value.- See Also:
Object.clone(),GridBagConstraints.weightx
-
anchor
private int anchor
The builtGridBagConstraints'sanchorproperty.This field is used when the component is smaller than its display area. It determines where, within the display area, to place the component.
There are three kinds of possible values: orientation relative, baseline relative and absolute. Orientation relative values are interpreted relative to the container's component orientation property, baseline relative values are interpreted relative to the baseline and absolute values are not. The absolute values are:
CENTER,NORTH,NORTHEAST,EAST,SOUTHEAST,SOUTH,SOUTHWEST,WEST, andNORTHWEST. The orientation relative values are:PAGE_START,PAGE_END,LINE_START,LINE_END,FIRST_LINE_START,FIRST_LINE_END,LAST_LINE_STARTandLAST_LINE_END. The baseline relative values are:BASELINE,BASELINE_LEADING,BASELINE_TRAILING,ABOVE_BASELINE,ABOVE_BASELINE_LEADING,ABOVE_BASELINE_TRAILING,BELOW_BASELINE,BELOW_BASELINE_LEADING, andBELOW_BASELINE_TRAILING. The default value isCENTER.- See Also:
Object.clone(),ComponentOrientation
-
fill
private int fill
The builtGridBagConstraints'sfillproperty.This field is used when the component's display area is larger than the component's requested size. It determines whether to resize the component, and if so, how.
The following values are valid for
fill:NONE: Do not resize the component.HORIZONTAL: Make the component wide enough to fill its display area horizontally, but do not change its height.VERTICAL: Make the component tall enough to fill its display area vertically, but do not change its width.BOTH: Make the component fill its display area entirely.
The default value is
NONE.- See Also:
Object.clone()
-
insets
private java.awt.Insets insets
The builtGridBagConstraints'sinsetsproperty.This field specifies the external padding of the component, the minimum amount of space between the component and the edges of its display area.
The default value is
new Insets(0, 0, 0, 0).- See Also:
Object.clone()
-
ipadx
private int ipadx
The builtGridBagConstraints'sipadxproperty.This field specifies the internal padding of the component, how much space to add to the minimum width of the component. The width of the component is at least its minimum width plus
ipadxpixels.The default value is
0.- See Also:
Object.clone(),GridBagConstraints.ipady
-
ipady
private int ipady
The builtGridBagConstraints'sipadyproperty.This field specifies the internal padding, that is, how much space to add to the minimum height of the component. The height of the component is at least its minimum height plus
ipadypixels.The default value is 0.
- See Also:
Object.clone(),GridBagConstraints.ipadx
-
-
Constructor Detail
-
GridBagBuilder
public GridBagBuilder(int gridx, int gridy)- Parameters:
gridx- x positiongridy- y position- Since:
- 2018-11-30, v0.1.0
-
GridBagBuilder
public GridBagBuilder(int gridx, int gridy, int gridwidth, int gridheight)- Parameters:
gridx- x positiongridy- y positiongridwidth- number of cells occupied horizontallygridheight- number of cells occupied vertically- Since:
- 2018-11-30, v0.1.0
-
GridBagBuilder
private GridBagBuilder(int gridx, int gridy, int gridwidth, int gridheight, double weightx, double weighty, int anchor, int fill, java.awt.Insets insets, int ipadx, int ipady)- Parameters:
gridx- x positiongridy- y positiongridwidth- number of cells occupied horizontallygridheight- number of cells occupied verticallyweightx-weighty-anchor-fill-insets-ipadx-ipady-- Since:
- 2018-11-30, v0.1.0
-
-
Method Detail
-
build
public java.awt.GridBagConstraints build()
- Returns:
GridBagConstraintscreated by this builder- Since:
- 2018-11-30, v0.1.0
-
getAnchor
public int getAnchor()
- Returns:
- anchor
- Since:
- 2018-11-30, v0.1.0
-
getFill
public int getFill()
- Returns:
- fill
- Since:
- 2018-11-30, v0.1.0
-
getGridheight
public int getGridheight()
- Returns:
- gridheight
- Since:
- 2018-11-30, v0.1.0
-
getGridwidth
public int getGridwidth()
- Returns:
- gridwidth
- Since:
- 2018-11-30, v0.1.0
-
getGridx
public int getGridx()
- Returns:
- gridx
- Since:
- 2018-11-30, v0.1.0
-
getGridy
public int getGridy()
- Returns:
- gridy
- Since:
- 2018-11-30, v0.1.0
-
getInsets
public java.awt.Insets getInsets()
- Returns:
- insets
- Since:
- 2018-11-30, v0.1.0
-
getIpadx
public int getIpadx()
- Returns:
- ipadx
- Since:
- 2018-11-30, v0.1.0
-
getIpady
public int getIpady()
- Returns:
- ipady
- Since:
- 2018-11-30, v0.1.0
-
getWeightx
public double getWeightx()
- Returns:
- weightx
- Since:
- 2018-11-30, v0.1.0
-
getWeighty
public double getWeighty()
- Returns:
- weighty
- Since:
- 2018-11-30, v0.1.0
-
setAnchor
public GridBagBuilder setAnchor(int anchor)
- Parameters:
anchor- anchor to set- Since:
- 2018-11-30, v0.1.0
-
setFill
public GridBagBuilder setFill(int fill)
- Parameters:
fill- fill to set- Since:
- 2018-11-30, v0.1.0
-
setInsets
public GridBagBuilder setInsets(java.awt.Insets insets)
- Parameters:
insets- insets to set- Since:
- 2018-11-30, v0.1.0
-
setIpadx
public GridBagBuilder setIpadx(int ipadx)
- Parameters:
ipadx- ipadx to set- Since:
- 2018-11-30, v0.1.0
-
setIpady
public GridBagBuilder setIpady(int ipady)
- Parameters:
ipady- ipady to set- Since:
- 2018-11-30, v0.1.0
-
setWeightx
public GridBagBuilder setWeightx(double weightx)
- Parameters:
weightx- weightx to set- Since:
- 2018-11-30, v0.1.0
-
setWeighty
public GridBagBuilder setWeighty(double weighty)
- Parameters:
weighty- weighty to set- Since:
- 2018-11-30, v0.1.0
-
-