锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲AV无码一区二区三区电影,亚洲高清在线视频,国产亚洲精久久久久久无码http://m.tkk7.com/joeyjong/Keep walking鈥︹?/description>zh-cnThu, 15 May 2025 12:47:27 GMTThu, 15 May 2025 12:47:27 GMT607.1 graphic contexthttp://m.tkk7.com/joeyjong/archive/2006/04/14/41042.htmlJOOJOOFri, 14 Apr 2006 03:26:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/14/41042.htmlhttp://m.tkk7.com/joeyjong/comments/41042.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/14/41042.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/41042.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/41042.htmlgraphic context灝辮薄Control鏈欏跺眰鐨勭敾鏉匡紝瀹冨彲浠ヤ嬌浣犲悜GUI components鍔犲叆瀹㈠埗鍖栫殑鍥懼艦錛屽浘鐗囷紝鍙婁笉鍚屽瓧浣撶殑鏂囨湰銆傚悓鏍蜂篃鎻愪緵浜嬩歡澶勭悊

graphic context鏄湪GC綾諱腑鐨勶紝GC瀵硅薄鏄檮鐫浜庣幇瀛樼殑Controls銆?br />
瑕佸垱寤轟竴涓猤raphically oriented鐨勫簲鐢ㄧ▼搴忥紝棣栧厛瑕佸垱寤篻raphic context錛屽茍灝嗗叾涓庝竴涓猚omponent鐩稿叧鑱旓紝榪欎袱姝ラ兘鍙氳繃GC鐨刢onstructor鏉ュ疄鐜般傚叡鏈?涓瀯閫犲嚱鏁幫紝瑙佷笅錛?br />1. GC(Drawable)--Creates a GC and configures it for the Drawable object
2. GC(Drawable, int)--Creates and configures a GC and sets the text-display style錛岀浜屼釜鍙傛暟鍙互鏄疪IGHT_TO_LEFT鎴朙EFT_TO_RIGHT錛堥粯璁ゅ鹼級;
絎竴涓弬鏁伴渶瑕佸疄鐜癉rawable鎺ュ彛鐨勫璞★紝 姝ゆ帴鍙e寘鍚簡涓巊raphic context.鍐呴儴鐩歌仈緋葷殑鏂規硶銆係WT鎻愪緵浜嗕笁涓疄鐜癉rawable鎺ュ彛鐨勭被錛欼mage, Device,聽鍜?Control.


Control瀛愮被铏界劧閮借兘鍖呭惈鍥懼艦錛屼絾鍙湁涓涓被鏄壒鍒傚悎GC瀵硅薄鐨勶細Canvas銆傚畠涓嶄粎鎻愪緵浜嗕竴涓狢omposite鐨刢ontainment property錛岃繕鍙互鐢ㄤ竴緋誨垪鐨勯鏍兼潵瀹氫箟鍥懼艦鍦ㄦ鍖哄煙鍐呭浣曟樉紺?br />
紺轟緥錛?/u>

package com.swtjface.Ch7;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
public class DrawExample
{
public static void main (String [] args)
{
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Drawing Example");
Canvas canvas = new Canvas(shell, SWT.NONE);
canvas.setSize(150, 150);
canvas.setLocation(20, 20);//鍦╯hell涓垱寤篶anvas
shell.open ();
shell.setSize(200,220);
GC gc = new GC(canvas);//鍦╟anvas涓垱寤?/font>graphic context
gc.drawRectangle(10, 10, 40, 45);
gc.drawOval(65, 10, 30, 35);
gc.drawLine(130, 10, 90, 80);
gc.drawPolygon(new int[] {20, 70, 45, 90, 70, 70});
gc.drawPolyline(new int[] {10,120,70,100,100,130,130,75});
gc.dispose();//閲婃斁Color瀵硅薄
while (!shell.isDisposed())
{
聽if (!display.readAndDispatch())
聽display.sleep();
聽}
聽display.dispose();
聽}
聽}
鏈変袱鐐歸渶瑕佹敞鎰忥細1.鍦ㄨ皟鐢╯hell.open()涔嬪墠鏋勫緩Canvas瀵硅薄錛岀劧鍚庡湪璋冪敤shell.open()涔嬪悗鍒涘緩鍜屼嬌鐢℅C瀵硅薄
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽 2.鍦ㄤ嬌鐢ㄥ畬涔嬪悗涓瀹氳绔嬪嵆閲婃斁GC object
濡備笂渚嬫墍紺篏C鎻愪緵浜嗕竴緋誨垪鍦―rawable瀵硅薄涓婄敾鍥懼艦鐨勬柟娉曪紝濡備笅錛?br />

