import java.text.SimpleDateFormat;import java.util.Date;import java.util.Scanner;class Test { public static void main(String[] args) { Scanner in = new Scanner(System.in); int choice;//用户的选择 DVDManage dm = new
package chapter5; import java.util.*; public class MiniDVD { public static void main(String[] args){ //扫描器 Scanner input = new Scanner(System.in); //重要参数及初始化 //Create four arrays with length of 7 //定义四个数组长度为7 int date[] = new int[7]; //borrow date in
import java.util.*;import java.text.*;class DVDSet{ String[] name = new String[50]; //名字 int[] state = new int[50]; //状态 1为可借,0为借出 String[] date = new String[50]; //借出日期 int[] count = new int[50]; //排行榜}class DVDMgr{ // 创
//网格布局管理器 import java.awt.*; import javax.swing.*; public class Jiemian3 extends JFrame{ //定义组件 JButton[] an = {null,null,null,null,null,null,null,null}; public static void main(String[] args){ //运行本类的构造方法 Jiemian3 jiemian = new Jiemian3(); } public
在GridBagLayout布局管理器中,一个组件可以跨越一个或多个网格,并可以设置各网格的大小互不相关. import java.awt.*; public class GridBagTest { private Frame f = new Frame("测试窗口"); private GridBagLayout gb = new GridBagLayout(); private GridBagConstraints gbc = new GridBagConstraints(); p
GridLayout布局管理器将容器分割成纵横线分格的网格,每个网格所占的区域大小相同. import java.awt.*; public class GridLayoutTest { public static void main(String[] args) { var f = new Frame("计算器"); f.setLayout(new BorderLayout()); var p1 = new Panel(); p1.add()); f.add(p1, BorderLa
public class GirdLayoutPosition extends JFrame{ public GirdLayoutPosition() { Container c=getContentPane();//一定要这样表示; setLayout(new GridLayout(7, 3, 5, 5)); for (int i = 0; i < 20; i++) { c.add(new JButton("Bu