锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲国产精品无码久久久不卡,精品国产日韩亚洲一区91,亚洲不卡中文字幕无码http://www.tkk7.com/hengheng123456789/category/16704.htmlzh-cnSun, 12 Aug 2007 03:35:13 GMTSun, 12 Aug 2007 03:35:13 GMT60SWT 鎺т歡綆浠?/title><link>http://www.tkk7.com/hengheng123456789/articles/79899.html</link><dc:creator>鍝煎摷</dc:creator><author>鍝煎摷</author><pubDate>Wed, 08 Nov 2006 08:55:00 GMT</pubDate><guid>http://www.tkk7.com/hengheng123456789/articles/79899.html</guid><wfw:comment>http://www.tkk7.com/hengheng123456789/comments/79899.html</wfw:comment><comments>http://www.tkk7.com/hengheng123456789/articles/79899.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hengheng123456789/comments/commentRss/79899.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hengheng123456789/services/trackbacks/79899.html</trackback:ping><description><![CDATA[鍙互鍙傝冭繖綃囨枃绔狅細(xì)<br /><a >http://www.eclipse.org/swt/widgets/</a><br /><img src ="http://www.tkk7.com/hengheng123456789/aggbug/79899.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hengheng123456789/" target="_blank">鍝煎摷</a> 2006-11-08 16:55 <a href="http://www.tkk7.com/hengheng123456789/articles/79899.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SWT Layoutshttp://www.tkk7.com/hengheng123456789/articles/79894.html鍝煎摷鍝煎摷Wed, 08 Nov 2006 08:51:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79894.htmlhttp://www.tkk7.com/hengheng123456789/comments/79894.htmlhttp://www.tkk7.com/hengheng123456789/articles/79894.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79894.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79894.html鍙互鍙傜湅姝ゆ枃绔狅紝鍐欏緱鐩稿綋璇︾粏錛氾級
http://www.eclipse.org/articles/Article-Understanding-Layouts/Understanding-Layouts.htm



鍝煎摷 2006-11-08 16:51 鍙戣〃璇勮
]]>
SWT Drag and Drop http://www.tkk7.com/hengheng123456789/articles/79661.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 10:05:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79661.htmlhttp://www.tkk7.com/hengheng123456789/comments/79661.htmlhttp://www.tkk7.com/hengheng123456789/articles/79661.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79661.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79661.html1銆佹嫋鎷絃abel鐨勬枃瀛椼?br />
聽public static void main (String [] args) {
聽聽
聽聽Display display = new Display ();
聽聽final Shell shell = new Shell (display);
聽聽shell.setLayout(new FillLayout());
聽聽final Label label1 = new Label (shell, SWT.BORDER);
聽聽label1.setText ("TEXT");
聽聽final Label label2 = new Label (shell, SWT.BORDER);
聽聽setDragDrop (label1);
聽聽setDragDrop (label2);
聽聽shell.setSize (200, 200);
聽聽shell.open ();
聽聽while (!shell.isDisposed ()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}

聽public static void setDragDrop (final Label label) {
聽聽
聽聽Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
聽聽int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
聽聽
聽聽final DragSource source = new DragSource (label, operations);
聽聽source.setTransfer(types);
聽聽source.addDragListener (new DragSourceListener () {
聽聽聽public void dragStart(DragSourceEvent event) {
聽聽聽聽event.doit = (label.getText ().length () != 0);
聽聽聽}
聽聽聽public void dragSetData (DragSourceEvent event) {
聽聽聽聽event.data = label.getText ();
聽聽聽}
聽聽聽public void dragFinished(DragSourceEvent event) {
聽聽聽聽if (event.detail == DND.DROP_MOVE)
聽聽聽聽聽label.setText ("");
聽聽聽}
聽聽});

聽聽DropTarget target = new DropTarget(label, operations);
聽聽target.setTransfer(types);
聽聽target.addDropListener (new DropTargetAdapter() {
聽聽聽public void drop(DropTargetEvent event) {
聽聽聽聽if (event.data == null) {
聽聽聽聽聽event.detail = DND.DROP_NONE;
聽聽聽聽聽return;
聽聽聽聽}
聽聽聽聽label.setText ((String) event.data);
聽聽聽}
聽聽});
聽}

2銆侀殢鎰忔嫋鎷絋ree瀛愯妭鐐廣?br />
聽public static void main (String [] args) {
聽聽
聽聽final Display display = new Display ();
聽聽final Shell shell = new Shell (display);
聽聽shell.setLayout(new FillLayout());
聽聽//寤虹珛鐢ㄤ簬鎷栨嫿鐨勬爲(wèi)
聽聽final Tree tree = new Tree(shell, SWT.BORDER);
聽聽for (int i = 0; i < 3; i++) {
聽聽聽TreeItem item = new TreeItem(tree, SWT.NONE);
聽聽聽item.setText("item "+i);
聽聽聽for (int j = 0; j < 3; j++) {
聽聽聽聽TreeItem subItem = new TreeItem(item, SWT.NONE);
聽聽聽聽subItem.setText("item "+i+" "+j);
聽聽聽聽for (int k = 0; k < 3; k++) {
聽聽聽聽聽TreeItem subsubItem = new TreeItem(subItem, SWT.NONE);
聽聽聽聽聽subsubItem.setText("item "+i+" "+j+" "+k);
聽聽聽聽}
聽聽聽}
聽聽}
聽聽
聽聽Transfer[] types = new Transfer[] {TextTransfer.getInstance()};
聽聽int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK;
聽聽
聽聽//寤虹珛鎷栨嫿 婧愨斺斺斺旀爲(wèi)tree瀵硅薄
聽聽final DragSource source = new DragSource (tree, operations);
聽聽source.setTransfer(types);
聽聽final TreeItem[] dragSourceItem = new TreeItem[1];
聽聽source.addDragListener (new DragSourceListener () {
聽聽聽public void dragStart(DragSourceEvent event) {
聽聽聽聽TreeItem[] selection = tree.getSelection();聽// 鑾峰彇鎵閫塼ree鐨勮妭鐐?br />聽聽聽聽if (selection.length > 0 && selection[0].getItemCount() == 0) //鍒ゆ柇鎵閫夎妭鐐規(guī)槸鍚﹀瓨鍦ㄥ茍涓斾負(fù)鏈鑺傜偣
聽聽聽聽{
聽聽聽聽聽event.doit = true;聽//鍚姩鎷栨嫿鍔熻兘
聽聽聽聽聽dragSourceItem[0] = selection[0]; //淇濆瓨鎷栨嫿鑺傜偣淇℃伅
聽聽聽聽} else {
聽聽聽聽聽event.doit = false;
聽聽聽聽}
聽聽聽};
聽聽聽public void dragSetData (DragSourceEvent event) {
聽聽聽聽event.data = dragSourceItem[0].getText(); //淇濆瓨鎷栨嫿鑺傜偣淇℃伅鍒頒簨浠舵暟鎹腑
聽聽聽}
聽聽聽public void dragFinished(DragSourceEvent event) {
聽聽聽聽if (event.detail == DND.DROP_MOVE)
聽聽聽聽聽dragSourceItem[0].dispose();
聽聽聽聽聽dragSourceItem[0] = null;
聽聽聽}
聽聽});
聽聽
聽聽//寤虹珛鎷栨嫿 鐩殑鈥斺斺斺旀爲(wèi)tree瀵硅薄
聽聽DropTarget target = new DropTarget(tree, operations);
聽聽target.setTransfer(types);
聽聽target.addDropListener (new DropTargetAdapter() {
聽聽聽//澶勭悊鎷栨嫿鍒扮洰鐨勪笂絀烘椂鐨勬柟娉?br />聽聽聽public void dragOver(DropTargetEvent event) {
聽聽聽聽event.feedback = DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL; //鍝嶅簲鎷栨嫿鍔ㄤ綔錛孎EEDBACK_EXPAND琛ㄧず鎷栨嫿鍒板彲浠ュ睍寮鐨勮妭鐐規(guī)椂灞曞紑鐩稿簲鑺傜偣銆?br />聽聽聽聽if (event.item != null) {
聽聽聽聽聽TreeItem item = (TreeItem)event.item;
聽聽聽聽聽//澶勭悊鎷栨嫿鍔ㄤ綔鍝嶅簲錛屾牴鎹嫋鎷界殑浣嶇疆涓嶅悓浜х敓涓嶅悓鐨勫搷搴?br />聽聽聽聽聽Point pt = display.map(null, tree, event.x, event.y); //鑾峰彇鎷栨嫿褰撳墠浣嶇疆鐐?br />聽聽聽聽聽Rectangle bounds = item.getBounds(); //鑾峰彇鐩殑鑺傜偣鐨勮竟妗?br />聽聽聽聽聽
聽聽聽聽聽//鏍規(guī)嵁鎷栨嫿褰撳墠浣嶇疆鐐逛笌鐩殑鑺傜偣鐨勮竟妗嗕綅緗緗搷搴旓紝濡傛樉紺轟負(fù)FEEDBACK_INSERT_BEFORE銆丗EEDBACK_INSERT_AFTER
聽聽聽聽聽if (pt.y < bounds.y + bounds.height/3) {
聽聽聽聽聽聽event.feedback |= DND.FEEDBACK_INSERT_BEFORE;
聽聽聽聽聽} else if (pt.y > bounds.y + 2*bounds.height/3) {
聽聽聽聽聽聽event.feedback |= DND.FEEDBACK_INSERT_AFTER;
聽聽聽聽聽} else {
聽聽聽聽聽聽event.feedback |= DND.FEEDBACK_SELECT;
聽聽聽聽聽}
聽聽聽聽}
聽聽聽}
聽聽聽//澶勭悊鏀句笅鏃剁殑鏂規(guī)硶
聽聽聽public void drop(DropTargetEvent event) {
聽聽聽聽if (event.data == null) {
聽聽聽聽聽event.detail = DND.DROP_NONE;
聽聽聽聽聽return;
聽聽聽聽}
聽聽聽聽String text = (String)event.data;
聽聽聽聽//濡傛灉鏀句笅鐨勪綅緗病鏈夎妭鐐癸紝鍒欐柊寤虹珛涓涓妭鐐癸紝浠ユ牴鑺傜偣涓虹埗鑺傜偣
聽聽聽聽if (event.item == null)
聽聽聽聽{
聽聽聽聽聽TreeItem item = new TreeItem(tree, SWT.NONE);
聽聽聽聽聽item.setText(text);
聽聽聽聽}
聽聽聽聽//濡傛灉鏀句笅鐨勪綅緗湁鑺傜偣
聽聽聽聽else
聽聽聽聽{
聽聽聽聽聽TreeItem item = (TreeItem)event.item;
聽聽聽聽聽Point pt = display.map(null, tree, event.x, event.y);
聽聽聽聽聽Rectangle bounds = item.getBounds();
聽聽聽聽聽TreeItem parent = item.getParentItem();
聽聽聽聽聽if (parent != null) {
聽聽聽聽聽聽TreeItem[] items = parent.getItems();
聽聽聽聽聽聽int index = 0;
聽聽聽聽聽聽for (int i = 0; i < items.length; i++) {
聽聽聽聽聽聽聽if (items[i] == item) {
聽聽聽聽聽聽聽聽index = i;
聽聽聽聽聽聽聽聽break;
聽聽聽聽聽聽聽}
聽聽聽聽聽聽}
聽聽聽聽聽聽if (pt.y < bounds.y + bounds.height/3) {
聽聽聽聽聽聽聽//浠ュ綋鍓嶈妭鐐圭殑鐖惰妭鐐逛負(fù)鐖跺緩绔嬩竴涓瓙鑺傜偣錛屽茍涓旀彃鍏ュ埌褰撳墠鑺傜偣鍓?br />聽聽聽聽聽聽聽TreeItem newItem = new TreeItem(parent, SWT.NONE, index);
聽聽聽聽聽聽聽newItem.setText(text);
聽聽聽聽聽聽} else if (pt.y > bounds.y + 2*bounds.height/3) {
聽聽聽聽聽聽聽//浠ュ綋鍓嶈妭鐐圭殑鐖惰妭鐐逛負(fù)鐖跺緩绔嬩竴涓瓙鑺傜偣錛屽茍涓旀彃鍏ュ埌褰撳墠鑺傜偣鍓?br />聽聽聽聽聽聽聽TreeItem newItem = new TreeItem(parent, SWT.NONE, index+1);
聽聽聽聽聽聽聽newItem.setText(text);
聽聽聽聽聽聽} else {
聽聽聽聽聽聽聽//浠ュ綋鍓嶄負(fù)鐖惰妭鐐瑰緩绔嬩竴涓瓙鑺傜偣
聽聽聽聽聽聽聽TreeItem newItem = new TreeItem(item, SWT.NONE);
聽聽聽聽聽聽聽newItem.setText(text);
聽聽聽聽聽聽}
聽聽聽聽聽聽
聽聽聽聽聽} else {
聽聽聽聽聽聽TreeItem[] items = tree.getItems();
聽聽聽聽聽聽int index = 0;
聽聽聽聽聽聽for (int i = 0; i < items.length; i++) {
聽聽聽聽聽聽聽if (items[i] == item) {
聽聽聽聽聽聽聽聽index = i;
聽聽聽聽聽聽聽聽break;
聽聽聽聽聽聽聽}
聽聽聽聽聽聽}
聽聽聽聽聽聽if (pt.y < bounds.y + bounds.height/3) {
聽聽聽聽聽聽聽TreeItem newItem = new TreeItem(tree, SWT.NONE, index);
聽聽聽聽聽聽聽newItem.setText(text);
聽聽聽聽聽聽} else if (pt.y > bounds.y + 2*bounds.height/3) {
聽聽聽聽聽聽聽TreeItem newItem = new TreeItem(tree, SWT.NONE, index+1);
聽聽聽聽聽聽聽newItem.setText(text);
聽聽聽聽聽聽} else {
聽聽聽聽聽聽聽TreeItem newItem = new TreeItem(item, SWT.NONE);
聽聽聽聽聽聽聽newItem.setText(text);
聽聽聽聽聽聽}
聽聽聽聽聽}
聽聽聽聽聽
聽聽聽聽聽
聽聽聽聽}
聽聽聽}
聽聽});

