Created
November 22, 2021 10:44
-
-
Save jsfan3/67074c6684b0ee711c6f6d950cdefb57 to your computer and use it in GitHub Desktop.
Codename One - Test Tabs swipe on X-Axis and Y-Axis
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Form hi = new Form("Test swipe on tabs", BorderLayout.absolute()); | |
Tabs tabs = new Tabs(); | |
ButtonGroup btnGroup = new ButtonGroup(); | |
Button swipeXBtn = RadioButton.createToggle("Swipe on X-Axis", btnGroup); | |
Button swipeYBtn = RadioButton.createToggle("Swipe on Y-Axis", btnGroup); | |
btnGroup.setSelected(0); | |
swipeXBtn.addActionListener(l -> { | |
tabs.setSwipeOnXAxis(true); | |
}); | |
swipeYBtn.addActionListener(l -> { | |
tabs.setSwipeOnXAxis(false); | |
}); | |
hi.add(BorderLayout.NORTH, GridLayout.encloseIn(2, swipeXBtn, swipeYBtn)); | |
//tabs.hideTabs(); | |
hi.add(BorderLayout.CENTER, tabs); | |
List<Component> cards = new ArrayList<>(); | |
for (int i=0; i<20; i++) { | |
Container card = new Container(BoxLayout.y()); | |
card.getAllStyles().setBorder(Border.createLineBorder(CN.convertToPixels(1)/5, 0)); | |
card.addAll(FlowLayout.encloseCenter(new Label(FontImage.createMaterial(FontImage.MATERIAL_PERSON, "Label", 50.0f))), new Label("Card " + i)); | |
cards.add(card); | |
tabs.addTab("tab " + i, card); | |
} | |
hi.show(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment