/** * Adds a sequence of gridded buttons that grow where each is separated by a * default gap. Honors this builder's button order. If you want to use a * fixed left to right order, add individual buttons. * * @param buttons * an array of buttons to add * * @see LayoutStyle */ public void addGriddedGrowingButtons(JButton[] buttons) { int length = buttons.length; for (int i = 0; i < length; i++) { int index = leftToRight ? i : length - 1 - i; addGriddedGrowing(buttons[index]); if (i < buttons.length - 1) addRelatedGap(); } }
/** * Adds a sequence of gridded buttons that grow * where each is separated by a default gap. * Honors this builder's button order. If you * want to use a fixed left to right order, * add individual buttons. * * @param buttons an array of buttons to add * * @see LayoutStyle */ public void addGriddedGrowingButtons(JButton[] buttons) { int length = buttons.length; for (int i = 0; i < length; i++) { int index = leftToRight ? i : length -1 - i; addGriddedGrowing(buttons[index]); if (i < buttons.length - 1) addRelatedGap(); } }
/** * Builds and returns a filled button bar with Add, Remove, and * Properties. * * @param add the Add button * @param remove the Remove button * @param properties the Properties button * @return a panel that contains the button(s) */ public static JPanel buildAddRemovePropertiesBar( JButton add, JButton remove, JButton properties) { ButtonBarBuilder builder = new ButtonBarBuilder(); builder.addGriddedGrowing(add); builder.addRelatedGap(); builder.addGriddedGrowing(remove); builder.addRelatedGap(); builder.addGriddedGrowing(properties); return builder.getPanel(); }
/** * Builds and returns a filled button bar with Add, Remove, and Properties. * * @param add * the Add button * @param remove * the Remove button * @param properties * the Properties button * @return a panel that contains the button(s) */ public static JPanel buildAddRemovePropertiesBar(JButton add, JButton remove, JButton properties) { ButtonBarBuilder builder = new ButtonBarBuilder(); builder.addGriddedGrowing(add); builder.addRelatedGap(); builder.addGriddedGrowing(remove); builder.addRelatedGap(); builder.addGriddedGrowing(properties); return builder.getPanel(); }