聽聽shell.setSize (400, 400);
聽聽shell.open ();
聽聽while (!shell.isDisposed ()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}



鍝煎摷 2006-11-07 18:05 鍙戣〃璇勮
]]>
SWT Tool Tips瀹炵幇錛圱ool Tips 綾伙級http://www.tkk7.com/hengheng123456789/articles/79658.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 09:39:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79658.htmlhttp://www.tkk7.com/hengheng123456789/comments/79658.htmlhttp://www.tkk7.com/hengheng123456789/articles/79658.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79658.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79658.htmlTool Tips 瀹炵幇鍥懼儚鍐呯殑Tool Tips 銆?br />聽public static void main (String [] args) {
聽聽Display display = new Display ();
聽聽final Color [] colors = {
聽聽聽display.getSystemColor (SWT.COLOR_RED),
聽聽聽display.getSystemColor (SWT.COLOR_GREEN),
聽聽聽display.getSystemColor (SWT.COLOR_BLUE),
聽聽};
聽聽final Rectangle [] rects = {
聽聽聽new Rectangle (10, 10, 30, 30),
聽聽聽new Rectangle (20, 45, 25, 35),
聽聽聽new Rectangle (80, 80, 10, 10),
聽聽};
聽聽final Shell shell = new Shell (display);
聽聽Listener mouseListener = new Listener () {
聽聽聽public void handleEvent (Event event) {
聽聽聽聽switch (event.type) {
聽聽聽聽聽case SWT.MouseEnter:
聽聽聽聽聽case SWT.MouseMove:
聽聽聽聽聽聽for (int i=0; i<rects.length; i++) {
聽聽聽聽聽聽聽if (rects [i].contains (event.x, event.y)) {
聽聽聽聽聽聽聽聽String text = "ToolTip " + i;
聽聽聽聽聽聽聽聽if (!(text.equals (shell.getToolTipText ()))) {
聽聽聽聽聽聽聽聽聽shell.setToolTipText ("ToolTip " + i);
聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽聽return;
聽聽聽聽聽聽聽}
聽聽聽聽聽聽}
聽聽聽聽聽聽shell.setToolTipText (null);
聽聽聽聽聽聽break;
聽聽聽聽聽}
聽聽聽}
聽聽};
聽聽shell.addListener (SWT.MouseMove, mouseListener);
聽聽shell.addListener (SWT.MouseEnter, mouseListener);
聽聽shell.addListener (SWT.Paint, new Listener () {
聽聽聽public void handleEvent (Event event) {
聽聽聽聽GC gc = event.gc;
聽聽聽聽for (int i=0; i<rects.length; i++) {
聽聽聽聽聽gc.setBackground (colors [i]);
聽聽聽聽聽gc.fillRectangle (rects [i]);
聽聽聽聽聽gc.drawRectangle (rects [i]);
聽聽聽聽}
聽聽聽}
聽聽});
聽聽shell.setSize (200, 200);
聽聽shell.open ();
聽聽while (!shell.isDisposed ()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}

2銆佷嬌鐢⊿hell瀹炵幇Tool Tip鐨勫姛鑳姐?br />聽public static void main (String[] args) {
聽聽final Display display = new Display ();
聽聽final Shell shell = new Shell (display);
聽聽shell.setLayout (new FillLayout ());
聽聽final Table table = new Table (shell, SWT.BORDER);
聽聽for (int i = 0; i < 20; i++) {
聽聽聽TableItem item = new TableItem (table, SWT.NONE);
聽聽聽item.setText ("item " + i);
聽聽}
聽聽// Disable native tooltip
聽聽table.setToolTipText ("");
聽聽
聽聽// Implement a "fake" tooltip
聽聽final Listener labelListener = new Listener () {
聽聽聽public void handleEvent (Event event) {
聽聽聽聽Label label = (Label)event.widget;
聽聽聽聽Shell shell = label.getShell ();
聽聽聽聽switch (event.type) {
聽聽聽聽聽case SWT.MouseDown:
聽聽聽聽聽聽Event e = new Event ();
聽聽聽聽聽聽e.item = (TableItem) label.getData ("_TABLEITEM");
聽聽聽聽聽聽// Assuming table is single select, set the selection as if
聽聽聽聽聽聽// the mouse down event went through to the table
聽聽聽聽聽聽table.setSelection (new TableItem [] {(TableItem) e.item});
聽聽聽聽聽聽table.notifyListeners (SWT.Selection, e);
聽聽聽聽聽聽shell.dispose ();
聽聽聽聽聽聽table.setFocus();
聽聽聽聽聽聽break;
聽聽聽聽聽case SWT.MouseExit:
聽聽聽聽聽聽shell.dispose ();
聽聽聽聽聽聽break;
聽聽聽聽}
聽聽聽}
聽聽};
聽聽
聽聽Listener tableListener = new Listener () {
聽聽聽Shell tip = null;
聽聽聽Label label = null;
聽聽聽public void handleEvent (Event event) {
聽聽聽聽switch (event.type) {
聽聽聽聽聽case SWT.Dispose:
聽聽聽聽聽case SWT.KeyDown:
聽聽聽聽聽case SWT.MouseMove: {
聽聽聽聽聽聽if (tip == null) break;
聽聽聽聽聽聽tip.dispose ();
聽聽聽聽聽聽tip = null;
聽聽聽聽聽聽label = null;
聽聽聽聽聽聽break;
聽聽聽聽聽}
聽聽聽聽聽case SWT.MouseHover: {
聽聽聽聽聽聽TableItem item = table.getItem (new Point (event.x, event.y));
聽聽聽聽聽聽if (item != null) {
聽聽聽聽聽聽聽if (tip != null聽 && !tip.isDisposed ()) tip.dispose ();
聽聽聽聽聽聽聽//浣跨敤Shell瀹炵幇Tool Tip鐨勫姛鑳?br />聽聽聽聽聽聽聽tip = new Shell (shell, SWT.ON_TOP | SWT.NO_FOCUS | SWT.TOOL);
聽聽聽聽聽聽聽tip.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
聽聽聽聽聽聽聽FillLayout layout = new FillLayout ();
聽聽聽聽聽聽聽layout.marginWidth = 2;
聽聽聽聽聽聽聽tip.setLayout (layout);
聽聽聽聽聽聽聽label = new Label (tip, SWT.NONE);
聽聽聽聽聽聽聽label.setForeground (display.getSystemColor (SWT.COLOR_INFO_FOREGROUND));
聽聽聽聽聽聽聽label.setBackground (display.getSystemColor (SWT.COLOR_INFO_BACKGROUND));
聽聽聽聽聽聽聽label.setData ("_TABLEITEM", item);
聽聽聽聽聽聽聽label.setText (item.getText ());
聽聽聽聽聽聽聽label.addListener (SWT.MouseExit, labelListener);
聽聽聽聽聽聽聽label.addListener (SWT.MouseDown, labelListener);
聽聽聽聽聽聽聽Point size = tip.computeSize (SWT.DEFAULT, SWT.DEFAULT);
聽聽聽聽聽聽聽Rectangle rect = item.getBounds (0);
聽聽聽聽聽聽聽Point pt = table.toDisplay (rect.x, rect.y);
聽聽聽聽聽聽聽tip.setBounds (pt.x, pt.y, size.x, size.y);
聽聽聽聽聽聽聽tip.setVisible (true);
聽聽聽聽聽聽}
聽聽聽聽聽}
聽聽聽聽}
聽聽聽}
聽聽};
聽聽table.addListener (SWT.Dispose, tableListener);
聽聽table.addListener (SWT.KeyDown, tableListener);
聽聽table.addListener (SWT.MouseMove, tableListener);
聽聽table.addListener (SWT.MouseHover, tableListener);
聽聽shell.pack ();
聽聽shell.open();
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch())
聽聽聽聽display.sleep();
聽聽}
聽聽display.dispose();
聽}


鍝煎摷 2006-11-07 17:39 鍙戣〃璇勮
]]>
SWT Stack甯冨眬錛圫tackLayout 綾伙級http://www.tkk7.com/hengheng123456789/articles/79648.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 09:14:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79648.htmlhttp://www.tkk7.com/hengheng123456789/comments/79648.htmlhttp://www.tkk7.com/hengheng123456789/articles/79648.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79648.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79648.html1銆佷笉鍚孋omponsit闂寸殑鍒囨崲銆?br />聽static int pageNum = -1;

