锘??xml version="1.0" encoding="utf-8" standalone="yes"?>国产精品69久久久久,日本国产亚洲,日韩国产在线http://www.aygfsteel.com/wing5jface/闂滄敞浜巈clipse rcp闁嬬櫦, SWT/JFACE瀛哥繏zh-cnWed, 18 Jun 2025 17:16:27 GMTWed, 18 Jun 2025 17:16:27 GMT60闂茶瘽(1)SWT 3.2鍚庣殑涓浜涙洿鏂?鍏充簬3.4 涓嶈鍒欑獥浣撲笌涓嶈鍒欐帶浠剁殑鍒涘緩http://www.aygfsteel.com/wing5jface/archive/2009/07/09/286077.htmlECLIPSE RCP [SWT/JFACE] For CN_ZHECLIPSE RCP [SWT/JFACE] For CN_ZHThu, 09 Jul 2009 05:29:00 GMThttp://www.aygfsteel.com/wing5jface/archive/2009/07/09/286077.htmlhttp://www.aygfsteel.com/wing5jface/comments/286077.htmlhttp://www.aygfsteel.com/wing5jface/archive/2009/07/09/286077.html#Feedback0http://www.aygfsteel.com/wing5jface/comments/commentRss/286077.htmlhttp://www.aygfsteel.com/wing5jface/services/trackbacks/286077.htmleclipse3.4鐗堟湰鍦⊿WT鏂歸潰鎻愪緵浜嗕互涓嬫湁瓚g殑鏂板鍔熻兘錛?br />      SWT涓嶈鍒欐帶浠剁殑鍒涘緩

1錛氭彁渚涚湡姝g殑SWT鍏ㄥ睆鐘舵?涓嶅啀寮哄埗闇瑕佷嬌鐢∣N_TOP璁劇疆紿椾綋鐨剆tyle,
      鍦ㄨ繖涔嬪墠涔熷彲杈懼埌鍏ㄥ睆鏁堟灉錛屼笉榪囦綘蹇呴』璁劇疆shell鐨剅egion絳変簬灞忓箷鐨凷IZE.
2:   鎻愪緵紿椾綋閫忔槑涓庡崐閫忔槑涔嬭緗?濡倃indows,閮ㄥ垎linux OS銆?br /> 3錛氭彁渚涚湡姝g殑涓嶈鍒欐帶浠跺垱寤哄姛鑳斤紝姣斾箣鍓嶇殑鍒涘緩涓嶈鍒欑殑SHELL鏇存湁鎰忔?br /> 4   澧炲己SWT瀵笹C鎴朑C瀵規帶浠跺唴閮ㄧ殑緇樺埗銆?br /> 涓婅堪鐗圭偣灝嗕負鎴戜滑鍒涘緩鏇碈OOL鐨凷WT 鐣岄潰鍏冪礌鎻愪緵鍩虹銆?br />
棣栧厛鎴戜滑鍏堟湁eclipse瀹樻柟鐨勪緥瀛愮畝鍗曡鏄庡垱寤轟笉瑙勫垯鎺т歡鐨勮繃紼?br />
[Java浠g爜]
package org.eclipse.swt.snippets;

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

/*
* 浣跨敤Region鍒涘緩涓嶈鍒欐帶浠朵箣SWTButton
*   on a control: create a non-rectangular button

* http://dev.eclipse.org/viewcvs/index.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet294.java?view=co
* For a list of all SWT example snippets see
* http://www.eclipse.org/swt/snippets/
*
* @since 3.4
*/

public class Snippet294 {

  static int[] circle(int r, int offsetX, int offsetY) {
    int[] polygon = new int[8 * r + 4];
    // x^2 + y^2 = r^2
    for (int i = 0; i < 2 * r + 1; i++) {
      int x = i - r;
      int y = (int)Math.sqrt(r*r - x*x);
      polygon[2*i] = offsetX + x;
      polygon[2*i+1] = offsetY + y;
      polygon[8*r - 2*i - 2] = offsetX + x;
      polygon[8*r - 2*i - 1] = offsetY - y;
    }
    return polygon;
  }

