private void insertGUITabsForSetting(Icon icon, TabPreferenceSetting tps, int index) { int position = index; for (PreferenceTab tab : tabs) { if (tab.getTabPreferenceSetting().equals(tps)) { insertTab(null, icon, tab.getComponent(), tps.getTooltip(), position++); } } }
private void addGUITabs(boolean clear) { boolean expert = ExpertToggleAction.isExpert(); Component sel = getSelectedComponent(); if (clear) { removeAll(); } // Inspect each tab setting for (PreferenceSetting setting : settings) { if (setting instanceof TabPreferenceSetting) { TabPreferenceSetting tps = (TabPreferenceSetting) setting; if (expert || !tps.isExpert()) { // Get icon String iconName = tps.getIconName(); ImageIcon icon = iconName != null && iconName.length() > 0 ? ImageProvider.get("preferences", iconName) : null; // See #6985 - Force icons to be 48x48 pixels if (icon != null && (icon.getIconHeight() != 48 || icon.getIconWidth() != 48)) { icon = new ImageIcon(icon.getImage().getScaledInstance(48, 48, Image.SCALE_DEFAULT)); } if (settingsInitialized.contains(tps)) { // If it has been initialized, add corresponding tab(s) addGUITabsForSetting(icon, tps); } else { // If it has not been initialized, create an empty tab with only icon and tooltip addTab(null, icon, new PreferencePanel(tps), tps.getTooltip()); } } } else if (!(setting instanceof SubPreferenceSetting)) { Main.warn("Ignoring preferences " + setting); } } try { if (sel != null) { setSelectedComponent(sel); } } catch (IllegalArgumentException e) { } }