浣嗘槸涓婁緥涓湁涓棶棰橈細褰搒hell琚彉鐏拌繃鎴栬呮渶灝忓寲榪囦箣鍚庯紝鍥懼艦灝變細琚摝鍘匯傛墍浠ユ垜浠渶瑕佽В鍐崇殑浜嬶紝鏃犺window鎬庝箞鍙樺寲錛屽浘褰㈤兘淇濇寔鍙銆傚洜姝WT鍦ㄤ竴涓?/span>Drawable瀵硅薄琚埛鏂板悗璁╀綘鑷鎺у埗銆傝繖涓洿鏂扮殑榪囩▼灝辮縐頒負painting銆?/span>


Painting and PaintEvents

褰撲竴涓狦C鏂規硶鍦ㄤ竴涓狣rawabel瀵硅薄涓婄敾鍑轟竴涓浘妗堬紝瀹冧粎鎵ц榪欎釜painting榪囩▼涓嬈°傚鏋滅敤鎴鋒敼鍙樺璞″昂瀵告垨鏄敤鍙︿竴涓獥鍙e幓瑕嗙洊瀹冿紝鍒欏浘褰細琚秷闄ゃ傚洜姝わ紝搴旂敤紼嬪簭鑳藉惁鍦ㄥ鐣屼簨浠跺獎鍝嶄笅緇存寔鍏跺瑙傝繖涓鐐圭浉褰撻噸瑕併?br />
榪欎簺澶栭儴浜嬩歡琚О涓篜aintEvents錛屾帴鏀跺畠浠殑紼嬪簭鎺ュ彛鏄疨aintListener銆備竴涓狢ontrol鍦ㄤ換浣曟椂鍊欏綋鍏跺瑙傝搴旂敤紼嬪簭鎴栨槸澶栫晫媧誨姩鏀瑰彉閮戒細瑙﹀彂涓涓狿aintEvent銆傝繖浜涚被瀵逛簬浜嬩歡鍜岀洃鍚櫒鐨勪嬌鐢ㄦ柟寮忛兘鍜屾垜浠湪絎洓绔犲唴鎻愬埌鐨勭被浼箋傜敱浜嶱aintListener鍙湁涓涓簨浠跺鐞嗘柟娉曪紝鎵浠ヤ笉闇瑕佷嬌鐢╝dapter綾?br />
Canvas canvas = new Canvas(shell, SWT.NONE);
canvas.setSize(150, 150);
canvas.setLocation(20, 20);
canvas.addPaintListener(new PaintListener()
{
public void paintControl(PaintEvent pe)
{
GC gc = pe.gc;//姣忎竴涓狿aintEvent瀵硅薄閮藉寘鍚湁鍏惰嚜宸辯殑GC
gc.drawPolyline(new int[] {10,120,70,100,100,130,130,75});
}
});
shell.open();

姣忎竴涓狿aintEvent瀵硅薄閮藉寘鍚湁鍏惰嚜宸辯殑GC錛屼富瑕佹湁2涓師鍥狅細1.鍥犱負榪欎釜GC instance鏄敱浜嬩歡浜х敓鐨勶紝鎵浠aintEvent浼氳礋璐i噴鏀句粬銆?.搴旂敤紼嬪簭鍙互鍦╯hell open涔嬪墠鍒涘緩GC,榪欐牱鍙互浣垮浘褰㈠湪涓涓嫭绔嬬殑綾諱腑琚垱寤恒?/font>

