import java.awt.*;
import javax.swing.*;public class FrameTest extends JFrame{
private Panel pnl = new Panel();
private GridLayout lo = new GridLayout(2,2);
FrameTest(String title){
super(title);
pnl.setLayout(lo);
int i;
for(i=0;i<4;i++)
pnl.add(new Button("OK"));
this.getContentPane().add(pnl);
this.setSize(100,150);
this.setVisible(true);
this.show();
}
public static void main(String[] args){
new FrameTest("It is a Frame Test.");
}
}
FrameTest.class在系统classpath路径中的话没问题
import javax.swing.*;public class FrameTest extends JFrame{
private Panel pnl = new Panel();
private GridLayout lo = new GridLayout(2,2);
FrameTest(String title){
super(title);
pnl.setLayout(lo);
int i;
for(i=0;i<4;i++)
pnl.add(new Button("OK"));
this.getContentPane().add(pnl);
this.setSize(100,150);
this.setVisible(true);
this.show();
}
public static void main(String[] args){
new FrameTest("It is a Frame Test.");
}
}
FrameTest.class在系统classpath路径中的话没问题
解决方案 »
- 矩阵
- 求个网站地址----哎,分越来越少了...5555 .. ;(
- applet
- 如何在一个窗口大小变化的时候得到通知?
- 请问:用JOptionPane.showInputDialog等生成的对话框的字体大小和颜色等要怎么改变?
- C程序生成的struct文件JAVA怎么才能读出呢?
- 简单的问题
- 谁有jcreator和ultraedit的注册码? 或者是down它们无时间限制版本的地方啊!!!!!!!
- 如何import自己的package,用自己写的类 ?一定给分
- 在scroolBar中,我要设置其值的范围为 (0,1)可这样一来,我发现,更本不能改变其
- 困惑一整天了 ~~~~~~~ 求助~~~~~~~~
- 怎么调用某种类型文件,让其被默认的应用程序打开----着急!!!
calsspath: .;C:\jdk1.4\lib\tools.jar;C:\jdk1.4\lib\dt.jar;
我的Jdk1.4安装在C:\jdk1.4
import javax.swing.*;public class FrameTest extends JFrame{
private Panel pnl = new Panel();
private GridLayout lo = new GridLayout(2,2);
FrameTest(String title){
super(title);
pnl.setLayout(lo);
int i;
for(i=0;i<4;i++)
pnl.add(new Button("OK"));
//this.add(pnl);-----------this line wrong
this.getContentPane().add(pnl);
this.setSize(100,150);
this.setVisible(true);
this.show();
} public static void main(String[] args){
new FrameTest("It is a Frame Test.");
}
}
这样改试一下