본문 바로가기

창고/Backup_2012_0511이전

BlackBerry 개발-UI Manager

반응형
Screen 에서 Field 들의 정렬을 담당하는 메니저.

기본적으로 Java 스윙과 거의 동일하다.

1. FlowFieldManager


2. HorizontalFieldManager


3. VerticalFieldManager 

 

-. 사용방법
  1 /* MyApp.java */ 2 3 package mypackage; 4 5 import net.rim.device.api.ui.UiApplication; 6 7 /** 8 * This class extends the UiApplication class, providing a 9 * graphical user interface. 10 */ 11 public class MyApp extends UiApplication 12 { 13 /** 14 * Entry point for application 15 * @param args Command line arguments (not used) 16 */ 17 public static void main(String[] args) 18 { 19 // Create a new instance of the application and make the currently 20 // running thread the application's event dispatch thread. 21 MyApp theApp = new MyApp(); 22 theApp.enterEventDispatcher(); 23 } 24 25 26 /** 27 * Creates a new MyApp object 28 */ 29 public MyApp() 30 { 31 // Push a screen onto the UI stack for rendering. 32 pushScreen(new MyScreen()); 33 } 34 } 35

1 /* MyScreen.java */ 2 package mypackage; 3 4 import net.rim.device.api.ui.component.ButtonField; 5 import net.rim.device.api.ui.container.FlowFieldManager; 6 import net.rim.device.api.ui.container.HorizontalFieldManager; 7 import net.rim.device.api.ui.container.MainScreen; 8 import net.rim.device.api.ui.container.VerticalFieldManager; 9 10 /** 11 * A class extending the MainScreen class, which provides default standard 12 * behavior for BlackBerry GUI applications. 13 */ 14 public final class MyScreen extends MainScreen 15 { 16 /** 17 * Creates a new MyScreen object 18 */ 19 public MyScreen() 20 { 21 // Set the displayed title of the screen 22 setTitle("MyTitle"); 23 /* 필드 메니저의 종류 */ 24 /* 25 * FlowFieldManager 가로정렬후 세로 정렬(흐르듯 채워나감) 26 * HorizontalFieldManager 가로정렬 27 * VerticalFieldManager 세로 정렬 28 */ 29 /* 사용법 */ 30 FlowFieldManager myManager = new FlowFieldManager(); 31 add(myManager); 32 33 myManager.add(new ButtonField("Button01")); 34 myManager.add(new ButtonField("Button02")); 35 myManager.add(new ButtonField("Button03")); 36 myManager.add(new ButtonField("Button04")); 37 } 38 } 39
반응형