  public static void main(String[] args) {
    final Display display = new Display();
    
    final Shell shell = new Shell(display);
    shell.setText("Regions on a Control");
    shell.setLayout(new FillLayout());
    shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_RED));
    
    Button b2 = new Button(shell, SWT.PUSH);
    b2.setText("Button with Regions");
    
    // define a region that looks like a circle with two holes in ot
    Region region = new Region();
    region.add(circle(67, 87, 77));
    region.subtract(circle(20, 87, 47));
    region.subtract(circle(20, 87, 113));
    
    // define the shape of the button using setRegion
    b2.setRegion(region);
    b2.setLocation(100,50);
    
    b2.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        shell.close();
      }
    });
    
    shell.setSize(200,200);
    shell.open();
    
    while (!shell.isDisposed()) {
      if (!display.readAndDispatch())
        display.sleep();
    }
    region.dispose();
    display.dispose();
  }
  
}


[/java浠g爜]

鍏舵鍐嶆潵鐪嬬湅濡備綍鍒涘緩涓嶈鍒欑殑鎺т歡錛?br /> 浠ヤ笅浠ョ戶鎵跨殑SWT Button琛ㄧ幇涓嶈鍒欐寜浠?/strong>

package testupdate;

import org.eclipse.swt.graphics.Region;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;

public class cirButton extends Button {
  static int[] circle(int r, int offsetX, int offsetY) {
    int[] polygon = new int[8 * r + 4];
    for (int i = 0; i < 2 * r + 1; i++) {
      int x = i - r;
      int y = (int) Math.sqrt(r * r - x * x);
      polygon[2 * i] = offsetX + x;
      polygon[2 * i + 1] = offsetY + y;
      polygon[8 * r - 2 * i - 2] = offsetX + x;
      polygon[8 * r - 2 * i - 1] = offsetY - y;
    }
    return polygon;
  }

  Region region = null;

  public cirButton(Composite parent, int style) {
    super(parent, style);
    setwingRes();
  }

  /**
   * 鎸囧畾涓嶈鍒欑殑鍖哄煙鍙婂艦鐘?br />    */
  public void setwingRes() {
    region = genRegion();
    setRegion(region);
  }

  // 闇瑕侀噸鍐檆heckSubclass鏂規硶鎵嶅彲姝g‘浣跨敤
  @Override
  protected void checkSubclass() {

  }

  public static Region genRegion() {
    Region region;
    region = new Region();
    region.add(circle(67, 87, 77));
    region.subtract(circle(20, 87, 47));
    region.subtract(circle(20, 87, 113));
    return region;
  }

}

=============================================
嫻嬭瘯浠g爜
=============================================
package testupdate;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

/**
* @since Eclispe 3.4
* @author wing5jface
*
*/
public class coolSWTButton {

  public static void main(String[] args) {
    final Display display = new Display();

    final Shell shell = new Shell(display);
    shell.setText("鍒涘緩涓嶈鍒欐帶浠朵箣SWT");
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    shell.setLayout(gridLayout);
    shell.setBackground(display.getSystemColor(SWT.COLOR_DARK_RED));
    GridData griddata = new GridData(300, 160);
    cirButton button = new cirButton(shell, SWT.PUSH);
    button.setwingRes();
    button.setText("http://www.ben777.cn");
    button.setLayoutData(griddata);

    button = new cirButton(shell, SWT.PUSH);
    button.setText("ben777.cn");
    button.setLayoutData(griddata);
    button = new cirButton(shell, SWT.PUSH);
    button.setwingRes();
    button.setText("cool 鎺т歡");
    button.setLayoutData(griddata);
    shell.setSize(1000, 900);
    shell.open();

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

    display.dispose();
  }

}

鏉ユ簮wing5jface<http://www.ben777.cn>

]]>
主站蜘蛛池模板: 宽城| 永寿县| 偃师市| 绥滨县| 太和县| 惠安县| 资阳市| 昌邑市| 淮阳县| 扶风县| 葫芦岛市| 阳江市| 澄城县| 岳西县| 阜宁县| 浠水县| 青神县| 紫阳县| 荃湾区| 饶河县| 三江| 襄汾县| 军事| 鄯善县| 苍溪县| 柳州市| 吉安市| 和顺县| 屏东县| 佛山市| 于都县| 白水县| 蒙阴县| 澳门| 道孚县| 松滋市| 太白县| 丰宁| 闻喜县| 绍兴县| 衡山县|