聽public static void main (String [] args) {
聽聽Display display = new Display ();
聽聽Shell shell = new Shell (display);
聽聽shell.setBounds (10, 10, 300, 200);
聽聽// create the composite that the pages will share
聽聽final Composite contentPanel = new Composite (shell, SWT.BORDER);
聽聽contentPanel.setBounds (100, 10, 190, 90);
聽聽final StackLayout layout = new StackLayout ();
聽聽contentPanel.setLayout (layout);

聽聽// create the first page's content
聽聽Composite page0;
聽聽page0 = new Composite (contentPanel, SWT.NONE);
聽聽page0.setLayout (new RowLayout ());
聽聽Label label = new Label (page0, SWT.NONE);
聽聽label.setText ("Label on page 1");
聽聽label.pack ();

聽聽// create the second page's content聽
聽聽Composite page1;
聽聽page1 = new Composite (contentPanel, SWT.NONE);
聽聽page1.setLayout (new RowLayout ());
聽聽Button button = new Button (page1, SWT.NONE);
聽聽button.setText ("Button on page 2");
聽聽button.pack ();

聽聽// create the button that will switch between the pages
聽聽Button pageButton = new Button (shell, SWT.PUSH);
聽聽pageButton.setText ("Push");
聽聽pageButton.setBounds (10, 10, 80, 25);
聽聽pageButton.addListener (SWT.Selection, new Listener () {
聽聽聽public void handleEvent (Event event) {
聽聽聽聽pageNum = ++pageNum % 2;
聽聽聽聽contentPanel.layout ();
聽聽聽}
聽聽});
聽聽layout.topControl = page0;

聽聽shell.open ();
聽聽while (!shell.isDisposed ()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}



鍝煎摷 2006-11-07 17:14 鍙戣〃璇勮
]]>
SWT Swing/AWT 錛圫wing/AWT 綾伙級http://www.tkk7.com/hengheng123456789/articles/79645.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 09:09:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79645.htmlhttp://www.tkk7.com/hengheng123456789/comments/79645.htmlhttp://www.tkk7.com/hengheng123456789/articles/79645.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79645.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79645.html Swing/AWT 涓昏鏄彲浠ュ湪SWT涓嬌鐢?a name="awt">Swing/AWT 錛屼絾鏄槸鏈夋潯浠剁殑銆?br />
1銆侀泦鎴愮畝鍗曠殑AWT琛ㄥ拰鏍囩銆?br />聽static class FileTableModel extends AbstractTableModel {聽聽
聽聽File[] files;聽聽聽聽聽聽聽
聽聽String[] columnsName = {"Name", "Size", "Date Modified"};
聽聽
聽聽public FileTableModel (File[] files) {
聽聽聽this.files = files;
聽聽}
聽聽public int getColumnCount () {
聽聽聽return columnsName.length;
聽聽}
聽聽public Class getColumnClass (int col) {
聽聽聽if (col == 1) return Long.class;
聽聽聽if (col == 2) return Date.class;
聽聽聽return String.class;
聽聽}
聽聽public int getRowCount () {
聽聽聽return files == null ? 0 : files.length;
聽聽}
聽聽public Object getValueAt (int row, int col) {
聽聽聽if (col == 0) return files[row].getName();
聽聽聽if (col == 1) return new Long(files[row].length());
聽聽聽if (col == 2) return new Date(files[row].lastModified());
聽聽聽return "";
聽聽}
聽聽public String getColumnName (int col) {
聽聽聽return columnsName[col];
聽聽}
聽}

聽public static void main(String[] args) {
聽聽final Display display = new Display();
聽聽final Shell shell = new Shell(display);
聽聽shell.setText("SWT and Swing/AWT Example");

聽聽Listener exitListener = new Listener() {
聽聽聽public void handleEvent(Event e) {
聽聽聽聽MessageBox dialog = new MessageBox(shell, SWT.OK | SWT.CANCEL | SWT.ICON_QUESTION);
聽聽聽聽dialog.setText("Question");
聽聽聽聽dialog.setMessage("Exit?");
聽聽聽聽if (e.type == SWT.Close) e.doit = false;
聽聽聽聽if (dialog.open() != SWT.OK) return;
聽聽聽聽shell.dispose();
聽聽聽}
聽聽};聽
聽聽Listener aboutListener = new Listener() {
聽聽聽public void handleEvent(Event e) {
聽聽聽聽final Shell s = new Shell(shell, SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
聽聽聽聽s.setText("About");
聽聽聽聽GridLayout layout = new GridLayout(1, false);
聽聽聽聽layout.verticalSpacing = 20;
聽聽聽聽layout.marginHeight = layout.marginWidth = 10;
聽聽聽聽s.setLayout(layout);
聽聽聽聽Label label = new Label(s, SWT.NONE);
聽聽聽聽label.setText("SWT and AWT Example.");
聽聽聽聽Button button = new Button(s, SWT.PUSH);
聽聽聽聽button.setText("OK");
聽聽聽聽GridData data = new GridData();
聽聽聽聽data.horizontalAlignment = GridData.CENTER;
聽聽聽聽button.setLayoutData(data);
聽聽聽聽button.addListener(SWT.Selection, new Listener() {
聽聽聽聽聽public void handleEvent(Event event) {
聽聽聽聽聽聽s.dispose();
聽聽聽聽聽}
聽聽聽聽});
聽聽聽聽s.pack();
聽聽聽聽Rectangle parentBounds = shell.getBounds();
聽聽聽聽Rectangle bounds = s.getBounds();
聽聽聽聽int x = parentBounds.x + (parentBounds.width - bounds.width) / 2;
聽聽聽聽int y = parentBounds.y + (parentBounds.height - bounds.height) / 2;
聽聽聽聽s.setLocation(x, y);
聽聽聽聽s.open();
聽聽聽聽while (!s.isDisposed()) {
聽聽聽聽聽if (!display.readAndDispatch()) display.sleep();
聽聽聽聽}
聽聽聽}
聽聽};
聽聽shell.addListener(SWT.Close, exitListener);
聽聽Menu mb = new Menu(shell, SWT.BAR);
聽聽MenuItem fileItem = new MenuItem(mb, SWT.CASCADE);
聽聽fileItem.setText("&File");
聽聽Menu fileMenu = new Menu(shell, SWT.DROP_DOWN);
聽聽fileItem.setMenu(fileMenu);
聽聽MenuItem exitItem = new MenuItem(fileMenu, SWT.PUSH);
聽聽exitItem.setText("&Exit\tCtrl+X");
聽聽exitItem.setAccelerator(SWT.CONTROL + 'X');
聽聽exitItem.addListener(SWT.Selection, exitListener);
聽聽MenuItem aboutItem = new MenuItem(fileMenu, SWT.PUSH);
聽聽aboutItem.setText("&About\tCtrl+A");
聽聽aboutItem.setAccelerator(SWT.CONTROL + 'A');
聽聽aboutItem.addListener(SWT.Selection, aboutListener);
聽聽shell.setMenuBar(mb);

聽聽RGB color = shell.getBackground().getRGB();
聽聽Label separator1 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
聽聽Label locationLb = new Label(shell, SWT.NONE);
聽聽locationLb.setText("Location:");
聽聽Composite locationComp = new Composite(shell, SWT.EMBEDDED);
聽聽ToolBar toolBar = new ToolBar(shell, SWT.FLAT);
聽聽ToolItem exitToolItem = new ToolItem(toolBar, SWT.PUSH);
聽聽exitToolItem.setText("&Exit");
聽聽exitToolItem.addListener(SWT.Selection, exitListener);
聽聽ToolItem aboutToolItem = new ToolItem(toolBar, SWT.PUSH);
聽聽aboutToolItem.setText("&About");
聽聽aboutToolItem.addListener(SWT.Selection, aboutListener);
聽聽Label separator2 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
聽聽final Composite comp = new Composite(shell, SWT.NONE);
聽聽final Tree fileTree = new Tree(comp, SWT.SINGLE | SWT.BORDER);
聽聽Sash sash = new Sash(comp, SWT.VERTICAL);
聽聽Composite tableComp = new Composite(comp, SWT.EMBEDDED);聽//Composite瀵硅薄蹇呴』涓篠WT.EMBEDDED鎵嶅彲浠ヨ杞絘wt/swing鍐呭
聽聽Label separator3 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
聽聽Composite statusComp = new Composite(shell, SWT.EMBEDDED);

聽聽java.awt.Frame locationFrame = SWT_AWT.new_Frame(locationComp);
聽聽final java.awt.TextField locationText = new java.awt.TextField();
聽聽locationFrame.add(locationText);

聽聽//澶勭悊awt琛?br />聽聽java.awt.Frame fileTableFrame = SWT_AWT.new_Frame(tableComp);
聽聽java.awt.Panel panel = new java.awt.Panel(new java.awt.BorderLayout());
聽聽fileTableFrame.add(panel);
聽聽final JTable fileTable = new JTable(new FileTableModel(null));
聽聽fileTable.setDoubleBuffered(true);
聽聽fileTable.setShowGrid(false);
聽聽fileTable.createDefaultColumnsFromModel();
聽聽JScrollPane scrollPane = new JScrollPane(fileTable);
聽聽panel.add(scrollPane);

聽聽//澶勭悊awt鐘舵丩abel
聽聽java.awt.Frame statusFrame = SWT_AWT.new_Frame(statusComp);
聽聽statusFrame.setBackground(new java.awt.Color(color.red, color.green, color.blue));
聽聽final java.awt.Label statusLabel = new java.awt.Label();
聽聽statusFrame.add(statusLabel);
聽聽statusLabel.setText("Select a file");

聽聽sash.addListener(SWT.Selection, new Listener() {
聽聽聽public void handleEvent(Event e) {
聽聽聽聽if (e.detail == SWT.DRAG) return;
聽聽聽聽GridData data = (GridData)fileTree.getLayoutData();
聽聽聽聽Rectangle trim = fileTree.computeTrim(0, 0, 0, 0);
聽聽聽聽data.widthHint = e.x - trim.width;
聽聽聽聽comp.layout();
聽聽聽}
聽聽});

聽聽File[] roots = File.listRoots();
聽聽for (int i = 0; i < roots.length; i++) {
聽聽聽File file = roots[i];
聽聽聽TreeItem treeItem = new TreeItem(fileTree, SWT.NONE);
聽聽聽treeItem.setText(file.getAbsolutePath());
聽聽聽treeItem.setData(file);
聽聽聽new TreeItem(treeItem, SWT.NONE);
聽聽}
聽聽fileTree.addListener(SWT.Expand, new Listener() {
聽聽聽public void handleEvent(Event e) {
聽聽聽聽TreeItem item = (TreeItem)e.item;
聽聽聽聽if (item == null) return;
聽聽聽聽if (item.getItemCount() == 1) {
聽聽聽聽聽TreeItem firstItem = item.getItems()[0];
聽聽聽聽聽if (firstItem.getData() != null) return;
聽聽聽聽聽firstItem.dispose();
聽聽聽聽} else {
聽聽聽聽聽return;
聽聽聽聽}
聽聽聽聽File root = (File)item.getData();
聽聽聽聽File[] files = root.listFiles();
聽聽聽聽if (files == null) return;
聽聽聽聽for (int i = 0; i < files.length; i++) {
聽聽聽聽聽File file = files[i];
聽聽聽聽聽if (file.isDirectory()) {
聽聽聽聽聽聽TreeItem treeItem = new TreeItem(item, SWT.NONE);
聽聽聽聽聽聽treeItem.setText(file.getName());
聽聽聽聽聽聽treeItem.setData(file);
聽聽聽聽聽聽new TreeItem(treeItem, SWT.NONE);
聽聽聽聽聽}
聽聽聽聽}
聽聽聽}
聽聽});
聽聽fileTree.addListener(SWT.Selection, new Listener() {
聽聽聽public void handleEvent(Event e) {
聽聽聽聽TreeItem item = (TreeItem)e.item;
聽聽聽聽if (item == null) return;
聽聽聽聽final File root = (File)item.getData();
聽聽聽聽EventQueue.invokeLater(new Runnable() {
聽聽聽聽聽public void run() {
聽聽聽聽聽聽statusLabel.setText(root.getAbsolutePath());
聽聽聽聽聽聽locationText.setText(root.getAbsolutePath());
聽聽聽聽聽聽fileTable.setModel(new FileTableModel(root.listFiles()));
聽聽聽聽聽}
聽聽聽聽});
聽聽聽}
聽聽});
聽聽
聽聽GridLayout layout = new GridLayout(4, false);
聽聽layout.marginWidth = layout.marginHeight = 0;
聽聽layout.horizontalSpacing = layout.verticalSpacing = 1;
聽聽shell.setLayout(layout);
聽聽GridData data;聽聽
聽聽data = new GridData(GridData.FILL_HORIZONTAL);
聽聽data.horizontalSpan = 4;
聽聽separator1.setLayoutData(data);
聽聽data = new GridData();
聽聽data.horizontalSpan = 1;
聽聽data.horizontalIndent = 10;
聽聽locationLb.setLayoutData(data);
聽聽data = new GridData(GridData.FILL_HORIZONTAL);
聽聽data.horizontalSpan = 2;
聽聽data.heightHint = locationText.getPreferredSize().height;
聽聽locationComp.setLayoutData(data);
聽聽data = new GridData(GridData.FILL_HORIZONTAL);
聽聽data.horizontalSpan = 1;
聽聽toolBar.setLayoutData(data);
聽聽data = new GridData(GridData.FILL_HORIZONTAL);
聽聽data.horizontalSpan = 4;
聽聽separator2.setLayoutData(data);
聽聽data = new GridData(GridData.FILL_BOTH);
聽聽data.horizontalSpan = 4;
聽聽comp.setLayoutData(data);
聽聽data = new GridData(GridData.FILL_HORIZONTAL);
聽聽data.horizontalSpan = 4;
聽聽separator3.setLayoutData(data);
聽聽data = new GridData(GridData.FILL_HORIZONTAL);
聽聽data.horizontalSpan = 4;
聽聽data.heightHint = statusLabel.getPreferredSize().height;
聽聽statusComp.setLayoutData(data);
聽聽
聽聽layout = new GridLayout(3, false);
聽聽layout.marginWidth = layout.marginHeight = 0;
聽聽layout.horizontalSpacing = layout.verticalSpacing = 1;
聽聽comp.setLayout(layout);聽聽聽
聽聽data = new GridData(GridData.FILL_VERTICAL);
聽聽data.widthHint = 200;
聽聽fileTree.setLayoutData(data);聽聽
聽聽data = new GridData(GridData.FILL_VERTICAL);
聽聽sash.setLayoutData(data);聽聽
聽聽data = new GridData(GridData.FILL_BOTH);
聽聽tableComp.setLayoutData(data);

聽聽shell.open();
聽聽while(!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch()) display.sleep();
聽聽}
聽聽display.dispose();
聽}



