MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / actionPerformed

Method actionPerformed

CodenameOne/src/com/codename1/ui/Tabs.java:811–847  ·  view source on GitHub ↗
(ActionEvent evt)

Source from the content-addressed store, hash-verified

809
810 bindTabActionListener(b, new ActionListener() {
811 @Override
812 public void actionPerformed(ActionEvent evt) {
813
814 if (selectedTab != null) {
815 if (tabUIID != null) {
816 selectedTab.setUIID(tabUIID);
817 }
818 if (!animateTabSelection) {
819 selectedTab.setShouldCalcPreferredSize(true);
820 selectedTab.repaint();
821 }
822 int previousSelectedIndex = tabsContainer.getComponentIndex(selectedTab);
823
824 // this might happen if a tab was removed
825 if (previousSelectedIndex != -1) {
826 Component previousContent = contentPane.getComponentAt(previousSelectedIndex);
827 if (previousContent instanceof Container) {
828 ((Container) previousContent).setBlockFocus(true);
829 }
830 }
831 }
832 if (active != tabsContainer.getComponentIndex(b)) {
833 active = tabsContainer.getComponentIndex(b);
834 Component content = contentPane.getComponentAt(active);
835 if (content instanceof Container) {
836 ((Container) content).setBlockFocus(false);
837 }
838 setSelectedIndex(active, animateTabSelection);
839 initTabsFocus();
840 selectedTab = b;
841 if (!animateTabSelection) {
842 selectedTab.setShouldCalcPreferredSize(true);
843 tabsContainer.revalidateLater();
844 }
845 tabsContainer.scrollComponentToVisible(selectedTab);
846 }
847 }
848 });
849
850 if (component instanceof Container) {

Callers

nothing calls this directly

Calls 10

setSelectedIndexMethod · 0.95
initTabsFocusMethod · 0.95
setBlockFocusMethod · 0.80
repaintMethod · 0.65
setUIIDMethod · 0.45
getComponentIndexMethod · 0.45
getComponentAtMethod · 0.45
revalidateLaterMethod · 0.45

Tested by

no test coverage detected