SWT鍦?/span>PaintListener鎺ュ彛鍐呬紭鍖?/span>painting榪囩▼,SWT鐨勫紑鍙戣呭己鐑堝緩璁?/span>Control鐨?/span>painting浠呭PaintEvent浣滃嚭鍙嶅簲銆傚鏋滀竴涓簲鐢ㄧ▼搴忓洜涓哄叾浠栧師鍥犲繀欏繪洿鏂板叾鍥懼艦錛屽垯浠栦滑鎺ㄨ崘浣跨敤control鐨?/span>redraw()鏂規硶錛岃繖浼氬湪闃熷垪涓姞鍏ヤ竴涓?/span>paint璇鋒眰銆備箣鍚庯紝浣犲彲浠ヨ皟鐢?/span>update()鏂規硶鏉ュ鐞嗘墍鏈夌殑緇戝畾浜庤瀵硅薄鐨?/span>paint璇鋒眰銆?br />
闇瑕佺墷璁扮殑鏄紝铏界劧瀵逛簬Control瀵硅薄鎺ㄨ崘鍦ㄤ竴涓狿aintListener鍐卲ainting錛屼絾鏄敱浜嶥evice鍜孖mage瀵硅薄騫朵笉鑳藉湪璇ユ帴鍙e唴浣跨敤銆傚鏋滀綘闇瑕佸湪涓涓猧mage鎴杁evice鍐呯敓鎴愬浘褰紝浣犲繀欏誨崟鐙湴鐢熸垚涓涓狦C瀵硅薄騫跺湪浣跨敤緇撴潫鍚庡皢鍏墮攢姣併?/span>



JOO 2006-04-14 11:26 鍙戣〃璇勮
]]>
6.5 Custom layoutshttp://m.tkk7.com/joeyjong/archive/2006/04/12/40691.htmlJOOJOOWed, 12 Apr 2006 09:19:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/12/40691.htmlhttp://m.tkk7.com/joeyjong/comments/40691.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/12/40691.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40691.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40691.html 瑕佸鍒跺寲layout錛岄渶瑕佺戶鎵挎娊璞$被Layout錛岄渶瑕佸啓2涓柟娉曗斺攃omputeSize() 鍜宭ayout().

computeSize()

protected Point computeSize(Composite composite,
int wHint, int hHint,
boolean flushCache)
{
Point maxDimensions =
calculateMaxDimensions(composite.getChildren());
int stepsPerHemisphere =
stepsPerHemisphere(composite.getChildren().length);
int maxWidth = maxDimensions.x;
int maxHeight = maxDimensions.y;
int dimensionMultiplier = (stepsPerHemisphere + 1);
int controlWidth = maxWidth * dimensionMultiplier;
int controlHeight = maxHeight * dimensionMultiplier;
int diameter = Math.max(controlWidth, controlHeight);
Point preferredSize = new Point(diameter,
diameter);
... // code to handle case when our calculations
// are too large
return preferredSize;
}

鍙傛暟錛?br />1.composite--The object we鈥檙e going to populate. At the time this method is called, it has children, but neither the composite nor the children have been sized or positioned on the screen.

2.wHint and hHint--layout鎵闇鐨勬渶澶ч暱瀹姐傝嫢甯︽湁鍙傛暟SWT.DEFAULT,琛ㄧず姝ayout鍙互闅忔剰浣跨敤use whatever sizes it decides it needs.

3.flushCache--浣滀負flag錛宼o tell the layout whether it鈥檚 safe to use any cached values that it may be maintaining.

computeSize()鐨勭洰鐨勪富瑕佸湪浜庤綆楁垜浠layout鐨刢omposite鏈夊澶?br />layout()
鈥︹?br />



JOO 2006-04-12 17:19 鍙戣〃璇勮
]]>
6.4 The form layouthttp://m.tkk7.com/joeyjong/archive/2006/04/12/40607.htmlJOOJOOWed, 12 Apr 2006 04:22:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/12/40607.htmlhttp://m.tkk7.com/joeyjong/comments/40607.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/12/40607.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40607.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40607.html 涓庝箣鍓嶆墍榪扮殑layout涓嶅悓錛宖orm layout涓嶆槸鍩轟簬琛屽拰鍒楃殑錛屽畠鏄熀浜庝笌鍏朵粬control涔嬮棿鐨勭浉瀵逛綅緗殑銆?br />
FormLayout鍗佸垎綆鍗曪紝浣犲彧瑕侊細1.璁懼畾欏佃竟璺濓紙楂橈紝瀹斤級灞炴с?2.璁懼畾spacing灞炴э紝鍗蟲墍鏈塩ontrol闂寸殑璺濈(in pixels)

