簡體   English   中英

GWT 異常:SimplePanel 只能包含一個子小部件

[英]GWT Exception: SimplePanel can only contain one child widget

以下ui.xml文件輸出拋出異常

<g:HTMLPanel ui:field="uiPanelDialog" styleName="{CSS.common.flexContainerColumn} {style.content}">
    <g:Label ui:field="uiLabelTitle" styleName="{style.title}" text="What are you Looking for?"/>
    <g:HTMLPanel ui:field="uiPanelOptions" styleName="{style.scroll}">
        <g:FocusPanel ui:field="uiPanelWelcomeTutorial" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Welcome Tutorial</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelGettingStarted" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Getting Started</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelAppointmentManagement" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Appointment Management</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelClientMangement" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Client Mangement</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelStaffManagement" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Staff Management</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelIntegrationSetup" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Integration Setup</g:Label>
        </g:FocusPanel>
        <g:FocusPanel ui:field="uiPanelTechnicalSetup" styleName="{style.options}">
            <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" />
            <g:Label>Technical Setup</g:Label>
        </g:FocusPanel>
    </g:HTMLPanel>
    <g:HTMLPanel ui:field="uiPanelFooter">
        <g:FocusPanel ui:field="uiPanelGetHelpOnline" styleName="{style.options}" width="50%">
            <g:Label>Get Help Online</g:Label>
        </g:FocusPanel>
        <div class="{style.option-divider}" />
        <g:FocusPanel ui:field="uiPanelSendFeedback" styleName="{style.options}" width="50%">
            <g:Label>Send Feedback</g:Label>
        </g:FocusPanel>
    </g:HTMLPanel>

</g:HTMLPanel>

引起:java.lang.IllegalStateException:SimplePanel 只能包含一個子部件

我無法弄清楚為什么它會給出這個異常。上面的代碼有什么問題。 我想了解如何在焦點面板中放置不同的部分。

 <g:FocusPanel ui:field="uiPanelWelcomeTutorial" styleName="{style.options}"> <g:Image styleName="{style.image}" url="res/images/user_b.png" width="60px" height="60px" /> <g:Label>Welcome Tutorial</g:Label> </g:FocusPanel>

FocusPanel擴展SimplePanel ,它只能有一個孩子,正如您的錯誤告訴您的那樣。 我不確定您為什么要使用FocusPanel來包裝這兩個孩子,但您不能這樣做 - 只允許一個孩子在里面。 如果您出於某種原因希望它們可以共同聚焦,請將ImageLabel放在一個容器中,然后將放入FocusPanel

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM