package chat1;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class chat1{
public chat1(){
JFrame jf = new JFrame();
jf.setLayout(null);
jf.setSize(280,560);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JButton logn = new JButton("logn");
JButton out = new JButton("out");
logn.setBounds(170,480,80,30); // 参数分别为坐标,控件的规格
out.setBounds(15,480,80,30);
jf.add(logn);
jf.add(out);
jf.setVisible(true);
} public static void main(String[] args){ chat1 frame = new chat1(); } }

java  随意控制控件的位置-LMLPHP

04-29 01:32