Flex Panel

2018-01-01 19:23 更新

介紹

Panel類是一個容器,包括標題欄,字幕,邊框和其子項的內容區(qū)域。

類聲明

以下是 spark.components.Panel 類的聲明:

public class Panel
   extends SkinnableContainer

公共屬性

S.N.屬性和描述
1

controlBarContent:Array

要包含在Panel容器的控制欄區(qū)域中的組件集。

2

controlBarLayout:LayoutBase

定義容器的控制欄區(qū)域的布局。

3

controlBarVisible:Boolean

如果為true,則控制欄可見。

4

title:String

標題欄中顯示的標題或標題。

公共方法

S.N.方法和描述
1

Panel()

構造函數(shù)。

繼承的方法

此類繼承以下類中的方法:

  • spark.components.SkinnableContainer

  • spark.components.supportClasses.SkinnableContainerBase

  • spark.components.supportClasses.SkinnableComponent

  • mx.core.UIComponent

  • mx.core.FlexSprite

  • flash.display.Sprite

  • flash.display.DisplayObjectContainer

  • flash.display.InteractiveObject

  • flash.display.DisplayObject

  • flash.events.EventDispatcher

  • Object

Flex面板示例

讓我們按照以下步驟,通過創(chuàng)建測試應用程序來檢查Flex應用程序中Panel的使用情況:

步驟描述
1 Flex - 創(chuàng)建應用程序章節(jié)中所述,在包 com.tutorialspoint.client 下創(chuàng)建名為 HelloWorld 的項目。
2修改 HelloWorld.mxml ,如下所述。 保持文件的其余部分不變。
3編譯并運行應用程序,以確保業(yè)務邏輯按照要求工作。

以下是修改后的mxml文件 src / com.tutorialspoint / HelloWorld.mxml 的內容。

<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
   xmlns:s="library://ns.adobe.com/flex/spark"
   xmlns:mx="library://ns.adobe.com/flex/mx"
   width="100%" height="100%" minWidth="500" minHeight="500"
   >  
   <fx:Style source="/com/tutorialspoint/client/Style.css"/>
   <s:BorderContainer width="630" height="480" id="mainContainer" 
      styleName="container">
      <s:VGroup width="100%" height="100%" gap="50" 
         horizontalAlign="center" verticalAlign="middle">
         <s:Label id="lblHeader" text="Layout Panels Demonstration" 
         fontSize="40" color="0x777777" styleName="heading"/>
         <s:Panel id="panelPanel" title="Using Panel" width="500" 
            height="300">
            <s:layout>
               <s:HorizontalLayout  gap="10" 
                  verticalAlign="middle" horizontalAlign="center"/>	
            </s:layout>
            <s:Panel title="Basic Layout Panel" top="0" 
               left="5" height="200" width="150" >						
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="0" />
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="55" />
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="110" />
            </s:Panel>
            <s:Panel title="Horizontal Layout Panel" top="0" 
               left="5" height="200" width="170" >
               <s:layout>
                  <s:HorizontalLayout/>	
               </s:layout>
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="0" />
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="55" />
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="110" />
            </s:Panel>
            <s:Panel title="Vertical Layout Panel" top="0" 
               left="5" height="200" width="150" >
               <s:layout>
                  <s:VerticalLayout />	
               </s:layout>
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="0" />
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="55" />
               <s:BorderContainer width="50" height="50" 
                  borderWeight="2" color="0x323232" top="110" />
            </s:Panel>
         </s:Panel>
      </s:VGroup>	 
   </s:BorderContainer>	
</s:Application>

準備好所有更改后,讓我們以正常模式編譯和運行應用程序,就像在 Flex - 創(chuàng)建應用程序中一樣 章節(jié)。 如果一切順利,您的應用程序,這將產生以下結果:[在線試用]

Flex Panel
以上內容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號