关于SWT Shell问题? SWT能不能动态改变Shell的Style 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 ms不能,不过你可以在这个shell里放一个顶满的composite需要换style的时候,把这个composite按需要的style重新new一下 我想让子Shell在后,让父Shell在前可以实现吗? 饿……第一次见一个进程起2个shell的试了下,ms不能 应该是可以的,你用swt的child = new Shell(parent);创建一个子窗口后,焦点是在子窗口的,只要你的子窗口不是模态貌似点击父窗口就可以让父窗口在子窗口前面了,你试试看看 我写了个出来,可以在NO_TRIM与SHELL_TRIM中动态转化,也可以运行.import org.eclipse.swt.SWT;import org.eclipse.swt.events.SelectionEvent;import org.eclipse.swt.events.SelectionListener;import org.eclipse.swt.layout.RowLayout;import org.eclipse.swt.widgets.Button;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.Shell;public class ShellTest implements SelectionListener { private Display display; private Shell shell; private Button button; private boolean flag = false; public ShellTest() { display = new Display(); shell = new Shell(display); shell.setLayout(new RowLayout()); build(); shell.open(); while (!shell.isDisposed()) if (!display.readAndDispatch()) display.sleep(); display.dispose(); } private void build() { button = new Button(shell, SWT.PUSH); button.setText("Push ME"); button.addSelectionListener(this); } public void widgetSelected(SelectionEvent evnt) { if (flag == true) { shell.dispose(); flag = false; shell = new Shell(display, SWT.SHELL_TRIM); shell.setLayout(new RowLayout()); build(); shell.open(); } else { shell.dispose(); flag = true; shell = new Shell(display, SWT.NO_TRIM); shell.setLayout(new RowLayout()); build(); shell.open(); } } public void widgetDefaultSelected(SelectionEvent evnt) { } public static void main(String[] args) { new ShellTest(); }} 应该是可以的,只要在父Shell在open()之前open()子Shell就可以了.过这样的话 父shell要显示就必须等到子shell关闭 这个看似可以,但子Shell并不在父Shell后面,只是可以操作父Shell java与flash通信问题 关于十进制和八进制的问题 java byte[] 动态增加问题 谁有java调用.net的dll简单例子 derby中的列怎么用update的方式改成自动增长列啊? 我学习Java中遇到Fatal exception occurred,program will exit。请各位兄弟帮忙 初学者关于面板的几个问题,请指教 myEclipse是免费的吗? 怎么在servlet里设定一个windows的排程,自动执行一个servlet 请问关于路径设置的问题 java socket 服务端怎么写两个serverSocket? 为什么运行后不显示标签文本?不闪烁?
需要换style的时候,把这个composite按需要的style重新new一下
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;public class ShellTest implements SelectionListener {
private Display display;
private Shell shell;
private Button button;
private boolean flag = false; public ShellTest() {
display = new Display();
shell = new Shell(display);
shell.setLayout(new RowLayout()); build(); shell.open();
while (!shell.isDisposed())
if (!display.readAndDispatch())
display.sleep();
display.dispose();
} private void build() {
button = new Button(shell, SWT.PUSH);
button.setText("Push ME");
button.addSelectionListener(this);
} public void widgetSelected(SelectionEvent evnt) {
if (flag == true) {
shell.dispose();
flag = false;
shell = new Shell(display, SWT.SHELL_TRIM);
shell.setLayout(new RowLayout());
build();
shell.open();
} else {
shell.dispose();
flag = true;
shell = new Shell(display, SWT.NO_TRIM);
shell.setLayout(new RowLayout());
build();
shell.open();
}
} public void widgetDefaultSelected(SelectionEvent evnt) { } public static void main(String[] args) {
new ShellTest();
}
}
这个看似可以,但子Shell并不在父Shell后面,只是可以操作父Shell