| 1236 | /// |
| 1237 | /// - `tabPlacement`: the placement for the tabs relative to the content |
| 1238 | public void setTabPlacement(int tabPlacement) { |
| 1239 | if (tabPlacement != TOP && tabPlacement != LEFT && |
| 1240 | tabPlacement != BOTTOM && tabPlacement != RIGHT) { |
| 1241 | throw new IllegalArgumentException("illegal tab placement: must be TOP, BOTTOM, LEFT, or RIGHT"); |
| 1242 | } |
| 1243 | Container slotComponent = tabsContainerHost != null ? tabsContainerHost : tabsContainer; |
| 1244 | if (this.tabPlacement == tabPlacement && slotComponent.getParent() == null && isInitialized()) { |
| 1245 | return; |
| 1246 | } |
| 1247 | this.tabPlacement = tabPlacement; |
| 1248 | removeComponent(slotComponent); |
| 1249 | |
| 1250 | setTabsLayout(tabPlacement); |
| 1251 | |
| 1252 | if (tabPlacement == TOP) { |
| 1253 | super.addComponent(BorderLayout.NORTH, slotComponent); |
| 1254 | } else if (tabPlacement == BOTTOM) { |
| 1255 | super.addComponent(BorderLayout.SOUTH, slotComponent); |
| 1256 | } else if (tabPlacement == LEFT) { |
| 1257 | super.addComponent(BorderLayout.WEST, slotComponent); |
| 1258 | } else { // RIGHT |
| 1259 | super.addComponent(BorderLayout.EAST, slotComponent); |
| 1260 | } |
| 1261 | |
| 1262 | initTabsFocus(); |
| 1263 | |
| 1264 | tabsContainer.setShouldCalcPreferredSize(true); |
| 1265 | contentPane.setShouldCalcPreferredSize(true); |
| 1266 | |
| 1267 | revalidateLater(); |
| 1268 | } |
| 1269 | |
| 1270 | /// This method retrieves the Tabs content pane |
| 1271 | /// |