鍝煎摷 2006-11-07 17:09 鍙戣〃璇勮
]]>
SWT 鐩綍瀵硅瘽妗嗭紙DirectoryDialog綾伙級http://www.tkk7.com/hengheng123456789/articles/79615.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 07:13:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79615.htmlhttp://www.tkk7.com/hengheng123456789/comments/79615.htmlhttp://www.tkk7.com/hengheng123456789/articles/79615.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79615.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79615.html
聽public static void main (String [] args) {
聽聽Display display = new Display ();
聽聽Shell shell = new Shell (display);
聽聽shell.open ();
聽聽DirectoryDialog dialog = new DirectoryDialog (shell);
聽聽dialog.setFilterPath ("c:\\"); //Windows specific
聽聽System.out.println ("RESULT=" + dialog.open ());
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}

鍝煎摷 2006-11-07 15:13 鍙戣〃璇勮
]]>
SWT 鏂囦歡瀵硅瘽妗嗭紙F(tuán)ileDialog綾伙級http://www.tkk7.com/hengheng123456789/articles/79614.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 07:11:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79614.htmlhttp://www.tkk7.com/hengheng123456789/comments/79614.htmlhttp://www.tkk7.com/hengheng123456789/articles/79614.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79614.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79614.html聽public static void main (String [] args) {
聽聽Display display = new Display ();
聽聽Shell shell = new Shell (display);
聽聽shell.open ();
聽聽FileDialog dialog = new FileDialog (shell, SWT.SAVE);
聽聽dialog.setFilterNames (new String [] {"Batch Files", "All Files (*.*)"});
聽聽dialog.setFilterExtensions (new String [] {"*.bat", "*.*"}); //Windows wild cards
聽聽dialog.setFilterPath ("c:\\"); //Windows path
聽聽dialog.setFileName ("fred.bat");
聽聽System.out.println ("Save to: " + dialog.open ()); //鎵撳紑瀵硅瘽妗?br />聽聽while (!shell.isDisposed ()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}

鍝煎摷 2006-11-07 15:11 鍙戣〃璇勮
]]>
SWT 緇樺浘錛圙C綾伙級http://www.tkk7.com/hengheng123456789/articles/79610.html鍝煎摷鍝煎摷Tue, 07 Nov 2006 07:05:00 GMThttp://www.tkk7.com/hengheng123456789/articles/79610.htmlhttp://www.tkk7.com/hengheng123456789/comments/79610.htmlhttp://www.tkk7.com/hengheng123456789/articles/79610.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/79610.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/79610.html1銆佺偣鍑婚紶鏍囧乏閿湪shell閲岀敾綰褲?br />
聽public static void main(String[] args)
聽{
聽聽Display display = new Display();
聽聽final Shell shell = new Shell(display);
聽聽Listener listener = new Listener() {
聽聽聽int聽lastX聽= 0, lastY = 0;

聽聽聽public void handleEvent(Event event)
聽聽聽{
聽聽聽聽switch (event.type)
聽聽聽聽{
聽聽聽聽聽case SWT.MouseMove :
聽聽聽聽聽聽if ((event.stateMask & SWT.BUTTON1) == 0)
聽聽聽聽聽聽聽break; // 鍒ゆ柇鏄惁涓洪紶鏍囧乏閿紝濡傛灉涓嶆槸璺沖嚭
聽聽聽聽聽聽GC gc = new GC(shell);
聽聽聽聽聽聽gc.drawLine(lastX, lastY, event.x, event.y);
聽聽聽聽聽聽gc.dispose();
聽聽聽聽聽// FALL THROUGH
聽聽聽聽聽case SWT.MouseDown :
聽聽聽聽聽聽lastX = event.x;
聽聽聽聽聽聽lastY = event.y;
聽聽聽聽聽聽break;
聽聽聽聽}
聽聽聽}
聽聽};
聽聽shell.addListener(SWT.MouseDown, listener);
聽聽shell.addListener(SWT.MouseMove, listener);
聽聽shell.open();
聽聽while (!shell.isDisposed())
聽聽{
聽聽聽if (!display.readAndDispatch())
聽聽聽聽display.sleep();
聽聽}
聽聽display.dispose();
聽}

2銆佸湪寮瑰嚭紿楀彛涓樉紺鴻〃鐨勫綋鏃跺浘鍍忕姸鎬併?br />聽public static void main(String[] args) {
聽聽final Display display = new Display();
聽聽final Shell shell = new Shell(display);
聽聽shell.setText("Widget");
聽聽
聽聽//寤虹珛涓涓畝鍗曠殑琛?br />聽聽final Table table = new Table(shell, SWT.MULTI);
聽聽table.setLinesVisible(true);
聽聽table.setBounds(10, 10, 100, 100);
聽聽for (int i = 0; i < 9; i++) {
聽聽聽new TableItem(table, SWT.NONE).setText("item" + i);
聽聽}
聽聽
聽聽//寤虹珛鎹曟崏鍥懼儚鐨勬寜閽?br />聽聽Button button = new Button(shell, SWT.PUSH);
聽聽button.setText("Capture");
聽聽button.pack();
聽聽button.setLocation(10, 140);
聽聽
聽聽
聽聽button.addListener(SWT.Selection, new Listener() {
聽聽聽public void handleEvent(Event event) {
聽聽聽聽Point tableSize = table.getSize();聽//鑾峰彇琛ㄧ殑澶у皬
聽聽聽聽GC gc = new GC(table);聽//寤虹珛琛ㄧ殑GC瀵硅薄
聽聽聽聽final Image image =
聽聽聽聽聽new Image(display, tableSize.x, tableSize.y);聽//寤虹珛琛ㄥぇ灝忕殑鍥懼儚image
聽聽聽聽gc.copyArea(image, 0, 0);聽//鍒╃敤琛ㄧ殑GC瀵硅薄鎶婅〃鐨勫浘鍍忓鍒跺埌image涓?br />聽聽聽聽gc.dispose();
聽聽聽聽
聽聽聽聽//寤虹珛涓涓脊鍑洪潰鏉縎hell瀵硅薄popup
聽聽聽聽Shell popup = new Shell(shell);
聽聽聽聽popup.setText("Image");
聽聽聽聽popup.addListener(SWT.Close, new Listener() {
聽聽聽聽聽public void handleEvent(Event e) {
聽聽聽聽聽聽image.dispose();
聽聽聽聽聽}
聽聽聽聽});
聽聽聽聽//鍦╬opup涓婂緩绔嬬敾甯冨璞anvas
聽聽聽聽Canvas canvas = new Canvas(popup, SWT.NONE);
聽聽聽聽canvas.setBounds(10, 10, tableSize.x+10, tableSize.y+10);
聽聽聽聽canvas.addPaintListener(new PaintListener() {
聽聽聽聽聽public void paintControl(PaintEvent e) {
聽聽聽聽聽聽e.gc.drawImage(image, 0, 0);聽//鍦ㄧ敾甯冧笂緇樺嚭琛ㄧ殑鍥懼儚image
聽聽聽聽聽}
聽聽聽聽});
聽聽聽聽popup.pack();
聽聽聽聽popup.open();
聽聽聽}
聽聽});
聽聽shell.pack();
聽聽shell.open();
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch()) display.sleep();
聽聽}
聽聽display.dispose();
聽}

