PPC应用程序开发

PPC应用程序开发

1.用eSWT开发同样是使用shell
   注意一点 shell的大小是根据ppc屏幕的大小来设置的 shell.setSize(240,310);

2.menu 可以通过这样的方式创建
 menuBar = new Menu(getShell(), SWT.BAR);
  getShell().setMenuBar(menuBar);
//   appListManager = AreaManager.getInstance();
//   
//   AreaItem[] appList = appListManager.getAreaItems();
  
  for(int i=0;i<4;i++) {
   mainMenu[i] = new MenuItem(menuBar, SWT.CASCADE);
   mainMenu[i].setText(Messages.getString("menu.main" + String.valueOf(i+1) + ".name",ApplicationManager.getInstance().getUserSession().getLocale()));
   
   if(i == 0) {
    Menu submenu = new Menu(getShell(), SWT.DROP_DOWN);
    mainMenu[i].setMenu(submenu);
    MenuItem submenuItem = new MenuItem(submenu, SWT.NONE);
    String hotKey = Messages.getString("menu.notification.history.hotkey",ApplicationManager.getInstance().getUserSession().getLocale());
    submenuItem.setText(Messages.getString("menu.notification.history.name",ApplicationManager.getInstance().getUserSession().getLocale()));
    submenuItem.setAccelerator(SWT.CTRL+hotKey.toCharArray()[0]);
    
    MenuItem submenuItem2 = new MenuItem(submenu, SWT.NONE);
    hotKey = Messages.getString("menu.logout.hotkey",ApplicationManager.getInstance().getUserSession().getLocale());
    submenuItem2.setText(Messages.getString("menu.logout.name",ApplicationManager.getInstance().getUserSession().getLocale()));
    submenuItem2.setAccelerator(SWT.CTRL+hotKey.toCharArray()[0]);
    
    submenuItem2.addSelectionListener(new SelectionListener(){
     public void widgetSelected(SelectionEvent arg0) {
      Display display = getDisplay();
      final Shell shell = new Shell (display, SWT.CLOSE|SWT.MOD3);
      LogoutDialog aboutDialog = new LogoutDialog(shell,SWT.NONE);
      shell.setSize(240,150);
      shell.open();
     }

     public void widgetDefaultSelected(SelectionEvent arg0) {
     }});   
    submenuItem.addSelectionListener(new SelectionListener() {

     public void widgetSelected(SelectionEvent arg0) {
            try {
             Control[] smallFrame = body.getChildren();
       for(int i=0;i<smallFrame.length;i++) {
        smallFrame[i].dispose();
       }
         body.redraw();
            }
            catch(Exception exp) {
             ApplicationView.this.setMessage(exp.getMessage());
            }
     }

     public void widgetDefaultSelected(SelectionEvent arg0) {}
     
    });
   
   
   }

你可能感兴趣的:(PPC应用程序开发)