当前位置: 技术问答>java相关
我照着书学Jbuilder6,可是一样的语句就是有错,那位可以帮我看看
来源: 互联网 发布时间:2015-08-10
本文导语: Designer错误是 Failed to create live value from screenSize.width in screenSize.width/2 Failed to create live value from labelSize.width in labelSize.width/2 等 编译时java.lang.NoSuchMethodError: main Exception in thread "main" . . . 程序...
Designer错误是
Failed to create live value from screenSize.width in screenSize.width/2
Failed to create live value from labelSize.width in labelSize.width/2 等
编译时java.lang.NoSuchMethodError: main
Exception in thread "main"
.
.
. 程序如下:
package my_java1;
import java.lang.IllegalArgumentException;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
*
*
*
*
* @author unascribed
* @version 1.0
*/
public class WelcomeWindow extends JWindow {
BorderLayout borderLayout1 = new BorderLayout();
JLabel jLabel1 = new JLabel();
public WelcomeWindow() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[]args){
WelcomeWindow welcomeWindow1=new WelcomeWindow();
welcomeWindow1.show();
}
private void jbInit() throws Exception {
jLabel1.setIcon(new ImageIcon(new java.net.URL("file:///D:/MYPROJECTS/my_java1/pic68.JPG")));
this.getContentPane().setLayout(borderLayout1);
this.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(MouseEvent e) {
this_mousePressed(e);
}
});
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = jLabel1.getPreferredSize();
setLocation(screenSize.width/2 - labelSize.width/2,
screenSize.height/2 - labelSize.height/2);
setVisible(true);
this.getContentPane().add(jLabel1, BorderLayout.SOUTH);
}
void this_mousePressed(MouseEvent e) {
setVisible(false);
System.exit(0);
}
}
Failed to create live value from screenSize.width in screenSize.width/2
Failed to create live value from labelSize.width in labelSize.width/2 等
编译时java.lang.NoSuchMethodError: main
Exception in thread "main"
.
.
. 程序如下:
package my_java1;
import java.lang.IllegalArgumentException;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
/**
*
Title: Logon Map
*
Description:
*
Copyright: Copyright (c) 2002
*
Company: NERV
* @author unascribed
* @version 1.0
*/
public class WelcomeWindow extends JWindow {
BorderLayout borderLayout1 = new BorderLayout();
JLabel jLabel1 = new JLabel();
public WelcomeWindow() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
public static void main(String[]args){
WelcomeWindow welcomeWindow1=new WelcomeWindow();
welcomeWindow1.show();
}
private void jbInit() throws Exception {
jLabel1.setIcon(new ImageIcon(new java.net.URL("file:///D:/MYPROJECTS/my_java1/pic68.JPG")));
this.getContentPane().setLayout(borderLayout1);
this.addMouseListener(new java.awt.event.MouseAdapter() {
public void mousePressed(MouseEvent e) {
this_mousePressed(e);
}
});
pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
Dimension labelSize = jLabel1.getPreferredSize();
setLocation(screenSize.width/2 - labelSize.width/2,
screenSize.height/2 - labelSize.height/2);
setVisible(true);
this.getContentPane().add(jLabel1, BorderLayout.SOUTH);
}
void this_mousePressed(MouseEvent e) {
setVisible(false);
System.exit(0);
}
}
|
先确定你的文件名,和类名是不是一样。
是不是WelcomeWindow.java
然后再看看你的路径设的对不对,一搬就这样了
是不是WelcomeWindow.java
然后再看看你的路径设的对不对,一搬就这样了
|
I must comment the "package ..." line at ahead.
Because this is a applications, so you needn't put the package char.
Because this is a applications, so you needn't put the package char.
|
Designer的错误不要去理它,只要编译和运行能通过就行。
除了上面各位说的,你看看是不是这个写错了:
public static void main(String[]args){
- //这里要有空格的。hoho
除了上面各位说的,你看看是不是这个写错了:
public static void main(String[]args){
- //这里要有空格的。hoho
|
书上经常会有很多错误的,不要盲目相信书本。
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。