鍚屾牱鍙互浣跨敤FormData鏉ラ厤緗崟涓殑control銆?br />
FormData
濡傛灉涓涓猚ontrol娌℃湁涓涓狥ormData瀹炰緥鏉ユ弿榪板畠鐨勮瘽錛屽氨浼氶粯璁ゆ斁鍦╟omposite鐨勫彸涓婅
width鍜宧eight灞炴ф寚瀹氫簡control鐨勫昂瀵革紝in pixels.
top, bottom, right, 鍜宭eft灞炴э紝姣忎竴涓兘鏈変竴涓狥ormAttachment瀹炰緥錛岃繖浜沘ttachments鎻忚堪浜哻ontrol涓庡叾浠朿ontrol涔嬮棿鐨勫叧緋匯?br />
FormAttachment
鏈?涓嬌鐢ㄩ斿緞錛?br />1.閫氳繃浣跨敤percentage of the parent composite.


2.閫氳繃璁懼畾涓涓猚ontrol鍜屽彟涓涓猚ontrol涔嬮棿鐨勭浉瀵逛綅緗?br />銆婂浘銆?br />
package com.swtjface.Ch6;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
public class Ch6FormLayoutComposite extends Composite {
public Ch6FormLayoutComposite(Composite parent) {
super(parent, SWT.NONE);
FormLayout layout = new FormLayout();
setLayout(layout);
Text t = new Text(this, SWT.MULTI);
FormData data = new FormData();
data.top = new FormAttachment(0, 0);
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100);
data.bottom = new FormAttachment(75);//紜畾text鐨勪綅緗紝鍥犱負宸︿笂瑙掓槸鍧愭爣鍘熺偣錛屾墍浠ight鐨勭櫨鍒嗘暟涓?00銆?br />
t.setLayoutData(data);
Button ok = new Button(this, SWT.NONE);
ok.setText("Ok");
Button cancel = new Button(this, SWT.NONE);
cancel.setText("Cancel");
data = new FormData();
data.top = new FormAttachment(t);
data.right = new FormAttachment(cancel);//ok鎸夐挳鍦╰ext涓嬮潰錛宑ancel宸﹁竟
ok.setLayoutData(data);
data = new FormData();
data.top = new FormAttachment(t);
data.right = new FormAttachment(100);//cancel鎸夐挳鍦╰ext涓嬮潰錛屽湪鏈鍙寵竟
cancel.setLayoutData(data);
}
}



JOO 2006-04-12 12:22 鍙戣〃璇勮
]]>
6.3 The grid layouthttp://m.tkk7.com/joeyjong/archive/2006/04/11/40484.htmlJOOJOOTue, 11 Apr 2006 08:16:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/11/40484.htmlhttp://m.tkk7.com/joeyjong/comments/40484.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/11/40484.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40484.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40484.html 鏈甯哥敤鐨勪竴縐峫ayout.浠ow layout涓哄熀紜銆?br />
package com.swtjface.Ch6;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
public class Ch6GridLayoutComposite extends Composite {
public Ch6GridLayoutComposite(Composite parent) {
super(parent, SWT.NONE);
GridLayout layout = new GridLayout(4,false);//姣忎竴琛屾湁4涓猚ontrol錛屽悗涓涓弬鏁版槸a
boolean to indicate whether the columns should take up an even amount of
space. By passing false, you tell the layout to only use the minimum amount of
space needed for each column.

setLayout(layout);
for (int i = 0; i < 16; ++i) {
Button button = new Button(this, SWT.NONE);
button.setText("Cell " + i);
}
}
}

Using GridData styles
鍗佸垎綾諱技浜嶳owData瀵硅薄銆傚彲閫氳繃鍏舵瀯閫犲嚱鏁版潵璁懼畾STYLE錛岃繖浜汼TYLE鍙垎涓?綾伙細FILL, HORIZONTAL_ALIGN, and VERTICAL_ALIGN.
1.FILL:姝ell鏄惁fill鎵鏈夌殑availabe鐨勭┖闂淬傚彲鐢ㄧ殑鍊艱繕鍖呮嫭FILL_HORIZONTAL錛堟按騫蟲墿寮狅級,FILL_VERTICAL錛堝瀭鐩存墿寮狅級,FILL_BOTH銆?br />2.ALIGN錛岀敤鏉ユ寚瀹歝ontrol鍦╟ell涓殑浠涔堜綅緗傚煎寘鎷珺EGINNING, END, CENTER鍜孎ILL銆?br />鍏蜂綋鍙傝涓嬭〃

