Java Utililty Methods JPanel Child

List of utility methods to do JPanel Child

Description

The list of methods to do JPanel Child are organized into topic(s).

Method

voidaddComponent(JPanel contentPane, GridBagConstraints gbc, JLabel label, JComponent component)
add Component
gbc.gridx = 0;
contentPane.add(label, gbc);
gbc.gridx = 1;
contentPane.add(component, gbc);
gbc.gridx = 0;
voidaddComponent(JPanel panel, Component c, int x, int y, int width, int height, int ipadx, int ipady, double weightx, double weighty, int fill, int anchor)
Methode zum Einfuegen einer Komponente in ein Panel mit GridBagLayout.
int dx = 0;
int dy = 0;
if (c instanceof JSeparator) {
    dy = VER_SEP_DIST;
} else {
    dx = HOR_FIELD_DIST;
    dy = VER_FIELD_DIST;
addComponent(panel, c, x, y, width, height, ipadx, ipady, dx, dy, weightx, weighty, fill, anchor);
voidaddComponents(JPanel panel, JComponent... comps)
add Components
for (JComponent comp : comps) {
    panel.add(comp);
ComponentaddGBC(JPanel panel, Component component, int gridx, int gridy, int anchor, Insets insets)
add GBC
GridBagConstraints gbc = new GridBagConstraints();
gbc.anchor = anchor;
gbc.insets = insets;
gbc.gridx = gridx;
gbc.gridy = gridy;
panel.add(component, gbc);
return component;
voidaddInput2Pane(String label, Component c, JPanel p, int row)
add the component with the label at left to the JPanel at row
JLabel jlabel = new JLabel(label);
int a = GridBagConstraints.EAST, f = GridBagConstraints.HORIZONTAL;
addComponent(p, jlabel, 0, row, 1, 1, f, a, 0, 0);
addComponent(p, c, 1, row, 1, 1, f, a, 1, 1);
voidaddSection(JPanel panel, String title)
add Section
addSection(panel, title, "center");
voidaddSpacer(JPanel panel)
add Spacer
JPanel filler = new JPanel();
filler.setOpaque(false);
filler.setPreferredSize(new Dimension(0, 10));
panel.add(filler, "span");
voidaddTo(JPanel panel, String label, String value)
add To
JLabel lhs = strongFont(new JLabel(label));
JLabel rhs = mildFont(new JLabel(value));
addTo(panel, lhs, rhs);
voidaddToGridBag(Component comp, JPanel panel, int gridx, int gridy, int width, int height, int anchor)
Adds a component to a panel with a grid bag layout
addToGridBag(comp, panel, gridx, gridy, width, height, anchor, DEFAULT_PADDING);
voidaddToGridBag(final JPanel panel, final Component component, final int x, final int y)
add To Grid Bag
addToGridBag(panel, component, x, y, 1, 1, -1, -1);