欧美大屁股bbbbxxxx,狼人大香伊蕉国产www亚洲,男ji大巴进入女人的视频小说,男人把ji大巴放进女人免费视频,免费情侣作爱视频

歡迎來到入門教程網(wǎng)!

Java編程

當(dāng)前位置:主頁 > 軟件編程 > Java編程 >

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

來源:本站原創(chuàng)|時(shí)間:2020-01-10|欄目:Java編程|點(diǎn)擊: 次

演示代碼如下:

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

上一篇:JDK的命令詳解

欄    目:Java編程

下一篇:SWT(JFace)體驗(yàn)之打開多個(gè)Form

本文標(biāo)題:SWT(JFace)體驗(yàn)之Sash(活動(dòng)控件)

本文地址:http://mengdiqiu.com.cn/a1/Javabiancheng/8523.html

網(wǎng)頁制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語言數(shù)據(jù)庫服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有