Using GridData size attributes
涓嶳owData涓嶅悓錛孏ridData榪樻湁寰堝鐨刾ublic灞炴с傚叾涓湁浜涙槸甯冨皵鍊肩被鍨嬬殑錛屼竴鑸細鏍規嵁鎵璁劇疆鐨勪笉鍚宻tyles鑰岃嚜鍔ㄧ鐞嗭紝鎵浠ユ棤闇瀵瑰叾鐩存帴鎿嶄綔銆傝繕鏈変竴浜涙槸integer鍊鹼紝鐢ㄦ潵紜畾鍗曚釜cells鐨勫ぇ灝忋傚叿浣撲歡涓嬭〃錛?br />



JOO 2006-04-11 16:16 鍙戣〃璇勮
]]>
6.2 The row layouthttp://m.tkk7.com/joeyjong/archive/2006/04/11/40479.htmlJOOJOOTue, 11 Apr 2006 07:58:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/11/40479.htmlhttp://m.tkk7.com/joeyjong/comments/40479.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/11/40479.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40479.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40479.html鍙互澶氳/鍒楁樉紺恒?br />
package com.swtjface.Ch6;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
public class Ch6RowLayoutComposite extends Composite {
public Ch6RowLayoutComposite(Composite parent) {
super(parent, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
setLayout(layout);
for (int i = 0; i < 16; ++i) {
Button button = new Button(this, SWT.NONE);
button.setText("Sample Text");
}
}
}

wrap鈥斺旈粯璁や負true,鑻ヨ涓篺alse,鎵鏈夌殑controls閮藉湪鍚屼竴琛屻?br />pack鈥斺旈粯璁や負true.浣挎墍鏈夌殑child controls閮藉ぇ灝忎竴鏍楓?br />justify鈥斺旈粯璁や負false. 鑻ヤ負true,姣忎竴琛岀殑control閮戒細浠ラ棿闅旂浉鍚岀殑鏂瑰紡鎺掑垪銆?br />
RowData
鍙互閫氳繃setLayoutData()鏉ヨ瀹氭瘡涓猚ontrol鐨勫ぇ灝忥紝濡傦細button.setLayoutData(new RowData(200 + 5 * i, 20 + i));


JOO 2006-04-11 15:58 鍙戣〃璇勮
]]>
6.1 The fill layouthttp://m.tkk7.com/joeyjong/archive/2006/04/11/40472.htmlJOOJOOTue, 11 Apr 2006 07:23:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/11/40472.htmlhttp://m.tkk7.com/joeyjong/comments/40472.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/11/40472.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40472.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40472.html 榛樿涓轟粠宸﹀埌鍙蟲帓鏀劇殑錛屾牴鎹瘡涓猚ontrol瀹為檯鎵闇鐨勫ぇ灝忔潵鍒嗛厤絀洪棿錛屾composite涓浜庡嚭鏉ョ殑絀洪棿錛屽啀騫蟲憡鍒版瘡涓猚ontrol涓娿傞殢鐫composite鐨勫ぇ灝忚皟鏁達紝control鐨勫ぇ灝忎篃浼氳窡鐫璋冩暣銆?br />
package com.swtjface.Ch6;
import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
public class Ch6FillLayoutComposite extends Composite {
public Ch6FillLayoutComposite(Composite parent) {
super(parent, SWT.NONE);
FillLayout layout = new FillLayout( SWT.VERTICAL); //榛樿鏄疭WT.HORIZONTAL
setLayout(layout);//涓烘Composite璁懼畾涓涓猯ayout.濡傛灉婕忎簡姝よ鍙ワ紝浼氭樉紺轟笉鍑篶hild control銆?br />for (int i = 0; i < 8; ++i) {
Button button = new Button(this, SWT.NONE);
button.setText("Sample Text");
}
}
}



JOO 2006-04-11 15:23 鍙戣〃璇勮
]]>
5.8 ProgressIndicatorhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40291.htmlJOOJOOMon, 10 Apr 2006 10:07:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/10/40291.htmlhttp://m.tkk7.com/joeyjong/comments/40291.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40291.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40291.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40291.html鍚孭rogressIndicator涓鏍鳳紝瀹冩敮鎸佸伐浣滅殑铏氭嫙鍗曚綅錛寉ou need only initialize the ProgressIndicator with the total amount of work you expect to do and notify it as work is completed:

