Java Code Examples for javax.swing.Box#getComponent()
The following examples show how to use
javax.swing.Box#getComponent() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MultiOptionGroup.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Find option panel. * * @param box the box * @param panel the panel * @return the int */ private int findOptionPanel(Box box, FieldPanel panel) { int index; for (index = 0; index < box.getComponentCount(); index++) { if (box.getComponent(index) == panel) { return index; } } return -1; }
Example 2
Source File: BasePanel.java From sldeditor with GNU General Public License v3.0 | 5 votes |
/** * Insert panel. * * @param fieldConfig the field config * @param panel the panel * @param optionBox the option box */ public void insertPanel(FieldConfigBase fieldConfig, BasePanel panel, Box optionBox) { int fieldIndex = -1; Box boxToUpdate = (optionBox != null) ? optionBox : box; if ((boxToUpdate != null) && (panel != null)) { for (int index = 0; index < boxToUpdate.getComponentCount(); index++) { Component component = boxToUpdate.getComponent(index); if (fieldConfig.getPanel() == component) { fieldIndex = index; break; } } if (padding != null) { padding.removePadding(); } logger.debug( String.format( "%s : %s -> %s", Localisation.getString( StandardPanel.class, "StandardPanel.addingPanel"), panel.getClass().getName(), this.getClass().getName())); if (fieldIndex > -1) { fieldIndex++; } boxToUpdate.add(panel, fieldIndex); if (padding != null) { padding.addPadding(); } } }