如何使用 lwuit 中的按钮移动下一个选项卡菜单?

发布于 2025-01-01 23:13:30 字数 2437 浏览 2 评论 0原文

如何使用“单击”按钮将一个选项卡移动到另一选项卡?当我单击“接受”按钮时,它会移至下一个选项卡菜单。
谁能告诉我该怎么做?

    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);

How to move one tab to another tab using button Click? When I click accept button, it moves to next tab menu.
Can anyone tell me how to do this?

    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);

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

薄凉少年不暖心 2025-01-08 23:13:30
if tabSubscription.getSelectedIndex() == 0
   tabSubscription.setSelectedIndex(1);
else
   tabSubscription.setSelectedIndex(0);
frmSubscription.repaint();
if tabSubscription.getSelectedIndex() == 0
   tabSubscription.setSelectedIndex(1);
else
   tabSubscription.setSelectedIndex(0);
frmSubscription.repaint();
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文