3銆佽幏鍙栨暣涓獥鍙g殑鍥懼儚騫舵樉紺恒?br />聽public static void main(String[] args) {
聽聽final Display display = new Display();
聽聽final Shell shell = new Shell(display);
聽聽shell.setLayout(new FillLayout());
聽聽Button button = new Button(shell, SWT.PUSH);
聽聽button.setText("Capture");
聽聽button.addListener(SWT.Selection, new Listener() {
聽聽聽public void handleEvent(Event event) {
聽聽聽聽
聽聽聽聽/* Take the screen shot */
聽聽聽聽GC gc = new GC(display);
聽聽聽聽final Image image = new Image(display, display.getBounds());
聽聽聽聽gc.copyArea(image, 0, 0);
聽聽聽聽gc.dispose();
聽聽聽聽
聽聽聽聽Shell popup = new Shell(shell, SWT.SHELL_TRIM);
聽聽聽聽popup.setLayout(new FillLayout());
聽聽聽聽popup.setText("Image");
聽聽聽聽popup.setBounds(50, 50, 200, 200);
聽聽聽聽popup.addListener(SWT.Close, new Listener() {
聽聽聽聽聽public void handleEvent(Event e) {
聽聽聽聽聽聽image.dispose();
聽聽聽聽聽}
聽聽聽聽});
聽聽聽聽
聽聽聽聽ScrolledComposite sc = new ScrolledComposite (popup, SWT.V_SCROLL | SWT.H_SCROLL);
聽聽聽聽Canvas canvas = new Canvas(sc, SWT.NONE);
聽聽聽聽sc.setContent(canvas);
聽聽聽聽canvas.setBounds(display.getBounds ());
聽聽聽聽canvas.addPaintListener(new PaintListener() {
聽聽聽聽聽public void paintControl(PaintEvent e) {
聽聽聽聽聽聽e.gc.drawImage(image, 0, 0);
聽聽聽聽聽}
聽聽聽聽});
聽聽聽聽popup.open();
聽聽聽}
聽聽});
聽聽shell.pack();
聽聽shell.open();
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch()) display.sleep();
聽聽}
聽聽display.dispose();
聽}

4銆佷嬌鐢╰ransform銆乤lpha鍜宲aths娣峰悎鎶鏈粯鍥俱傛敞鎰忥細(xì)蹇呴』鍦ㄩ」鐩腑import鈥渟wt-gdip-win32-3139.dll鈥濄?br />聽public static void main(String[] args) {
聽聽final Display display = new Display();
聽聽final Shell shell = new Shell(display);
聽聽shell.setText("Advanced Graphics");
聽聽FontData fd = shell.getFont().getFontData()[0];
聽聽final Font font = new Font(display, fd.getName(), 60, SWT.BOLD | SWT.ITALIC);
聽聽final Image image = new Image(display, 640, 480);
聽聽final Rectangle rect = image.getBounds();
聽聽GC gc = new GC(image);
聽聽gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
聽聽gc.fillOval(rect.x, rect.y, rect.width, rect.height);
聽聽gc.dispose();
聽聽shell.addListener(SWT.Paint, new Listener() {
聽聽聽public void handleEvent(Event event) {
聽聽聽聽GC gc = event.gc;聽聽聽聽
聽聽聽聽Transform tr = new Transform(display);
聽聽聽聽tr.translate(50, 120);
聽聽聽聽tr.rotate(-30);
聽聽聽聽gc.drawImage(image, 0, 0, rect.width, rect.height, 0, 0, rect.width / 2, rect.height / 2);
聽聽聽聽gc.setAlpha(100);
聽聽聽聽gc.setTransform(tr);
聽聽聽聽Path path = new Path(display);
聽聽聽聽path.addString("SWT", 0, 0, font);
聽聽聽聽gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
聽聽聽聽gc.setForeground(display.getSystemColor(SWT.COLOR_BLUE));
聽聽聽聽gc.fillPath(path);
聽聽聽聽gc.drawPath(path);
聽聽聽聽tr.dispose();
聽聽聽聽path.dispose();
聽聽聽}聽聽聽
聽聽});
聽聽shell.setSize(shell.computeSize(rect.width / 2, rect.height / 2));
聽聽shell.open();
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch())
聽聽聽聽display.sleep();
聽聽}
聽聽image.dispose();
聽聽font.dispose();
聽聽display.dispose();
聽}

5銆佸鍥懼儚榪涜鏃嬭漿銆?br />聽public static void main(String[] args) {
聽聽final Display display = new Display();
聽聽
聽聽final Image image = new Image(display, 110, 60);
聽聽GC gc = new GC(image);
聽聽Font font = new Font(display, "Times", 30, SWT.BOLD);
聽聽gc.setFont(font);
聽聽gc.setBackground(display.getSystemColor(SWT.COLOR_RED));
聽聽gc.fillRectangle(0, 0, 110, 60);
聽聽gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
聽聽gc.drawText("SWT", 10, 10, true);
聽聽font.dispose();
聽聽gc.dispose();
聽聽
聽聽final Rectangle rect = image.getBounds();
聽聽Shell shell = new Shell(display);
聽聽shell.setText("Matrix Tranformations");
聽聽shell.setLayout(new FillLayout());
聽聽final Canvas canvas = new Canvas(shell, SWT.DOUBLE_BUFFERED);
聽聽canvas.addPaintListener(new PaintListener () {
聽聽聽public void paintControl(PaintEvent e) {聽
聽聽聽聽GC gc = e.gc;
聽聽聽聽gc.setAdvanced(true);
聽聽聽聽if (!gc.getAdvanced()){
聽聽聽聽聽gc.drawText("Advanced graphics not supported", 30, 30, true);
聽聽聽聽聽return;
聽聽聽聽}
聽聽聽聽
聽聽聽聽// Original image
聽聽聽聽int x = 30, y = 30;
聽聽聽聽gc.drawImage(image, x, y);
聽聽聽聽x += rect.width + 30;
聽聽聽聽
聽聽聽聽Transform transform = new Transform(display);
聽聽聽聽
聽聽聽聽// Note that the tranform is applied to the whole GC therefore
聽聽聽聽// the coordinates need to be adjusted too.
聽聽聽聽
聽聽聽聽// Reflect around the y axis.
聽聽聽聽transform.setElements(-1, 0, 0, 1, 0 ,0);
聽聽聽聽gc.setTransform(transform);
聽聽聽聽gc.drawImage(image, -1*x-rect.width, y);
聽聽聽聽
聽聽聽聽x = 30; y += rect.height + 30;
聽聽聽聽
聽聽聽聽// Reflect around the x axis.
聽聽聽聽transform.setElements(1, 0, 0, -1, 0, 0);
聽聽聽聽gc.setTransform(transform);
聽聽聽聽gc.drawImage(image, x, -1*y-rect.height);
聽聽聽聽
聽聽聽聽x += rect.width + 30;
聽聽聽聽
聽聽聽聽// Reflect around the x and y axes聽
聽聽聽聽transform.setElements(-1, 0, 0, -1, 0, 0);
聽聽聽聽gc.setTransform(transform);
聽聽聽聽gc.drawImage(image, -1*x-rect.width, -1*y-rect.height);
聽聽聽聽
聽聽聽聽x = 30; y += rect.height + 30;
聽聽聽聽
聽聽聽聽// Shear in the x-direction
聽聽聽聽transform.setElements(1, 0, -1, 1, 0, 0);
聽聽聽聽gc.setTransform(transform);
聽聽聽聽gc.drawImage(image, 300, y);
聽聽聽聽
聽聽聽聽// Shear in y-direction
聽聽聽聽transform.setElements(1, -1, 0, 1, 0, 0);
聽聽聽聽gc.setTransform(transform);
聽聽聽聽gc.drawImage(image, 150, 475);
聽聽聽聽
聽聽聽聽// Rotate by 45 degrees聽
聽聽聽聽float cos45 = (float)Math.cos(45);
聽聽聽聽float sin45 = (float)Math.sin(45);
聽聽聽聽transform.setElements(cos45, sin45, -sin45, cos45, 0, 0);
聽聽聽聽gc.setTransform(transform);
聽聽聽聽gc.drawImage(image, 350, 100);
聽聽聽聽
聽聽聽聽transform.dispose();
聽聽聽}
聽聽});
聽聽
聽聽shell.setSize(350, 550);
聽聽shell.open();
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch())
聽聽聽聽display.sleep();
聽聽}
聽聽image.dispose();
聽聽display.dispose();
聽}



鍝煎摷 2006-11-07 15:05 鍙戣〃璇勮
]]>
SWT 鏍?wèi)锛圱ree綾伙級http://www.tkk7.com/hengheng123456789/articles/78734.html鍝煎摷鍝煎摷Thu, 02 Nov 2006 09:31:00 GMThttp://www.tkk7.com/hengheng123456789/articles/78734.htmlhttp://www.tkk7.com/hengheng123456789/comments/78734.htmlhttp://www.tkk7.com/hengheng123456789/articles/78734.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/78734.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/78734.html
1銆佺畝鍗曟爲(wèi)
聽public static void main (String [] args) {
聽聽Display display = new Display ();
聽聽Shell shell = new Shell (display);
聽聽shell.setLayout(new FillLayout());
聽聽
聽聽final Tree tree = new Tree (shell, SWT.BORDER);
聽聽
聽聽for (int i=0; i<4; i++) {
聽聽聽TreeItem iItem = new TreeItem (tree, 0);
聽聽聽iItem.setText ("TreeItem (0) -" + i);
聽聽聽for (int j=0; j<4; j++) {
聽聽聽聽TreeItem jItem = new TreeItem (iItem, 0);
聽聽聽聽jItem.setText ("TreeItem (1) -" + j);
聽聽聽聽for (int k=0; k<4; k++) {
聽聽聽聽聽TreeItem kItem = new TreeItem (jItem, 0);
聽聽聽聽聽kItem.setText ("TreeItem (2) -" + k);
聽聽聽聽聽for (int l=0; l<4; l++) {
聽聽聽聽聽聽TreeItem lItem = new TreeItem (kItem, 0);
聽聽聽聽聽聽lItem.setText ("TreeItem (3) -" + l);
聽聽聽聽聽}
聽聽聽聽}
聽聽聽}
聽聽}
聽聽shell.setSize (200, 200);
聽聽shell.open ();
聽聽while (!shell.isDisposed()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}

2銆佺被浼艱祫婧愮鐞嗗櫒鐨勬爲(wèi)錛屽叾涓寘鍚紶鏍囧弻鍑諱簨浠?br />聽public static void main (String [] args) {
聽聽final Display display = new Display ();
聽聽final Shell shell = new Shell (display);
聽聽shell.setText ("Lazy Tree");
聽聽shell.setLayout (new FillLayout ());
聽聽
聽聽final Tree tree = new Tree (shell, SWT.BORDER);
聽聽File [] roots = File.listRoots ();
聽聽for (int i=0; i<roots.length; i++) {
聽聽聽TreeItem root = new TreeItem (tree, 0);
聽聽聽root.setText (roots [i].toString ());
聽聽聽root.setData (roots [i]);//淇濆瓨褰撳墠鑺傜偣鏁版嵁
聽聽聽new TreeItem (root, 0);//鎶婂綋鍓嶈妭鐐逛綔涓虹洰褰曡妭鐐?br />聽聽}
聽聽
聽聽tree.addListener (SWT.Expand, new Listener () {
聽聽聽public void handleEvent (final Event event) {
聽聽聽聽final TreeItem root = (TreeItem) event.item;
聽聽聽聽TreeItem [] items = root.getItems ();
聽聽聽聽for (int i= 0; i<items.length; i++) {
聽聽聽聽聽if (items [i].getData () != null) return;
聽聽聽聽聽items [i].dispose ();
聽聽聽聽}
聽聽聽聽File file = (File) root.getData ();
聽聽聽聽File [] files = file.listFiles ();
聽聽聽聽if (files == null) return;
聽聽聽聽for (int i= 0; i<files.length; i++) {
聽聽聽聽聽TreeItem item = new TreeItem (root, 0);
聽聽聽聽聽item.setText (files [i].getName ());
聽聽聽聽聽item.setData (files [i]);
聽聽聽聽聽if (files [i].isDirectory()) {
聽聽聽聽聽聽new TreeItem (item, 0);
聽聽聽聽聽}
聽聽聽聽}
聽聽聽}
聽聽});
聽聽聽聽tree.addListener (SWT.MouseDoubleClick, new Listener () {
聽聽聽public void handleEvent (Event event) {
聽聽聽聽Point point = new Point (event.x, event.y);
聽聽聽聽TreeItem item = tree.getItem (point);
聽聽聽聽if (item != null) {
聽聽聽聽聽System.out.println ("Mouse down: " + item);
聽聽聽聽}
聽聽聽}
聽聽});
聽聽//鏍規(guī)嵁Tree鐨勫ぇ灝忔洿鏀箂hell鐨勫ぇ灝?br />聽聽Point size = tree.computeSize (300, SWT.DEFAULT);
聽聽int width = Math.max (300, size.x);
聽聽int height = Math.max (300, size.y);
聽聽shell.setSize (shell.computeSize (width, height));
聽聽shell.open ();
聽聽while (!shell.isDisposed ()) {
聽聽聽if (!display.readAndDispatch ()) display.sleep ();
聽聽}
聽聽display.dispose ();
聽}


鍝煎摷 2006-11-02 17:31 鍙戣〃璇勮
]]>
SWT 鍒嗗壊紿楋紙SashForm綾伙級http://www.tkk7.com/hengheng123456789/articles/78709.html鍝煎摷鍝煎摷Thu, 02 Nov 2006 07:47:00 GMThttp://www.tkk7.com/hengheng123456789/articles/78709.htmlhttp://www.tkk7.com/hengheng123456789/comments/78709.htmlhttp://www.tkk7.com/hengheng123456789/articles/78709.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/78709.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/78709.html
/*
*聽SashForm聽example聽snippet:聽create聽a聽sash聽form聽with聽three聽children
*
*聽For聽a聽list聽of聽all聽SWT聽example聽snippets聽see
*聽http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-swt-home/dev.html#snippets
*/
import聽org.eclipse.swt.SWT;
import聽org.eclipse.swt.custom.SashForm;
import聽org.eclipse.swt.layout.FillLayout;
import聽org.eclipse.swt.widgets.Button;
import聽org.eclipse.swt.widgets.Composite;
import聽org.eclipse.swt.widgets.Display;
import聽org.eclipse.swt.widgets.Label;
import聽org.eclipse.swt.widgets.Shell;

