最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

SWT(JFace)體驗之Sash(活動控件)

 更新時間:2009年06月25日 11:52:05   作者:  
SWT(JFace)體驗之Sash(活動控件)
演示代碼如下:

復(fù)制代碼 代碼如下:

package swt_jface.demo9;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
import org.eclipse.swt.widgets.Shell;
public class SashExample {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
final Sash sash = new Sash(shell, SWT.BORDER | SWT.VERTICAL);
sash.setBounds(10, 10, 15, 60);
sash.addListener(SWT.Selection, new Listener() {
public void handleEvent(Event e) {
System.out.println("Selected. ");
sash.setBounds(e.x, e.y, e.width, e.height);
}
});
shell.open();
sash.setFocus();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
package swt_jface.demo9;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Sash;
import org.eclipse.swt.widgets.Shell;
public class SashExample {
    public static void main(String[] args) {
        Display display = new Display();
        Shell shell = new Shell(display);
        final Sash sash = new Sash(shell, SWT.BORDER | SWT.VERTICAL);
        sash.setBounds(10, 10, 15, 60);
        sash.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event e) {
                System.out.println("Selected. ");
                sash.setBounds(e.x, e.y, e.width, e.height);
            }
        });
        shell.open();
        sash.setFocus();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        }
        display.dispose();
    }
}


再來一個例子:

復(fù)制代碼 代碼如下:

package swt_jface.demo9;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
public class SashFormExample {

Display display = new Display();
Shell shell = new Shell(display);

SashForm sashForm;
SashForm sashForm2;
public SashFormExample() {

shell.setLayout(new FillLayout());

sashForm = new SashForm(shell, SWT.HORIZONTAL);
Text text1 = new Text(sashForm, SWT.CENTER);
text1.setText("Text in pane #1");
Text text2 = new Text(sashForm, SWT.CENTER);
text2.setText("Text in pane #2");

sashForm2 = new SashForm(sashForm, SWT.VERTICAL);
final Label labelA = new Label(sashForm2, SWT.BORDER | SWT.CENTER);
labelA.setText("Label in pane A");
final Label labelB = new Label(sashForm2, SWT.BORDER |SWT.CENTER);
labelB.setText("Label in pane B");

text1.addControlListener(new ControlListener() {
public void controlMoved(ControlEvent e) {
}
public void controlResized(ControlEvent e) {
System.out.println("Resized");
//ArrayUtil.printArray(sashForm.getWeights(), System.out);
}
});

sashForm.setWeights(new int[]{1, 2, 3});

labelA.addMouseListener(new MouseListener() {
public void mouseDoubleClick(MouseEvent e) {
if(sashForm2.getMaximizedControl() == labelA)
sashForm2.setMaximizedControl(null);
else
sashForm2.setMaximizedControl(labelA);
}
public void mouseDown(MouseEvent e) {
}
public void mouseUp(MouseEvent e) {
}
});


shell.setSize(450, 200);
shell.open();

while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
public static void main(String[] args) {
new SashFormExample();
}
}

相關(guān)文章

  • Json 自定義使用函數(shù)的簡單實例

    Json 自定義使用函數(shù)的簡單實例

    下面小編就為大家?guī)硪黄狫son 自定義使用函數(shù)的簡單實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-10-10
  • 詳解Java對象序列化為什么要使用SerialversionUID

    詳解Java對象序列化為什么要使用SerialversionUID

    這篇文章主要介紹了詳解Java對象序列化為什么要使用SerialversionUID,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • FastJSON字段智能匹配踩坑的解決

    FastJSON字段智能匹配踩坑的解決

    這篇文章主要介紹了FastJSON字段智能匹配踩坑的解決方案,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2021-06-06
  • springAOP完整實現(xiàn)過程

    springAOP完整實現(xiàn)過程

    當(dāng)你調(diào)用SimpleService類的doSomething方法時,上述的PerformanceAspect會自動攔截此調(diào)用,并且記錄該方法的執(zhí)行時間,這樣你就完成了一個針對Spring的AOP入門級案例,感興趣的朋友一起看看吧
    2024-02-02
  • Maven中dependency和plugins的繼承與約束

    Maven中dependency和plugins的繼承與約束

    這篇文章主要介紹了Maven中dependency和plugins的繼承與約束,具有很好的參考價值,希望對大家有所幫助。如有錯誤或未考慮完全的地方,望不吝賜教
    2022-12-12
  • MyBatisPlus+Spring實現(xiàn)聲明式事務(wù)的方法實現(xiàn)

    MyBatisPlus+Spring實現(xiàn)聲明式事務(wù)的方法實現(xiàn)

    本文主要介紹了MyBatisPlus+Spring實現(xiàn)聲明式事務(wù)的方法實現(xiàn),文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2024-07-07
  • 輕松掌握java中介者模式

    輕松掌握java中介者模式

    這篇文章主要幫助大家輕松掌握java中介者模式,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2016-09-09
  • springboot?web項目中?Set-Cookie?失敗原因及解決辦法

    springboot?web項目中?Set-Cookie?失敗原因及解決辦法

    這篇文章主要介紹了springboot?web項目中?Set-Cookie?失敗原因及解決辦法,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下
    2023-10-10
  • Mybatis模糊查詢和動態(tài)sql語句的用法

    Mybatis模糊查詢和動態(tài)sql語句的用法

    今天小編就為大家分享一篇關(guān)于Mybatis模糊查詢和動態(tài)sql語句的用法,小編覺得內(nèi)容挺不錯的,現(xiàn)在分享給大家,具有很好的參考價值,需要的朋友一起跟隨小編來看看吧
    2019-03-03
  • SpringBoot中的@FeignClient注解使用

    SpringBoot中的@FeignClient注解使用

    文章主要介紹了SpringCloud中的@FeignClient注解的使用及其參數(shù)詳解,包括value/name、url、path、configuration、fallback/fallbackFactory、contextId等,通過@FeignClient注解,可以方便地聲明一個REST客戶端,并定義與目標服務(wù)通信的接口
    2024-11-11

最新評論

汶上县| 绥宁县| 沈丘县| 大石桥市| 稻城县| 策勒县| 石河子市| 连江县| 长沙县| 自贡市| 梁平县| 栖霞市| 嘉定区| 喀喇沁旗| 屏东县| 江北区| 噶尔县| 盐源县| 白山市| 荔浦县| 沁水县| 南宁市| 正蓝旗| 恩施市| 金塔县| 高安市| 南江县| 师宗县| 灵台县| 南皮县| 远安县| 开远市| 贵南县| 盱眙县| 武义县| 潮州市| 桂林市| 普定县| 开远市| 天等县| 千阳县|