import javax.swing.*;
import java.awt.Graphics;
public class wu extends JApplet {
String result;
public void init () {
int n = 5,
i = 7;
result = "the number is :"+ "\t"+i+
"\nthe last nuber is:\t"+n;
}
public void paint( Graphics g )
{
super.paint ( g );
g.drawString(result,35,35);
}
}
在下面这段里面用不了"\t".请高手支招,我用了1.5版本的也测试过,一个样,就是用不了,就更不用说1.4.2的了
import javax.swing.JOptionPane;
public class liFang
{
public static void main (String args [] )
{
String shu = JOptionPane.showInputDialog ( "请输入你想要循环的次数:"),
result = "原数"+"\t"+"平方"+"\t"+"立方"+"\n";
int i = Integer.parseInt ( shu ),
pingFang,
liFang;
for ( int j=1;j<=i;j++)
{
pingFang = j * j;
liFang = j * j * j;
result += j+"\t"+pingFang+"\t"+liFang+"\n";
}
JOptionPane.showMessageDialog ( null, result,"结果",JOptionPane.WARNING_MESSAGE);
System.exit(0);
}
}
[此贴子已经被作者于2006-8-18 12:58:16编辑过]