前辈,请帮个忙写一个设置界面背景的源代码,谢谢 前辈,请帮个忙写一个设置界面背景的源代码,谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 import org.eclipse.swt.graphics.Image;import org.eclipse.swt.widgets.Display;import org.eclipse.swt.widgets.Shell;public class Expand{ protected Shell shell; /** * Launch the application. * @param args */ public static void main(String[] args) { try { Expand window = new Expand(); window.open(); } catch (Exception e) { e.printStackTrace(); } } /** * Open the window. */ public void open() { Display display = Display.getDefault(); createContents(); shell.open(); shell.layout(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } } /** * Create contents of the window. */ protected void createContents() { shell = new Shell(); shell.setSize(450, 300); shell.setText("SWT Application"); Image image = new Image(shell.getDisplay(), getClass().getResourceAsStream("eclipse48.png")); shell.setBackgroundImage(image); }}需要一个图片eclipse48.png放在类的文件夹下面 import org.jdesktop.swingx.painter.ImagePainter;import org.jdesktop.swingx.JXPanel;JXPanel container = new JXPanel();container.setBackgroundPainter(new ImagePainter(ImageIO.read(....)));container.add(...);frame.setContentPane(contaienr);使用了SwingX库。 如何查看编译器优化字符串的加操作? hsl与rgb转换 求applet缓存机制 给我一个实现多层菜单的程序的示例 java程序如何穿透代理访问外部网?(代码有错嘛,谢谢!) 3个色子 有多少组合类型 把SQL SERVER的存储过程放在文本文件里,JAVA读取这个文件执行报错 高手帮忙解答关于组件监听的问题?小弟先谢了! 请问 除了sun的网站,哪里有下载JDK1.4 for linux的地方呀 求解做一个瞄准器的窗口 为什么这样赋值就是null呢,求各位指点一下。
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;public class Expand
{ protected Shell shell; /**
* Launch the application.
* @param args
*/
public static void main(String[] args)
{
try
{
Expand window = new Expand();
window.open();
}
catch (Exception e)
{
e.printStackTrace();
}
} /**
* Open the window.
*/
public void open()
{
Display display = Display.getDefault();
createContents();
shell.open();
shell.layout();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
} /**
* Create contents of the window.
*/
protected void createContents()
{
shell = new Shell();
shell.setSize(450, 300);
shell.setText("SWT Application");
Image image = new Image(shell.getDisplay(), getClass().getResourceAsStream("eclipse48.png"));
shell.setBackgroundImage(image);
}}需要一个图片eclipse48.png
放在类的文件夹下面
import org.jdesktop.swingx.JXPanel;JXPanel container = new JXPanel();
container.setBackgroundPainter(new ImagePainter(ImageIO.read(....)));
container.add(...);frame.setContentPane(contaienr);
使用了SwingX库。