public聽class聽Snippet109聽{

聽聽public聽static聽void聽main(String[]聽args)聽{
聽聽聽聽final聽Display聽display聽=聽new聽Display();
聽聽聽聽Shell聽shell聽=聽new聽Shell(display);
聽聽聽聽shell.setLayout(new聽FillLayout());

聽聽聽聽SashForm聽form聽=聽new聽SashForm(shell,聽SWT.HORIZONTAL);
聽聽聽聽form.setLayout(new聽FillLayout());

聽聽聽聽Composite聽child1聽=聽new聽Composite(form,聽SWT.NONE);
聽聽聽聽child1.setLayout(new聽FillLayout());
聽聽聽聽new聽Label(child1,聽SWT.NONE).setText("Label聽in聽pane聽1");

聽聽聽聽Composite聽child2聽=聽new聽Composite(form,聽SWT.NONE);
聽聽聽聽child2.setLayout(new聽FillLayout());
聽聽聽聽new聽Button(child2,聽SWT.PUSH).setText("Button聽in聽pane2");

聽聽聽聽Composite聽child3聽=聽new聽Composite(form,聽SWT.NONE);
聽聽聽聽child3.setLayout(new聽FillLayout());
聽聽聽聽new聽Label(child3,聽SWT.PUSH).setText("Label聽in聽pane3");

聽聽聽聽form.setWeights(new聽int[]聽{聽30,聽40,聽30聽});
聽聽聽聽shell.open();
聽聽聽聽while聽(!shell.isDisposed())聽{
聽聽聽聽聽聽if聽(!display.readAndDispatch())
聽聽聽聽聽聽聽聽display.sleep();
聽聽聽聽}
聽聽聽聽display.dispose();
聽聽}
}



鍝煎摷 2006-11-02 15:47 鍙戣〃璇勮
]]>
SWT鍏ラ棬錛?錛?/title><link>http://www.tkk7.com/hengheng123456789/articles/78223.html</link><dc:creator>鍝煎摷</dc:creator><author>鍝煎摷</author><pubDate>Tue, 31 Oct 2006 02:36:00 GMT</pubDate><guid>http://www.tkk7.com/hengheng123456789/articles/78223.html</guid><wfw:comment>http://www.tkk7.com/hengheng123456789/comments/78223.html</wfw:comment><comments>http://www.tkk7.com/hengheng123456789/articles/78223.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.tkk7.com/hengheng123456789/comments/commentRss/78223.html</wfw:commentRss><trackback:ping>http://www.tkk7.com/hengheng123456789/services/trackbacks/78223.html</trackback:ping><description><![CDATA[     鎽樿: 涔﹀啓 swt 紼嬪簭鐨勫熀鏈楠ゅ涓嬶細(xì)1.聽聽聽聽聽 鍒涘緩涓涓狣isplay瀵硅薄銆?.聽聽聽聽聽 鍒涘緩涓涓垨鑰呭涓猄hell瀵硅薄錛屼綘鍙互璁や負(fù)Shell浠h〃浜嗙▼搴忕殑紿楀彛銆?.聽聽聽聽聽 鍦⊿hell鍐呭垱寤哄悇縐嶉儴浠訛紙widget錛夈?.聽聽聽聽聽 瀵瑰悇涓儴浠惰繘琛屽垵濮嬪寲錛堝瑙傦紝鐘舵佺瓑錛夛紝鍚屾椂涓哄悇縐嶉儴浠剁殑浜嬩歡鍒涘緩鐩戝惉鍣紙listener錛夈?.聽聽聽聽聽 璋冪敤Shell瀵硅薄鐨刼pen()鏂?..  <a href='http://www.tkk7.com/hengheng123456789/articles/78223.html'>闃呰鍏ㄦ枃</a><img src ="http://www.tkk7.com/hengheng123456789/aggbug/78223.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.tkk7.com/hengheng123456789/" target="_blank">鍝煎摷</a> 2006-10-31 10:36 <a href="http://www.tkk7.com/hengheng123456789/articles/78223.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>SWT姒傝堪http://www.tkk7.com/hengheng123456789/articles/78124.html鍝煎摷鍝煎摷Mon, 30 Oct 2006 10:18:00 GMThttp://www.tkk7.com/hengheng123456789/articles/78124.htmlhttp://www.tkk7.com/hengheng123456789/comments/78124.htmlhttp://www.tkk7.com/hengheng123456789/articles/78124.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/78124.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/78124.html聽聽聽聽聽聽SWT/JFace 璞′竴鑲℃竻鏂扮殑椋庡惞鍏ヤ簡 Java 鐨?/span> GUI 寮鍙戦鍩燂紝涓鴻繖涓矇闂風(fēng)殑棰嗗煙甯︽潵浜嗗媰鍕冪敓鏈恒傝櫧鐒?/span> SUN 涓嶆帴綰?/span> SWT/JFace 浣滀負(fù) Java 涓殑涓縐嶅浘褰?/span> API 鏍囧噯錛屼絾瀹冭櫧鐒跺熺潃 Eclipse 鐨勪紭寮傝〃鐜幫紝浠ヤ笉鍙樆鎸′箣鍔垮悜鍓嶅彂灞曠潃銆傜粓浜庡彲浠ョ敤 SWT 杞繪澗鐨勫紑鍙戝嚭楂樻晥鐜囩殑 GUI 紼嬪簭錛屼笖鎷ユ湁鏍囧噯鐨?/span> Windows 澶栬錛?/span> Eclipse 杞歡灝辨槸鍩轟簬 SWT/JFace 鏋勫緩鐨勶紝澶у鐪嬬湅 Eclipse3.0 灝辯煡閬?/span> SWT 鏈夊涔堢殑媯掋?br />
聽聽聽涓轟簡鏂逛究寮鍙?span lang="EN-US">SWT
紼嬪簭錛屽湪SWT鍩虹涓婂張鍒涘緩浜嗕竴涓洿鏄撶敤銆佸姛鑳藉己澶х殑鍥懼艦鍖呪?/span>JFace鈥濄傜劧鑰岋紝JFace騫朵笉鑳藉畬鍏ㄨ鐩?/span>SWT鐨勬墍鏈夊姛鑳斤紝鎵浠ョ紪紼嬫椂SWT銆?/span>JFace閮戒細(xì)瑕佺敤鍒幫紝浣嗘槸涓鑸潵璇達(dá)紝鑳界敤JFace鐨勭粍浠跺氨鏈濂戒笉瑕佺敤SWT鐨?/font>銆?br />
SWT涓殑鍖?/span>

SWT鏄?/span>Eclipse鍥懼艦API鐨勫熀紜錛屾湰鑺傚皢綆鍗曚粙緇嶄竴涓?/span>SWT涓墍鍖呭惈鐨勫瓙鍖呫?/span>

1銆?/span>org.eclipse.swt.widgets

鏈甯哥敤鐨勭粍浠跺熀鏈兘鍦ㄦ鍖呬腑錛屽Button銆?/span>Text銆?/span>Label銆?/span>Combo絳夈傚叾涓袱涓渶閲嶈鐨勭粍浠跺綋鏁?/span>Shell鍜?/span>Composite錛?/span>Shell鐩稿綋浜庡簲鐢ㄧ▼搴忕殑涓葷獥鍙o紱Composite鐩稿綋浜?/span>SWING涓殑Panel瀵硅薄錛屾槸瀹圭撼緇勪歡鐨勫鍣ㄣ?/span>

2銆?/span>org.eclipse.swt.layout

涓昏鐨勭晫闈㈠竷灞鏂瑰紡鍦ㄦ鍖呬腑銆?/span>SWT瀵圭粍浠剁殑甯冨眬涔熼噰鐢ㄤ簡AWT/SWING涓殑Layout鍜?/span>Layout Data緇撳悎鐨勬柟寮忋?/span>

3銆?/span>org.eclipse.swt.custom

瀵逛竴浜涘熀鏈浘褰㈢粍浠剁殑鎵╁睍鍦ㄦ鍖呬腑錛屾瘮濡傚叾涓殑CLabel灝辨槸瀵規(guī)爣鍑?/span>Label緇勪歡鐨勬墿灞曪紝鍦?/span>CLabel涓婂彲浠ュ悓鏃跺姞鍏ユ枃瀛楀拰鍥劇墖銆傚湪姝ゅ寘涓繕鏈変竴涓柊鐨勫竷灞鏂瑰紡StackLayout銆?/span>

