Java me 如何使用lwuit中的按钮移动下一个选项卡菜单?
如何使用按钮单击将一个选项卡移动到另一个选项卡?当我单击“接受”按钮时,它将移动到下一个选项卡菜单。Java me 如何使用lwuit中的按钮移动下一个选项卡菜单?,java-me,tabs,lwuit,Java Me,Tabs,Lwuit,如何使用按钮单击将一个选项卡移动到另一个选项卡?当我单击“接受”按钮时,它将移动到下一个选项卡菜单。 谁能告诉我怎么做 frmSubscription = new Form(); String[] subscriptionList = {"15 Days - $12.5", "30 Days - $25", "45 Days - $37.5", "60 Days - $50", "90 Days - $75"}; cmdBack = new Command((Strin
谁能告诉我怎么做
frmSubscription = new Form();
String[] subscriptionList = {"15 Days - $12.5", "30 Days - $25", "45 Days - $37.5", "60 Days - $50", "90 Days - $75"};
cmdBack = new Command((String)locale.get("BACK"));
cmdExit = new Command((String)locale.get("EXIT"));
lblLeague = new Label("Premier League");
lblSubscription = new Label("Subscription");
lblCurrentPlan = new Label("Current Plan");
comboSubscription = new ComboBox(subscriptionList);
deviceWidth = Display.getInstance().getDisplayWidth();
btnAccept = new Button("Accept");
btnAccept.setAlignment(Component.CENTER);
btnAccept.setPreferredW(deviceWidth);
btnSubscription = new Button("Unsubscription");
btnCancel = new Button("Cancel");
flowLayout = new FlowLayout();
frmSubscription.setLayout(flowLayout);
btnTermsCond = new Button((String) locale.get("TERM&COND"));
btnSubscribe = new Button("Subscribe");
// Terms & conditions container
txtTermsCondt = new TextArea((String) locale.get("TERMS & CONDITIONS"));
txtTermsCondt.setEditable(false);
termsContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
termsContainer.addComponent(txtTermsCondt);
termsContainer.addComponent(btnAccept);
// Subscription container
subContainer = new Container(new BoxLayout(BoxLayout.Y_AXIS));
subContainer.addComponent(lblCurrentPlan);
subContainer.addComponent(comboSubscription);
acceptContainer = new Container(new BoxLayout(BoxLayout.X_AXIS));
acceptContainer.addComponent(btnSubscription);
acceptContainer.addComponent(btnCancel);
subContainer.addComponent(acceptContainer);
container = new Container();
GridLayout gridLayout = new GridLayout(1, 2);
container.setLayout(gridLayout);
container.addComponent(lblLeague);
container.addComponent(lblSubscription);
tabSubscription = new TabbedPane();
tabSubscription.addTab("Terms and Conditions", termsContainer );
tabSubscription.addTab("Unsubscribe", subContainer );
frmSubscription.addComponent(container);
frmSubscription.addComponent(tabSubscription);
btnAccept.addActionListener(this);
frmSubscription.addCommand(cmdBack);
frmSubscription.addCommand(cmdExit);
没错,但我认为你不需要重新油漆。如果选项卡不在边框布局的中心且大小发生变化,则可能需要重新验证()。它将移动到下一个选项卡,但会显示选项卡页面的底部。我怎样才能升迁呢?非常感谢Pheromix它对我有效,我一直在寻找它:D正确,但我认为你不需要重新油漆。如果选项卡不在边框布局的中心且大小发生变化,则可能需要重新验证()。它将移动到下一个选项卡,但会显示选项卡页面的底部。我怎样才能升职呢?非常感谢Pheromix它对我有效,我一直在寻找它:D
if tabSubscription.getSelectedIndex() == 0
tabSubscription.setSelectedIndex(1);
else
tabSubscription.setSelectedIndex(0);
frmSubscription.repaint();