ProgressIndicator indicator = new ProgressIndicator(parent);
...
indicator.beginTask(10);
...
Display.getCurrent()display.asyncExec(new Runnable() {
public void run() {
//Inform the indicator that some amount of work has been done
indicator.worked(1);
}
});

姝e涓婁緥鎵紺猴紝浣跨敤ProgressIndicator闇瑕?姝ワ細
1.璁﹊ndicator鐭ラ亾鎬誨叡鏈夊灝戝伐浣滐紝閫氳繃浣跨敤beginTask().鍙湁榪欎釜鏂規硶琚皟鐢ㄤ簡涔嬪悗錛岃繖涓猚ontrol鎵嶄細鍦ㄥ睆騫曚笂鏄劇ず銆?br />2.姣忓綋鏈変竴閮ㄥ垎宸ヤ綔琚畬鎴愪簡錛屽氨璋冪敤worked()銆備負浜嗛槻姝㈤潪ui鐨勭嚎紼嬫潵update widgets錛屾墍浠ヤ嬌鐢╝syncExec()鏉ヨВ鍐寵繖涓棶棰樸?br />
ProgressIndicator涔熸彁渚沘nimated妯″紡錛屽嵆鎬誨伐浣滈噺涓嶇煡閬撶殑鎯呭喌銆傚湪榪欑妯″紡涓嬶紝the bar continually fills and empties
until done() is called. 瑕佷嬌鐢ㄨ繖涓ā寮忥紝灝辮鐢╞eginAnimatedTask()浠f浛beginTask();騫朵笖涓嶉渶瑕亀orked()鏂規硶浜?/font>

JOO 2006-04-10 18:07 鍙戣〃璇勮
]]>
5.7 ProgressBarhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40287.htmlJOOJOOMon, 10 Apr 2006 09:56:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/10/40287.htmlhttp://m.tkk7.com/joeyjong/comments/40287.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40287.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40287.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40287.htmlProgressBar錛岃繘搴︽潯錛屾槸ProgressIndicator鐨勭畝鍖栫増鏈傚ぇ澶氭暟鎯呭喌涓嬫帹鑽愪嬌鐢≒rogressIndicator銆傚鏋滀綘鍐沖畾鐩存帴浣跨敤ProgressBar錛岄渶瑕佹墜鍔ㄦ敼鍙樻bar鐨勫瑙傘傚涓?br />
//Style can be SMOOTH, HORIZONTAL, or VERTICAL
ProgressBar bar = new ProgressBar(parent, SWT.SMOOTH);
bar.setBounds(10, 10, 200, 32);
bar.setMaximum(100);
...
for(int i = 0; i < 10; i++) {
//Take care to only update the display from its
//own thread
Display.getCurrent().asyncExec(new Runnable() {
public void run() {
//Update how much of the bar should be filled in
bar.setSelection((int)(bar.getMaximum() * (i+1) / 10));
}
});
}

setSelection()causes the widget to be updated every time.This behavior is unlike that of ProgressIndicator or ProgressMonitorDialog,which will update the display only if it has changed by an amount that will be visible to the end user.


