code_work_posOrder_1.2

来源:互联网 发布:网络投资微信群 编辑:程序博客网 时间:2024/06/05 17:20

\org\pos\common\fe\CustomDialog.java

 

public class CustomDialog extends Dialog {protected Object result;       protected Shell shell;       String ManName;     String ClassName;     String OrderName;     int account;     double SimplePrice;    double allPrice;      public CustomDialog(Shell parent, String ManName, String ClassName, String OrderName, int account, double SimplePrice, double allPrice) {           super(parent, SWT.NONE);         this.ManName = ManName;         this.ClassName = ClassName;         this.OrderName = OrderName;         this.account = account;         this.SimplePrice = SimplePrice;        this.allPrice = allPrice;    }         public Object open() {           createContents();           shell.open();           shell.layout();           Display display = getParent().getDisplay();           while (!shell.isDisposed()) {               if (!display.readAndDispatch())                   display.sleep();           }           return result;       }         protected void createContents() {           shell = new Shell(getParent(), SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);           shell.setSize(300, 100);           shell.setText("Order Details Dialog");          shell.setLocation(400, 400);  //        final Button button = new Button(shell, SWT.NONE);          final Text txt = new Text(shell, SWT.NONE);        txt.setText(ManName+ " 订了 " + OrderName + "(" + ClassName + ") " + account + "件, 单价:" + SimplePrice +", 总价:" + allPrice);        txt.setSize(300, 20);   //        txt.setBounds(127, 74, 44, 23);   //        button.setBounds(127, 74, 44, 23);       }   }


 


 

\org\pos\common\fe\PosOrderMainWin.java

add

 

//list        final List list = new List(c2, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL|SWT.SIMPLE);//        list.addSelectionListener(new SelectionAdapter() {            @Override            public void widgetDefaultSelected(SelectionEvent e) {            }            @Override            //取得当前选取的项目            public void widgetSelected(SelectionEvent e) {             String select[] = list.getSelection();//             for(int i=0; i < select.length; i ++)//             {//             System.out.println(select[i]);//             }//           list Data             String ManName = "Bill";              String ClassName = "Bill";              String OrderName = "Bill";              int account = 2;              double SimplePrice = 12.0;             double allPrice = 24.0;                          new CustomDialog(Display.getCurrent().getActiveShell(),              ManName, ClassName, OrderName, account, SimplePrice, allPrice             ).open();                                }           });           list.setItems(new String[] {"one", "two", "three"});//初始发list           list.add("four");           list.add("five", 2);//在list的第二个位置加值           list.add("ddddd");//           list.setBounds(100, 50, 50, 50);


 


 

 


 

原创粉丝点击