awt还是swt?
swt是另一个UI库,与swing不同,你现在用的是swing...
1 swing直接实现半透明不方便,因为无法获得底层窗口的句柄,或者你得通过本地方法实现。另外有一种模拟半透明的方式,就是屏幕截图进行背景绘制..
2 不知你问的啥
3 图片的分辨率刚好填满窗口?你是指像素还是?分辨率是图像是否清晰的指标!
你是想拉伸图片还是不拉伸图片?拉伸图片有几种模式可以拉伸,有的丢失像素比较严重但速度快,有的相反..
4 用多线程解决,直接可以使用Timer
new Timer(1000, new ActionListener(){
public void actionPerformed(ActionEvent e){
button.setText(...) //每1秒更换文本
}
}).start();
补充:1 无论是外部类还是内部类,只要其实现了listener接口就可以实现监听,在代码中找到按钮添加监听器的代码段形如:button.addActionListener(...)
将其替换为自己写的外部类:
class A implements ActionListener{
...}
button.addActionListener(new A())即可。
2 tabbedPane隐藏标签,难道你不是通过点击标签来切换而是用另外的按钮来实现?不知你为何要这样做..不过用另外的按钮来切换的话只需要在按钮监听处理的地方加上: tabbedPane.setSelectedIndex(int index) 应该就可以了
文件一:
public class ChildShellExample {
@SuppressWarnings("unused")
ChildShellExample() {
Display d = new Display();
final Shell s = new Shell(d);
s.setSize(500, 500);
Button button = new Button(s, SWT.NONE);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ChildShell cs = new ChildShell(s);
}
});
button.setBounds(163, 204, 68, 23);
button.setText("打开");
// s.setMaximized(false);
s.open();
while (!s.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
}
public static void main(String[] args) {
new ChildShellExample();
}
}
文件二:
import org.eclipse.swt.widgets.Shell;
public class ChildShell {
ChildShell(Shell parent) {
Shell child = new Shell(parent);
child.setSize(200, 200);
child.open();
}
}
楼主自己试试吧。。
其实也不难。。。
祝你好运。。。。