private void changeCategory(int type) { if (type == m_category) return; m_componentChoice[m_category].setVisible(false); m_category = type; m_componentChoice[m_category].setVisible(true); int selectedIndex = m_componentChoice[m_category].getSelectedIndex(); switch (m_category) { case TYPE_BUTTONS: m_parentApplication.showPage(selectedIndex); break; case TYPE_LABELS: m_parentApplication.showPage(selectedIndex + 6); break; case TYPE_MENUS: m_parentApplication.showPage(selectedIndex + 11); break; } }
/** * This method is called every time any component on this page fires an action event. * * @param e The event that has been fired. */ public void onActionEvent(ActionEvent e) { if (e.source == m_categoryChoice) { if (e.type == ActionEvent.ITEM_SELECTED) { changeCategory(m_categoryChoice.getSelectedIndex()); } } else if (e.source == m_componentChoice[TYPE_BUTTONS]) { if (e.type == ActionEvent.ITEM_SELECTED) { m_parentApplication.showPage(m_componentChoice[TYPE_BUTTONS].getSelectedIndex()); } } else if (e.source == m_componentChoice[TYPE_LABELS]) { if (e.type == ActionEvent.ITEM_SELECTED) { m_parentApplication.showPage(m_componentChoice[TYPE_LABELS].getSelectedIndex() + 6); } } else if (e.source == m_componentChoice[TYPE_MENUS]) { if (e.type == ActionEvent.ITEM_SELECTED) { m_parentApplication.showPage(m_componentChoice[TYPE_MENUS].getSelectedIndex() + 11); } } }