JOO 2006-04-10 17:56 鍙戣〃璇勮
]]>5.6 Sliderhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40286.htmlJOOJOOMon, 10 Apr 2006 09:45:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/10/40286.htmlhttp://m.tkk7.com/joeyjong/comments/40286.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40286.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40286.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40286.html綾諱技浜巗crollbars銆俿crollbars浠呴檺浜庣敤鍦ㄥ彲婊戝姩鐨刬tem涓婏紝濡倀ext銆?br />
鍙氳繃setMinimum()鍜宻etMaximum()鏉ヨ瀹氬畠鐨勮寖鍥淬傚彲閫氳繃setThumb()鏉ヨ瀹氭粦鍧楃殑鍊箋傚湪鏈変簺OS涓婏紝thumb鐨勫ぇ灝忔槸甯告暟銆傛瘡鎸変竴涓嬬澶達紝鎵縐誨姩鐨勫肩О涓篿ncrement.鍙氳繃setIncrement()鏉ヨ瀹氾紝鎸夋粦鍧楀拰綆ご闂寸殑絀洪棿鎵婊戝姩鐨勫間負page increment錛屽彲閫氳繃PageIncrement()鏉ヨ瀹氥備互涓婅繖浜涙暟鎹彲浠ラ氳繃void setValues( int selection, int minimum, int maximum, int thumb, int increment, int pageIncrement)鏉ヤ竴嬈℃ц瀹氾紝鍏朵腑selection鏄痶humb鐨勫嚭鍙戠偣銆?br />
Slider鏈変釜灞炴х敤鏉ヨ瀹氬叾鏄按騫寵繕鏄瀭鐩寸殑錛岄粯璁や負姘村鉤銆?br />
package com.swtjface.Ch5;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Slider;
public class Ch5Slider extends Composite {
public Ch5Slider(Composite parent) {
super(parent, SWT.NONE);
setLayout(new FillLayout());
Slider slider = new Slider(this, SWT.HORIZONTAL);
slider.setValues(1000, 400, 1600, 200, 10, 100);
}
}


JOO 2006-04-10 17:45 鍙戣〃璇勮
]]>
5.5 CoolBarhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40279.htmlJOOJOOMon, 10 Apr 2006 09:28:00 GMThttp://m.tkk7.com/joeyjong/archive/2006/04/10/40279.htmlhttp://m.tkk7.com/joeyjong/comments/40279.htmlhttp://m.tkk7.com/joeyjong/archive/2006/04/10/40279.html#Feedback0http://m.tkk7.com/joeyjong/comments/commentRss/40279.htmlhttp://m.tkk7.com/joeyjong/services/trackbacks/40279.html綾諱技浜嶵oolBar鐨勫崌綰с備粬浠殑鍖哄埆鍦ㄤ簬CoolBar涓婄殑item鍙互琚噸鏂伴厤緗紝閲嶆柊瀹氬ぇ灝忋侰oolBar鐨勪竴鑸敤閫斿氨鏄寘鍚玹oolbars鎴栨寜閽?br />
String[] coolItemTypes = {"File", "Formatting", "Search"};
CoolBar coolBar = new CoolBar(parent, SWT.NONE);
for(int i = 0; i < coolItemTypes.length; i++)
{
CoolItem item = new CoolItem(coolBar, SWT.NONE);
ToolBar tb = new ToolBar(coolBar, SWT.FLAT);
for(int j = 0; j < 3; j++)
{
ToolItem ti = new ToolItem(tb, SWT.NONE);
ti.setText(coolItemTypes[i] + " Item #" + j);
}
}

JOO 2006-04-10 17:28 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 免费一区二区三区四区五区| 精品香蕉在线观看免费| 国产乱辈通伦影片在线播放亚洲| 亚洲成a人片在线不卡一二三区| 大学生美女毛片免费视频| 亚洲中文字幕乱码一区| 日本二区免费一片黄2019| 老司机午夜性生免费福利 | 一级毛片免费不卡| 国产精品亚洲产品一区二区三区| 国产成人无码精品久久久久免费 | 亚洲综合激情五月丁香六月 | 亚洲欧洲精品成人久久奇米网 | 亚洲日韩在线观看免费视频| 中文字幕亚洲专区| 久久久久久AV无码免费网站 | 在线亚洲v日韩v| 国产成人99久久亚洲综合精品 | a级毛片无码免费真人| 亚洲欧美国产欧美色欲| 亚洲国产成人精品女人久久久 | 亚洲今日精彩视频| 国产免费久久精品99re丫y| 亚洲精品无码aⅴ中文字幕蜜桃| 国产乱子伦精品免费无码专区| 一区二区三区免费精品视频| 亚洲αv在线精品糸列| 青青在线久青草免费观看| 爱情岛论坛免费视频| 亚洲av无码不卡一区二区三区| 狼群影院在线观看免费观看直播 | 亚洲日韩一中文字暮| 亚洲麻豆精品国偷自产在线91| a级片在线免费看| 国产精品亚洲精品观看不卡| 亚洲成AV人在线观看网址| 毛片无码免费无码播放| 男男gvh肉在线观看免费| 亚洲国产精品人久久| 免费看a级黄色片| 一级毛片在线免费观看|