Java Swing 技术解析与应用指南
/test.java
§§ 1000
+package javaswing;
+import java.awt.*;
+import javax.swing.*;
+public class test {
+ test(){
+ JFrame f= new JFrame();//creating instance of JFrame
+
+ JButton b=new JButton("click");//creating instance of JButton
+ b.setBounds(130,100,100, 40);//x axis, y axis, width, height
+
+ f.add(b);//adding button in JFrame f.setSize(400,500);//400 width and 500 height f.setLayout(null); //using no layout managers f.setVisible(true); //making the frame visible } public static void main(String[] args) { new test(); } }
免责声明:
以上内容除特别注明外均来源于网友提问,创作工场回答,未经许可,严谨转载。