
import java.awt.Frame
import java.awt.Panel
public class T {
public static void main(String[] args) {
new Frame1("Test Panel", 100, 100, 200, 200, Color.BLUE, Color.RED)
}
}
class Frame1 extends Frame {
private Panel p
Frame1(String s, int x, int y, int w, int h, Color c1, Color c2) {
super(s)
setLayout(null)
p = new Panel(null)
this.setBackground(c1)
this.setBounds(x, y, w, h)
p.setBackground(c2)
p.setBounds(w / 4, h / 4, 2 / w, 2 / h)
add(p)
this.setVisible(true)
}
}
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)