2012-02-02 3 views
0

버튼을 사용하여 탭 하나를 다른 탭으로 이동하는 방법을 클릭하십시오. 동의 버튼을 클릭하면 다음 탭 메뉴로 이동합니다.
누구든지이 작업을 수행하는 방법을 알려 줄 수 있습니까?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((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); 

답변

4
if tabSubscription.getSelectedIndex() == 0 
    tabSubscription.setSelectedIndex(1); 
else 
    tabSubscription.setSelectedIndex(0); 
frmSubscription.repaint(); 
+0

감사 Pheromix ... 그것은 ... 잘 올바른 – selladurai

+0

을 일하고하지만 난 당신이 다시 그리기를 필요가 있다고 생각하지 않습니다. 탭이 테두리 레이아웃의 중심에없고 크기가 변경되는 경우 revalidate()가 필요할 수 있습니다. –

+0

다음 탭으로 이동하지만 탭 페이지의 맨 아래를 표시합니다. 어떻게 위로 올라갈 수 있습니까? – selladurai

관련 문제