Thursday, February 11, 2010

学校老师要求我用java编写一个借体育用具的软件

老师说,不用太复杂
就用学号记并且可以看得到借用具的日期和应还日期。。。。
==============================================
前提说明,为什么找我 - -
因为全校只有我会
高三的同学只会vb,而且是很烂的那种 = =
同时,我不是只会用电脑看戏的小菜~
----------------------------------------------------
源码:(未完成,谁会的话可以加一些^_^)

import java.lang.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Sample6
{
  public static void main(String args[])
  {
    Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
  
    int width=450;
    int height=280;
    int x = (screen.width-320)/2;
    int y = (screen.height-240)/2;
  
    JFrame f = new JFrame();
    f.getContentPane().setLayout(null);
    f.setBounds(x,y,width,height);
  
    f.addWindowListener
    (
      new WindowAdapter()
      {
        public void windowClosing(WindowEvent e)
        {
          System.exit(0);
        }
      }
    );
  
    JLabel l1 = new JLabel("Student ID              : ");
    l1.setBounds(25,30,150,25);
  
    JLabel l2 = new JLabel("class                   : ");
    l2.setBounds(25,60,150,25);

    JLabel l3 = new JLabel("borrow                  : ");
    l3.setBounds(25,90,150,25);

    JLabel l4 = new JLabel("Borrow Date             : ");
    l4.setBounds(25,120,150,25);
      
    JLabel l5 = new JLabel("Should give the date of : ");
    l5.setBounds(25,150,150,25);

    JTextField t1 = new JTextField();
    t1.setBounds(170,30,80,25);

    JTextField t2 = new JTextField();
    t2.setBounds(170,60,80,25);
  
    JTextField t3 = new JTextField();
    t3.setBounds(170,90,80,25);

    JTextField t4 = new JTextField("dd/mm/yyyy");
    t4.setBounds(170,120,80,25);

    JTextField t5 = new JTextField("dd/mm/yyyy");
    t5.setBounds(170,150,80,25);

    JButton b1 = new JButton("Add");
    b1.setBounds(25,180,80,25);

    JButton b2 = new JButton("delete");
    b2.setBounds(170,180,80,25);

    f.getContentPane().add(b2);
    f.getContentPane().add(b1);
    f.getContentPane().add(t5);
    f.getContentPane().add(t4);
    f.getContentPane().add(t3);
    f.getContentPane().add(t2);
    f.getContentPane().add(t1);
    f.getContentPane().add(l5);
    f.getContentPane().add(l4);
    f.getContentPane().add(l3);
    f.getContentPane().add(l1);
    f.getContentPane().add(l2);
  
    f.show();
  }
}
========================================
目前的图片:












=============================================
是想要加一个list...可是~
javax的list中无法分组(也有可能是我差,想不出)
所以就停在这里
还在想概念中
=============================================
以我的想法:
设定javax.list的vector为x变数
在将x设定成textfield 的数值...
可是问题就在分组上
谁会就给个概念~

No comments:

Post a Comment

 

Fang's Blog Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates