欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

SWT(JFace)體驗(yàn)之Sash(活動(dòng)控件)

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

復(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();
    }
}


再來一個(gè)例子:

復(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)文章

  • 一篇文章帶你入門java工廠模式

    一篇文章帶你入門java工廠模式

    這篇文章主要介紹了Java工廠模式,結(jié)合實(shí)例形式詳細(xì)分析了java基本數(shù)據(jù)類型、數(shù)據(jù)類型轉(zhuǎn)換、算術(shù)運(yùn)算符、邏輯運(yùn)算符等相關(guān)原理與操作技巧,需要的朋友可以參考下
    2021-08-08
  • 淺談JVM系列之從匯編角度分析NullCheck

    淺談JVM系列之從匯編角度分析NullCheck

    在virtual call中執(zhí)行nullcheck的時(shí)候,如果已經(jīng)知道傳遞的參數(shù)是非空的。JIT會(huì)對(duì)代碼進(jìn)行優(yōu)化嗎?本文將詳細(xì)介紹JVM系列之從匯編角度分析NullCheck。
    2021-06-06
  • Java中的包裝類是什么

    Java中的包裝類是什么

    這篇文章主要介紹了Java中的包裝類是什么,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • springboot的異步任務(wù):無返回值和有返回值問題

    springboot的異步任務(wù):無返回值和有返回值問題

    這篇文章主要介紹了springboot的異步任務(wù):無返回值和有返回值問題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-07-07
  • java實(shí)現(xiàn)簡(jiǎn)單計(jì)算器功能

    java實(shí)現(xiàn)簡(jiǎn)單計(jì)算器功能

    這篇文章主要為大家詳細(xì)介紹了java實(shí)現(xiàn)簡(jiǎn)單計(jì)算器功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • 淺談讓@Value更方便的Spring自定義轉(zhuǎn)換類

    淺談讓@Value更方便的Spring自定義轉(zhuǎn)換類

    Spring為大家內(nèi)置了不少開箱即用的轉(zhuǎn)換類,如字符串轉(zhuǎn)數(shù)字、字符串轉(zhuǎn)時(shí)間等,但有時(shí)候需要使用自定義的屬性,則需要自定義轉(zhuǎn)換類了
    2021-06-06
  • Javabean基于xstream包實(shí)現(xiàn)轉(zhuǎn)XML文檔的方法

    Javabean基于xstream包實(shí)現(xiàn)轉(zhuǎn)XML文檔的方法

    這篇文章主要介紹了Javabean基于xstream包實(shí)現(xiàn)轉(zhuǎn)XML文檔的方法,結(jié)合具體實(shí)例形式分析了xstream包用于轉(zhuǎn)換xml文件的具體使用技巧,需要的朋友可以參考下
    2017-05-05
  • Java代碼實(shí)現(xiàn)哈希表(google 公司的上機(jī)題)

    Java代碼實(shí)現(xiàn)哈希表(google 公司的上機(jī)題)

    這篇文章主要介紹了Java 哈希表詳解(google 公司的上機(jī)題),本文通過圖文實(shí)例相結(jié)合給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2021-03-03
  • Java排序算法總結(jié)之冒泡排序

    Java排序算法總結(jié)之冒泡排序

    這篇文章主要介紹了Java排序算法總結(jié)之冒泡排序,較為詳細(xì)的分析了冒泡排序的原理與java實(shí)現(xiàn)技巧,需要的朋友可以參考下
    2015-05-05
  • java編碼IDEA主題推薦

    java編碼IDEA主題推薦

    在這篇文章中,我精選了幾個(gè)比較是和?Java?編碼的?IDEA?主題供小伙伴們選擇。另外,我自己用的是?One?Dark?theme?這款,有需要的朋友可以借鑒參考下,希望大家喜歡
    2022-01-01

最新評(píng)論