前辈,请帮个忙写一个设置界面背景的源代码,谢谢 前辈,请帮个忙写一个设置界面背景的源代码,谢谢!!! 解决方案 » 免费领取超大流量手机卡,每月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库。 char和int之间的转换 java对象克隆及内存布局的问题 求问一个让所有版本IE都识别的Applet 写法 SOAP消息中两个方法的区别 errors.add()的第一个参数的作用是什么啊?用来干什么的啊 命令行运行"java HelloWorld"出现异常? 怎样把jar包和WEB应用程序分开存放? java 中的timer控件问题 如何取得鼠标位置? 使用泛型打印输出任意类型的数组,为什么调用时有错误? 求解做一个瞄准器的窗口 为什么这样赋值就是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库。