@Test public void testGetComponentWithMargin() { System.out.println("getComponentWithMargin"); Component component = new JTextField("test"); int top = 1; int left = 2; int bottom = 3; int right = 4; JPanel result = GuiBuilderHelper.getComponentWithMargin(component, top, left, bottom, right); assertTrue(component.getParent().equals(result)); }
public static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right) { JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.BOTH; constraints.insets = new Insets(top, left, bottom, right); ret.add(component, constraints); return ret; }
GuiBuilderHelper { public static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right) { JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.BOTH; constraints.insets = new Insets(top, left, bottom, right); ret.add(component, constraints); return ret; } }
GuiBuilderHelper { public static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right) { JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.BOTH; constraints.insets = new Insets(top, left, bottom, right); ret.add(component, constraints); return ret; }  }
GuiBuilderHelper { public static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right) { JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.BOTH; constraints.insets = new Insets(top, left, bottom, right); ret.add(component, constraints); return ret; }  static JScrollPane getTextAreaScrollPaneContainer(JTextArea textArea, int nbLines); static void strechItemToComponent(JComponent component, JComponent item); static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right); }
GuiBuilderHelper { public static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right) { JPanel ret = new JPanel(new GridBagLayout()); GridBagConstraints constraints = new GridBagConstraints(); constraints.weightx = 1.0; constraints.weighty = 1.0; constraints.fill = GridBagConstraints.BOTH; constraints.insets = new Insets(top, left, bottom, right); ret.add(component, constraints); return ret; }  static JScrollPane getTextAreaScrollPaneContainer(JTextArea textArea, int nbLines); static void strechItemToComponent(JComponent component, JComponent item); static JPanel getComponentWithMargin(Component component, int top, int left, int bottom, int right);  }