I have list items on form, I have to display that form on tabs, when the user clicked on a tab.
How to add that form to tab, after form.show() or before?
I need to display first tab as default with Form Screen?
You can display form in Tabs. Form is also a component.
Form frmObj = new Form("Tabs Example");
Form frmOne = new Form("One");
Form frmTwo = new Form("Two");
Tabs tabObj = new Tabs();
tabObj.addTab("Form One",frmOne);
tabObj.addTab("Form Two",frmTwo );
frmObj.addComponent(tabObj);
frmObj.show();
Related
I am using codename one to create an application, and i am in front of a situation that is making me use the "tree component" in the pop-up of the OverFlowMenu
how can i do that?
That won't work. The overflow menu uses a renderer approach and isn't very customizable.
Instead add a command to the right side of the toolbar and show a popup dialog pointing at that button e.g.:
popupCommand = toolbar.addMaterialCommandToRightBar("", FontImage.MATERIAL_MORE_VERT, e -> showPopup());
private void showPopup() {
Button b = toolbar.findCommandComponent(popupCommand);
Dialog popup = new Dialog(new BorderLayout());
popup.add(BorderLayout.CENTER, new Tree());
popup.showPopup(b);
}
I am trying to pre-select a radio button group using api. however the generated document doesn't seem to have any radio button selected.
Sample:
Radio radVal1 = new Radio();
radVal1.setSelected("True");
radVal1.setValue("ChoiceYes");
Radio radVal2 = new Radio();
radVal2.setSelected("False");
radVal2.setValue("ChoiceNo");
List<Radio> radioVals = new ArrayList<Radio>();
radioVals.add(radVal1);
radioVals.add(radVal2);
RadioGroup rgrp = new RadioGroup();
rgrp.setGroupName("RadioGroup4");
rgrp.setRadios(radioVals);
List<RadioGroup> radioGroupTabs= new ArrayList<RadioGroup>();
radioGroupTabs.add(rgrp);
Tabs entityTabs = new Tabs();
entityTabs.setRadioGroupTabs(radioGroupTabs);
I am using a template with radio buttons with
Group Label : RadioGroup4
Button Values:
ChoiceYes
ChoiceNo
No other conditional logic.
Looks like you've resolved your own issue, to make clear for the community the groupName string must exactly match the name you pass through the API, otherwise it will not be able to match to the radios.
Good day all,
I have a simple Dialog started after click button, I post my code:
Dialog dialog;
super();
dialog = new Dialog("Dialog example");
dialog.addText(strFmt("Text to show"));
dialog.addText(strfmt("SecondText to show"));
dialog.run();
I will show a Dialog window loollike this :
It's possible to set the position from code the Text: Text to show ?
For example, if I want to centered position the second text how should I do?
I tried to put blanks in the code:
dialog.addText(strfmt(" Text to show"));
But nothing changes, and this I think not good method.
I saw any suggestions on Web but or I do not use well or is not suitable for me: Example-suggestions.
Exist a method to do what I want?
Thanks for help,
enjoy!
You can center the text using the form control:
Dialog dialog = new Dialog("Dialog example");
DialogText t1 = dialog.addText(strFmt("Text to show"));
DialogText t2 = dialog.addText(strfmt("SecondText to show"));
FormStaticTextControl c1 = t1.control();
c1.widthMode(FormWidth::ColumnWidth);
c1.alignment(FormAlignment::Center);
dialog.run();
The first control is now centered (to the surrounding group).
You have to give it ColumnWidth, otherwise the control would have the minimum size and the centering would have no effect.
I want to create JavaFX tabs which can be minimized and shrieked vertically. Something like this:
I only want to display the tab names and remove the body. Setting the vertical position of the tabs is easy:
tabPane.setSide(Side.RIGHT);
The problem is how I can remove the body of the tabs?
TabPane tabPane = new TabPane();
Tab tab0 = new Tab("blue");
tab.setContent(new Rectangle(200,200, Color.BLUE));
Tab tab1 = new Tab("green");
tab.setContent(new Rectangle(200,200, Color.GREEN));
tabPane.getTabs().addAll(tab0, tab1);
I have created number of LWUIT Tabs,when i display those tabs on my form Screen,i am able to see only 4 tabs on my form screen,remaining tabs are displaying but those are hiding,How to display my form with tabs userfriendly?
tabs.addTab("Tab1", newsList);
tabs.addTab("Tab2", myNewsList);
tabs.addTab("Tab3", cinemaNewsList);
tabs.addTab("Tab4", gossipList);
tabs.addTab("Tab5", list);
tabs.addTab("Tab5", list);
form1.addComponent(BorderLayout.CENTER, tabs);
form1.show();
It will differ based on the screen size. If your screen size is 240*320, it will show only 4 tabs. If your screen size is 320*240, it will show all 6 tabs.
You can do it in only one way by using buttons.
int tabsCount = 6;
Button btnOne = new Button(" Tab 1 ");
btnOne.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);
Button btnTwo = new Button(" Tab 2 ");
btnTwo.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);
Button btnThree = new Button(" Tab 3 ");
btnThree.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);
Button btnFour = new Button(" Tab 4 ");
btnFour.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);
Button btnFive = new Button(" Tab 5 ");
btnFive.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);
Button btnSix = new Button(" Tab 6 ");
btnSix.setPreferredW(Display.getInstance().getDisplayWidth()/tabsCount);
tabs.addTab(btnOne, new Label("Tab one selected"));
tabs.addTab(btnTwo, new Label("Tab Two selected"));
tabs.addTab(btnThree, new Label("Tab three selected"));
tabs.addTab(btnFour, new Label("Tab four selected"));
tabs.addTab(btnFive, new Label("Tab five selected"));
tabs.addTab(btnSix, new Label("Tab six selected"));
It won't display the text of the button fully in small screens. But, when that tab is focused that title will be displayed as ticker.