4銆?/span>org.eclipse.swt.event

SWT閲囩敤浜嗗拰AWT/SWING涓鏍風(fēng)殑浜嬩歡妯″瀷錛屽湪鍖呬腑鍙互鎵懼埌浜嬩歡鐩戝惉綾誨拰鐩稿簲鐨勪簨浠跺璞°傛瘮濡傦紝榧犳爣浜嬩歡鐩戝惉鍣?/font>MouseListener錛?/span>MouseMoveListener絳夛紝鍙?qiáng)瀵瑰簲鐨勪簨錃g瀵硅薄MouseEvent銆?/span>

5銆?/span>org.eclipse.swt.graphics

姝ゅ寘涓寘鍚拡瀵瑰浘鐗囥佸厜鏍囥佸瓧浣撴垨緇樺浘API銆傛瘮濡傦紝鍙氳繃Image綾昏皟鐢ㄧ郴緇熶腑涓嶅悓綾誨瀷鐨勫浘鐗囨枃浠躲?/span>

6銆?/span>org.eclipse.swt.ole.win32

瀵逛笉鍚屽鉤鍙幫紝SWT鏈変竴浜涢拡瀵規(guī)х殑API銆備緥濡傦紝鍦?/span>Windows騫沖彴錛屽彲浠ラ氳繃姝ゅ寘寰堝鏄撶殑璋冪敤OLE緇勪歡錛岃繖浣垮緱SWT紼嬪簭涔熷彲浠ュ唴宓?/span>IE嫻忚鍣ㄦ垨Word銆?/span>Excel絳夌▼搴忋?/span>

姝ゅ榪樻湁org.eclipse.swt.dnd銆?/span>org.eclipse.swt.printing銆?/span>org.eclipse.swt.program銆?/span>org.eclipse.swt.accessibility銆?/span>org.eclipse.swt.browser銆?/span>org.eclipse.swt.awt絳夊寘錛屽湪姝や笉涓涓浠嬬粛浜嗐傝繖浜涘寘涓鑸緢灝戠敤鍒幫紝鍙渶瑕佺◢寰簡瑙d竴涓嬪氨琛屼簡錛屼笉蹇呮繁絀躲?br />
鐢?/strong>SWT Designer

聽聽聽SWT Designer鏄紭縐鐨?/span>SWT/JFace寮鍙戣緟鍔╁伐鍏?br />http://downloads.instantiations.com/Designer/release/v5.1.0_20060908125203/Designer_v5.1.0_win32_x86.exe
http://www.codefocus.cn/code/JAVA/SWT_Designer5.rar
codefocus.cn瑙e帇

聽聽聽SWT Designer榪樻棤娉曞畬鎴愭墍鏈夌殑鐣岄潰璁捐宸ヤ綔錛屾墍浠ュ湪鐣岄潰寮鍙戜腑渚濈劧鏄互鎵嬪伐鍐欎唬鐮佷負(fù)涓伙紝鑰屼笖鎵嬪啓浠g爜鏌愪簺鏃跺欐瘮鐣岄潰鎷栨媺鎿嶄綔鏇村揩鎹楓備互涓嬫槸絎旇呭湪浣跨敤SWT Designer寮鍙戠晫闈㈡椂鐨勫熀鏈祦紼嬶細(xì)

l聽聽聽聽聽聽聽聽聽聽 鏂板紑涓涓復(fù)鏃剁殑Application鏂囦歡錛岀敤SWT Desiger蹇熷仛濂藉紑鍙戞墍闇瑕佺殑閮ㄤ喚鐣岄潰銆?/span>

l聽聽聽聽聽聽聽聽聽聽 灝嗚嚜鍔ㄧ敓鎴愮殑浠g爜縐繪鍒版寮忛」鐩腑錛岃繘琛屾墜宸ヤ慨鏀瑰拰浠g爜綺劇畝銆?/span>

鍙﹀錛岀敱浜?/span>SWT Designer涓嶆槸寰堢ǔ瀹氾紝鎵浠ュ湪浣跨敤鏃惰繕搴旀敞鎰忥細(xì)

l聽聽聽聽聽聽聽聽聽聽 涓嶈鍦ㄧ晫闈腑鍔犲叆澶緇勪歡銆?/span>

l聽聽聽聽聽聽聽聽聽聽 涓嶈棰戠箒鐨勭Щ鍔ㄧ粍浠訛紝鎴栬呭垹闄ゅ張娣誨姞緇勪歡錛屽惁鍒欏緢鍙兘鍥犱負(fù)鍐呭瓨鑰楀敖鑰屾鏈恒?/span>



