/* * (non-Javadoc) * * @see org.jajuk.ui.views.IView#populate() */ @Override public void initUI() { tabs = new JTabbedPane(); // Remove tab border, see // http://forum.java.sun.com/thread.jspa?threadID=260746&messageID=980405 class MyTabbedPaneUI extends javax.swing.plaf.basic.BasicTabbedPaneUI { @Override protected Insets getContentBorderInsets(int tabPlacement) { return new Insets(0, 0, 0, 0); } @Override protected void paintContentBorder(Graphics g, int tabPlacement, int selectedIndex) { // nothing to do here... } } // Now use the new TabbedPaneUI tabs.setUI(new MyTabbedPaneUI()); // Fill tabs with empty tabs tabs.addTab( Messages.getString("SuggestionView.1"), UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3")))); tabs.addTab( Messages.getString("SuggestionView.2"), UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3")))); tabs.addTab( Messages.getString("SuggestionView.5"), UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3")))); tabs.addTab( Messages.getString("SuggestionView.3"), new JLabel(Messages.getString("SuggestionView.7"))); tabs.addTab( Messages.getString("SuggestionView.4"), new JLabel(Messages.getString("SuggestionView.7"))); // Refresh tabs on demand only, add changelisterner after tab creation to // avoid that the stored tab is overwrited at startup tabs.addChangeListener( new ChangeListener() { @Override public void stateChanged(ChangeEvent arg0) { refreshLastFMCollectionTabs(); // store the selected tab Conf.setProperty( getClass().getName() + "_" + ((getPerspective() == null) ? "solo" : getPerspective().getID()), Integer.toString(tabs.getSelectedIndex()).toString()); } }); if (Conf.containsProperty( getClass().getName() + "_" + ((getPerspective() == null) ? "solo" : getPerspective().getID()))) { int index = Conf.getInt( getClass().getName() + "_" + ((getPerspective() == null) ? "solo" : getPerspective().getID())); if (index > 0 && index < tabs.getTabCount()) { tabs.setSelectedIndex(index); } } // Add panels refreshLocalCollectionTabs(); // Add tabs setLayout(new BoxLayout(this, BoxLayout.X_AXIS)); add(tabs); // Look for events ObservationManager.register(this); }