tab.requestFocus();
            public void actionPerformed(ActionEvent e) {                if (tab.getSelectedIndex() > 0 && "previous".equals(e.getActionCommand()))                    tab.setSelectedIndex(tab.getSelectedIndex() - 1);                else if (tab.getSelectedIndex() < tab.getTabCount() - 1 && "next".equals(e.getActionCommand()))                    tab.setSelectedIndex(tab.getSelectedIndex() + 1);            }