鍝煎摷 2006-10-30 18:18 鍙戣〃璇勮
]]>
SWT鐨勬潵婧愶紙杞級http://www.tkk7.com/hengheng123456789/articles/78098.html鍝煎摷鍝煎摷Mon, 30 Oct 2006 09:25:00 GMThttp://www.tkk7.com/hengheng123456789/articles/78098.htmlhttp://www.tkk7.com/hengheng123456789/comments/78098.htmlhttp://www.tkk7.com/hengheng123456789/articles/78098.html#Feedback0http://www.tkk7.com/hengheng123456789/comments/commentRss/78098.htmlhttp://www.tkk7.com/hengheng123456789/services/trackbacks/78098.html
聽聽聽聽聽聽聽 Amy鏉ヨ嚜涓瀹禨malltalk鍏徃錛屽彨鍋歄bjectshare錛屽湪閭i噷濂硅礋璐f悶UI綾誨簱銆傝窡Java鐩告瘮Smalltalk鐨勫巻鍙叉湁浜涙?zhèn)叉儴锛屾洃謬犱綍鏃舵?瀹跺簽澶х殑Smalltalk鍏徃鈥斺擨BM銆丳arc-Place鍜孌igitalk銆傚湪90騫翠唬鍒濇湡3瀹跺叕鍙哥殑甯傚満浠介澶ц嚧鐩哥瓑錛岀敓媧繪槸緹庡ソ鐨勩侾arc-Place閲囩敤浠跨獥鍙i儴浠訛紙emulated widgets錛夌殑璁捐錛堝嵆Swing鐨勮璁★級錛孖BM鍜孌igitalk鍒欓噰鐢ㄥ師鐢熺獥鍙i儴浠訛紙native widgets錛夈傚悗鏉BM鍘嬪掍簡鍙﹀涓ゅ錛屽洜姝や粬浠墦綆楀悎騫舵垚涓瀹訛紝鍋囪鍙仛Parc-Place Digitalk銆傞殢鍚庡綋浠栦滑璇曞浘灝嗕粬浠殑浜у搧铻嶅悎鍒頒竴涓彨鍋欽igsaw鐨勮鍒掍腑鏃剁垎鍙戜簡涓鍦哄ぇ鎴橈紝璁″垝鐢變簬鏀挎不鍘熷洜澶辮觸浜嗭紙寮鍙戜漢鍛樺疄闄呬笂宸茬粡鑳借瀹冭繍杞搗鏉ワ級錛屽氨鍥犱負(fù)鍘熺敓鍜屼豢閫犱袱媧劇殑姝繪垬銆侫my璧㈠緱浜嗙簿紲炰笂鐨勮儨鍒╋紝涓嶈繃鍦↖BM鎴戜滑璧㈠緱浜嗕粬浠墍鏈夌殑鐢熸剰錛屽洜涓鴻繖涓ゅ鍏徃鍦ㄤ竴鏁村勾閲岄櫎浜嗗惖鏋朵粈涔堥兘娌″仛銆傚綋灝樺焹钀藉畾涔嬪悗PPD錛圥arc-Place Digitalk褰撴椂宸叉敼鍚嶄負(fù)Objectshare錛岃窡Windscale鏀瑰悕涓篠ellafield鐨勫師鍥犵浉鍚屸斺旇浜轟滑娣″繕涔嬪墠鍙戠敓鐨勭伨闅撅級鐨勮偂紲ㄤ環(huán)鏍間粠60緹庡厓鎺夊埌浜嗕綆浜?緹庡厓1鑲°備粬浠洜涓轟吉鎶ユ敹鍏ヨNASDAQ鎽樼墝錛屼粠姝ゆ秷澶便傛鏃禨UN姝h蛋涓婁笌PPD綾諱技鐨勬妧鏈柟鍚戯紝浜庢槸PDD鐨勬妧鏈漢鍛橀兘鎶婁粬浠殑綆鍘嗘姇鍒頒簡SUN銆侫my琚泧浣d簡錛屽ス鎵胯閫氳繃杞婚噺綰ф柟妗堣В鍐蟲墍鏈夌獥鍙g粍浠剁殑闂錛屽洜姝よ鏈峉UN綆$悊灞傝濂瑰綋浜咷UI寮鍙戦儴闂ㄧ殑澶村ご銆傚ス鏄嬁鐫鈥滆繖閲屽師鏉ョ殑浜洪兘鎼炵牳浜嗭紝鎴戞槸鏉ヨВ鍐崇殑鈥濈殑閽ュ寵榪涙潵鐨勩傞殢鍚嶢my闆囦劍浜嗘墍鏈夊ス榪囧幓鍦≒arc-Place鐨勬棫鏈嬪弸錛岃浠栦滑鏉ュ紑鍙慡wing銆?br />
聽聽聽聽聽聽聽 鏄劇劧Swing搴旇鍋氱殑鏄粎浠呮垚涓轟竴涓粯鍒舵鏋訛紝緇欓偅浜涘笇鏈涘垱寤哄湴鍥捐蔣浠舵垨鑰呯粯鍥捐蔣浠剁殑浜轟滑浣跨敤錛屾棤璁哄浣曪紝搴旇鍥寸粫AWT綾誨簱鏉ュ緩閫犲畠錛屾寜閽箣綾葷殑涓滆タ浠嶇劧浜ょ粰AWT鏉ョ銆係UN鐨勪漢姣斿Philip鍜孧ark宸茬粡璁〢WT鑳藉澶勭悊琛ㄦ牸銆佹爲(wèi)鍜岃浜嬫湰錛坣otebook錛岋紵錛夛紝鎵浠wing鐨勬柟鍚戝簲璇ヨ寰堟槑鏄句簡銆備絾閭d簺姣佷簡PDD鐨勪漢涓嶅共錛屼粬浠潪瑕佹妸涓鍒囬兘寮勬垚杞婚噺綰х殑銆傜敱浜嶴UN綆$悊灞傜殑鏃犵煡錛屽啀鍔犱笂Amy鏃犳儏鐨勬斂娌繪墜孌碉紝閫犳垚浜嗘垜浠粖澶╂墍瑙佺殑娣蜂貢灞闈€侫my榪樹嬌SUN鐩鎬俊Swing鏄綔涓篗ozilla欏圭洰鐨勪竴閮ㄥ垎涓嶯etscape鑱斿悎寮鍙戠殑錛屼簨瀹炰笂榪欏彧鏄ス鐨勫浼犱紟淇┿?br />
聽聽聽聽聽聽聽 鍦↖BM錛屾垜浠粠絎竴澶╄搗灝辨啂鎭禨wing銆傚簽澶с佹弧鏄敊璇紝鑰屼笖闅劇湅鑷蟲瀬銆傚師鍏堟垜浠殑宸ュ叿濡俈isualAge for Java閮芥槸鐢⊿malltalk錛堢敤鐨勬槸鍘熺敓紿楀彛緇勪歡錛夊啓鐨勶紝鎵浠ュ綋鎴戜滑灝嗚繖浜涘伐鍏峰悜Java浠g爜搴撹縼縐繪椂錛屾垜浠渶瑕佷竴濂楃獥鍙g粍浠躲侷BM榪欒竟鐨勫紑鍙戜漢鍛橀兘鏄師鏉ユ悶Smalltalk鐨勯偅涓鎵逛漢錛屾垜浠綆$悊灞傝姹傜敤Swing鏉ユ瀯寤篧ebSphere Studio宸ュ叿閮介潪甯鎬笉鎯呮効銆係wing鏄釜鍙曠殑鍏呮弧緙洪櫡鐨勬吔銆傚湪WebSphere Studio鏈鍒濈殑棰勮涓紝褰撲笌Microsoft Visual Studio浣滃姣旀紨紺虹殑鏃跺欙紝鎴戜滑鎵鏈夌殑瀹㈡埛閮借鍘屽畠錛屽氨鍥犱負(fù)瀹冪殑澶栬錛岃屼笉綆″畠鐨勫姛鑳芥湁澶氬己銆傚ぇ澶氭暟娑堣垂鑰呴兘涓嶄細(xì)涔頒竴杈嗚浜鴻寰楅毦鐪嬬殑杞︼紝鍝曡繖杞︽湁涓鍙板嚭鑹茬殑寮曟搸銆傚洜姝ゆ垜浠紑濮嬩簡涓涓」鐩紝鏄妸鎴戜滑鐨凷malltalk鍘熺敓紿楀彛緇勪歡縐繪鍒癑ava涓婂幓銆傝繖涓」鐩槸鍔犳嬁澶х殑Object Technology International灝忕粍鍋氱殑銆傝繖涓」鐩幏寰椾簡鎴愬姛錛岃榪愮敤鍦ㄥ湪鎴戜滑鍙戝竷鐨刅isualAge Micro Edition浜у搧涓紝VisualAge Micro Edition鍚庢潵鎴愪負(fù)J2ME寮鍙戞柟闈竴涓潪甯告垚鍔熺殑IDE銆備絾鏄疧TI鐨勪漢鍙戠幇錛孲wing鍦ㄨ鍙朩indows浜嬩歡鏂歸潰鏈夋瀬涓ラ噸鐨勭己闄鳳紝鎴戜滑鐢氳嚦鏃犳硶榪涜SWT錛圫寮濮嬫槸Simple鐨勭緝鍐欙紝涓嶈繃鍚庢潵鍙樻垚浜哠tandard鐨勭緝鍐欙級鍜孲wing闂寸殑浜掓搷浣溿備粬浠湪璇諱簨浠墮槦鍒楃殑鏃跺欑敤浜嗕竴縐嶅彲鑳界暀涓嬪唴瀛樻紡媧炵殑鏂瑰紡錛屾墍浠ユ垜浠笉寰椾笉閲囩敤鎴戜滑鑷繁鐨勬煡璇indows浜嬩歡闃熷垪鐨勫驚鐜紝浠ョ籂姝h繖涓敊璇傛垜浠瘯浜嗕竴嬈″張涓嬈¤SUN淇榪欎釜閿欒錛屼絾Amy灝辨槸鍚笉榪涘幓錛屾墍浠ユ垜浠墠鍐沖畾SWT鍜孉WT/Swing涓嶈兘鍏卞瓨銆傛垜浠敋鑷沖湪SWT涓畾涔変簡鑷繁鐨凱oint鍜孯ectangle綾燴斺旀暣涓伐鍏峰寘瀵笰WT鎴朣wing閮芥病鏈変換浣曚緷璧栥傛垜浠妸榪欎釜宸ュ叿鍖呮斁鍒頒簡Eclipse涓紝榪欐槸涓涓伐鍏峰鉤鍙幫紝瀹冪殑鎬諱綋璁捐鐩爣灝辨槸瑕佹垬鑳淢icrsoft鍜孷isual Studio銆侲clipse鏄紑婧愮殑錛屾墍浠ヤ換浣曚漢閮藉彲浠ュ湪涓婇潰鏋勫緩鑷繁鐨勪笢瑗匡紝鎴戜滑宸茬粡鏈夊儚TogetherSoft鍜孯ational榪欐牱鐨勫叕鍙哥Щ妞嶅埌浜嗕笂闈€傛垜浠殑绔炰簤鑰呮槸Microsoft錛屾墍浠ユ垜浠墍鏈夊姫鍔涘拰娉ㄦ剰鍔涢兘鏄粠姝i潰閽堝Microsoft銆?br />
聽聽聽聽聽聽聽 涓嶇鎬庝箞璇碨UN瀵規(guī)闈炲父涓嶆弧銆備粬浠殑Netbeans璺烢clipse鍋氱殑鏄浉鍚岀殑浜嬶紝鍥犳浠栦滑鍚慖BM楂樺眰鎶辨ㄣ備粬浠涓篠WT鏄灝嗕綘緇戝埌Windows涓婏紝榪欑函綺規(guī)槸鑳¤錛屽洜涓篠WT鑳介氳繃GTK鍦∕ac/Linux涓婅繍琛岋紝浠ュ強(qiáng)涓澶у爢宓屽叆寮忓鉤鍙般備粬浠嫆緇濊Eclipse鑾峰緱Java璁よ瘉錛屽洜涓洪噷闈㈡湁鍘熺敓浠g爜錛屾墍浠clipse浜у搧蹇呴』寰堝皬蹇冨湴浣跨敤鍗曡瘝鈥淛ava鈥濊繖涓猄UN鐨勫晢鏍囥侲clipse鐢氳嚦涓嶈兘鎶婅嚜宸辯О涓轟竴涓狫ava IDE錛孲UN宸茬粡濞佽儊榪囪閲囧彇娉曞緥琛屽姩鏉ュ埗姝BM鍦ㄤ換浣曟椂鍊欐妸Eclipse縐頒綔涓涓狫ava IDE銆傜粨鏋滀箣涓灝辨槸IBM鍦‥clipse涓婂垱寤虹殑GUI璁捐宸ュ叿錛屽厑璁鎬綘鏋勫緩Swing/AWT GUI錛屽嵈涓嶈浣犲線閲岄潰鎷栨斁SWT紿楀彛鎺т歡銆?br />
聽聽聽聽聽聽聽 灝哠WT浠嶦clipse涓垎紱誨嚭鏉ユ槸瀹屽叏鍙兘鐨勶紝鍙渶瑕佹妸DLL鎶犲嚭鏉ユ斁鍒拌礬寰勪腑錛屽茍浣跨敤紿楀彛緇勪歡宸ュ叿鍖呮潵緇欎綘鐨勯摱琛屾垨鑰呬繚闄╂垨鑰呭叾浠栦粈涔堝簲鐢ㄧ▼搴忓紑鍙慓UI銆傚啀嬈¤鏄庯紝鎴戜滑鏃犳硶鏇磋繘涓姝ワ紝鍥犱負(fù)SUN鎶婃垜浠殑鍙屾墜緇戜笂浜嗐傝櫧鐒朵綔涓篍clipse寮鏀炬簮鐮佸崗璁殑涓閮ㄥ垎錛孋PL鍏佽鎴戜滑鎻愪緵榪欐牱鐨勮В鍐蟲柟妗堬紝浣哠UN宸茬粡寰堟竻妤氬湴琛ㄦ槑浠栦滑涓嶅笇鏈涙垜浠繖鏍峰仛銆?br />
聽聽聽聽聽聽聽 瀵逛簬鐢ㄦ埛紺懼尯鏉ヨ錛屾棤璁篒BM鍜孲UN鐨勬渶緇堝姩鏈烘槸浠涔堬紝鎴戝彂鐜版湁涓鐐規(guī)繪槸寰堟湁瓚o細(xì)鍠滅埍Swing鐨勪漢鎬諱細(xì)璇粹滀竴鏃︿綘鑺變笂鍑犲勾鏃墮棿鍘繪帉鎻″畠錛屼綘灝辮兘姝g‘鍦頒嬌鐢ㄥ畠鈥濓紝榪欏熀鏈笂鏄粬浠湪璇曞浘璇佹槑鍜岀淮鎶や粬浠緵鑻﹀緱鏉ョ殑鐢ㄩ旀湁闄愮殑涓撻棬鎶鏈紱鑰孲WT鐨勬嫢鎶よ呬滑璇寸殑鏄滃搰錛岃繖鐪熷揩錛岃繖璺熷師鐢熺殑涓鏍鳳紝榪樺彲浠ョ敤XP鐨偆鈥︹﹀畠榪樺張杞誨張灝忊濄傛湁涓鍙ヨ瘽鏄垜鍠滄鐨勶紝鎴戜滑鐨勪竴涓敤鎴瘋錛孲wing灝卞儚Java鍐沖畾涓嶉氳繃鎿嶄綔緋葷粺鏉ュ疄鐜板師鐢熺殑IO錛岃屾槸閫氳繃紓佸ご椹揪API鑷繁鏉ヨ紓佺洏鐨勬墖鍖恒係wing鍩烘湰涓婂氨鏄繖鏍風(fēng)殑錛屽畠鎷跨潃涓簳灞傜殑鈥減aint(Graphics)鈥濇柟娉曪紝鑷繁鏉ョ粯鍒舵墍鏈夌殑紿楀彛緇勪歡銆?img src ="http://www.tkk7.com/hengheng123456789/aggbug/78098.html" width = "1" height = "1" />

鍝煎摷 2006-10-30 17:25 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲区小说区图片区| 4hu四虎免费影院www| 亚洲成A人片在线观看WWW| 国产无遮挡色视频免费视频| 18成禁人视频免费网站| 中文字幕无码日韩专区免费| 窝窝影视午夜看片免费| 亚洲欧美一区二区三区日产| 亚洲国产日韩在线成人蜜芽 | 亚洲中文字幕无码爆乳app| 亚洲综合无码一区二区| 久久精品国产亚洲网站| 中文字幕专区在线亚洲| 亚洲av无码不卡私人影院| 亚洲系列中文字幕| 亚洲成a人片在线观看无码专区| 亚洲精品一级无码中文字幕| 免费h黄肉动漫在线观看| 国产一区视频在线免费观看| 国产成人3p视频免费观看| 日韩免费一级毛片| 日本牲交大片免费观看| 在线观着免费观看国产黄| 免费观看的毛片手机视频| 在线免费观看一级毛片| 四虎影视大全免费入口| 精品久久免费视频| 国产精品免费播放| 四虎亚洲国产成人久久精品| 国产99视频免费精品是看6| 免费观看亚洲人成网站| 免费一级毛片正在播放| 亚洲国产精品成人一区| AV在线播放日韩亚洲欧| 亚洲人成人网站色www| 亚洲AV一宅男色影视| 亚洲综合日韩中文字幕v在线| 亚洲欧洲精品一区二区三区| 亚洲国产精品综合一区在线| 99热亚洲色精品国产88| 亚洲精品精华液一区二区|