清风识之
春芽
共回答了18个问题采纳率:83.3% 举报
public class TestSwing extends JFrame {
public TestSwing() {
setTitle("test--jpanel");
setSize(400,300);
JPanel p = new JPanel();
p.setLayout(null);
p.setBounds(10, 10, 380, 280);
p.setBackground(Color.RED);
JPanel pp = new JPanel();
pp.setBounds(105, 70, 190, 140);
pp.setBackground(Color.BLUE);
p.add(pp);
add(p);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String[] args) {
new TestSwing();
}
}
1年前
9