应该是IE的支持问题,就是说你的程序里边用了jdk1.2以上才有的函数。
解决方案 »
- org.hibernate.exception.SQLGrammarException: could not delete
- 接口回调
- java 如何将多个文件打包成一个zip ?
- java实现的FtpClient , 下载到本地后,文件名正确但文件大小为0
- 求救!TextArea 中的文本控制问题
- aglet server的问题,高分
- 如何改变Jpanel的颜色?
- 画图的问题,清高手指点
- 一个关于滚动条的小程序,还有一个错误,麻烦那位高手帮我看看,谢谢
- 急!急!急!新手请教:如何用drawPolygon画个不自动关闭的多边形,即折线(不用drawLine)
- skyyoung:刚才个问题还没解决(requestFocus)
- 关于classpath设置的问题
我的代码:
package testapp;import java.awt.*;
import java.awt.event.*;
import java.applet.*;
public class Applet1 extends Applet { public void paint(Graphics g)
{
g.drawString("Hell",50,50);
}
}
否则就在该Html文件目录下建立一个testapp目录,再把class文件放到改目录下,applet参数做适当修改
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import javax.swing.*;
import com.borland.jbcl.layout.*;public class fuNum extends Applet {
boolean isStandalone = false;
XYLayout xYLayout1 = new XYLayout();
JButton jButton1 = new JButton();
JLabel jLabel1 = new JLabel();
JLabel jLabel2 = new JLabel();
JLabel jLabel3 = new JLabel();
JLabel jLabel4 = new JLabel();
JLabel jLabel5 = new JLabel();
JLabel jLabel6 = new JLabel();
JLabel jLabel7 = new JLabel();
JLabel jLabel8 = new JLabel();
JLabel jLabel9 = new JLabel();
JLabel jLabel10 = new JLabel();
JLabel jLabel11 = new JLabel();
JLabel jLabel12 = new JLabel();
/**Get a parameter value*/
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
} /**Construct the applet*/
public fuNum() {
}
/**Initialize the applet*/
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/
private void jbInit() throws Exception {
this.setBackground(new Color(138, 184, 223));
this.setEnabled(true);
this.setForeground(Color.lightGray);
this.setLayout(xYLayout1);
jButton1.setText("开始选号");
jButton1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(ActionEvent e) {
jButton1_actionPerformed(e);
}
});
jLabel1.setForeground(Color.red);
jLabel1.setText("第一组号码");
xYLayout1.setWidth(274);
xYLayout1.setHeight(300);
jLabel2.setForeground(Color.red);
jLabel2.setText("第二组号码");
jLabel3.setForeground(Color.red);
jLabel3.setText("第三组号码");
jLabel4.setForeground(Color.red);
jLabel4.setText("第四组号码");
jLabel5.setForeground(Color.red);
jLabel5.setText("第五组号码"); jLabel6.setForeground(Color.yellow);
jLabel6.setText("XX XX XX XX XX XX XX"); jLabel7.setForeground(Color.yellow);
jLabel7.setText("XX XX XX XX XX XX XX"); jLabel8.setForeground(Color.yellow);
jLabel8.setText("XX XX XX XX XX XX XX"); jLabel9.setForeground(Color.yellow);
jLabel9.setText("XX XX XX XX XX XX XX"); jLabel10.setForeground(Color.yellow);
jLabel10.setText("XX XX XX XX XX XX XX");
jLabel11.setText("陕西风采福利彩票选号器");
jLabel12.setForeground(Color.white);
jLabel12.setText("By oldseven");
this.add(jButton1, new XYConstraints(88, 233, 119, 25));
this.add(jLabel2, new XYConstraints(10, 71, 76, 16));
this.add(jLabel3, new XYConstraints(9, 99, 72, 19));
this.add(jLabel4, new XYConstraints(9, 130, 70, 14));
this.add(jLabel5, new XYConstraints(10, 158, 69, 17));
this.add(jLabel1, new XYConstraints(9, 37, 74, 20));
this.add(jLabel6, new XYConstraints(94, 38, 216, 19));
this.add(jLabel10, new XYConstraints(92, 158, 217, -1));
this.add(jLabel9, new XYConstraints(92, 129, 218, 16));
this.add(jLabel8, new XYConstraints(92, 97, 220, 17));
this.add(jLabel7, new XYConstraints(93, 67, 219, 19));
this.add(jLabel11, new XYConstraints(72, 13, 142, 15));
this.add(jLabel12, new XYConstraints(201, 199, 89, 17));
}
/**Get Applet information*/
public String getAppletInfo() {
return "Applet Information";
}
/**Get parameter info*/
public String[][] getParameterInfo() {
return null;
} void jButton1_actionPerformed(ActionEvent e) {
RandomHaoMa HMGet=new RandomHaoMa();
int[][] HM =new int[5][7];
String Temps;
int i;
Temps="";
HM=HMGet.GetNumber();
for(i=0;i<7;i++)
{
Temps =Temps+" "+String.valueOf(HM[0][i]);
}
jLabel6.setText(Temps);
Temps="";
for(i=0;i<7;i++)
{
Temps =Temps+" "+String.valueOf(HM[1][i]);
}
jLabel7.setText(Temps);
Temps="";
for(i=0;i<7;i++)
{
Temps =Temps+" "+String.valueOf(HM[2][i]);
}
jLabel8.setText(Temps);
Temps="";
for(i=0;i<7;i++)
{
Temps =Temps+" "+String.valueOf(HM[3][i]);
}
jLabel9.setText(Temps);
Temps="";
for(i=0;i<7;i++)
{
Temps =Temps+" "+String.valueOf(HM[4][i]);
}
jLabel10.setText(Temps);
}
}
class Rom
{
public int RandomInt(int BeginNum,int EndNum)
{
double Dou;
int Rom1; if (BeginNum==50){
Rom1 = 4;
}
Dou =Math.random();
Rom1 =(int)(Dou*(EndNum-BeginNum))+BeginNum;
return Rom1;
}
}
class RandomHaoMa {
public static final int GroupNumber = 5;
public static final int HaoMaNumber = 7;
public static final int BeginNum = 1;
public static final int EndNum = 33; public RandomHaoMa() {
int i,j,k;
int TempRom;
Rom rom = new Rom(); for(i=0;i<GroupNumber;i++)
{
k=0;
while(k<7)
{
boolean FindNum;
TempRom = rom.RandomInt(BeginNum,EndNum); FindNum = false;
for(j=0;j<k;j++)
{
if (TempRom==HaoMa[i][j])
{
FindNum = true;
break;
}
}
if(!FindNum)
{
HaoMa[i][k] = TempRom;
k++;
}
} } // end i //排序
for(i=0;i<GroupNumber;i++)
{
sort(HaoMa[i]);
} } //对一个整形数组进行排序
public int[] sort(int[] RomArray)
{
int i,j;
for(i=0;i<6;i++)
{
for(j=i+1;j<7;j++)
{
if(RomArray[i]>RomArray[j])
{
int t = RomArray[i];
RomArray[i] = RomArray[j];
RomArray[j] = t;
} }
} return RomArray;
} public int[][] GetNumber(){
return HaoMa;
} private int[][] HaoMa = new int[GroupNumber][HaoMaNumber];
}
而且,在JBuilder5环境下能正常显示。
所有SWING都至少需要支持jdk1.2的JRE来解释运行