能不能给JAVA刚学不久的一个小项目?经典一些的好。
可否给出一个java基础项目一试?

解决方案 »

  1.   

    我一开始写的是一个记事本的程序,支持多文档打开,网络传输当前编辑的文本,发送信息给某人等功能,突破Windows自带记事本重做和撤销只能一次的限制等等功能.
    当然有些功能好像没有什么必要,不过我们目的是锻炼一下,所以随便添加一些功能还是可以的.
      

  2.   

    做一个连连看,或者对对碰的单机版,或者魂斗罗
    过瘾啊,做游戏开发有意思,数据库最无聊了,NND
      

  3.   

    我们现在做记事本和socket聊天程序!!马上又做一个海鲜超市关系系统
      

  4.   

    虽然简单了点/*******************************************************************************
     * 项目:计算器 语言:Java 工具:JCreator 作者: QQ403170387 时间:2005.10.10
     ******************************************************************************/import java.awt.event.*;
    import java.awt.*;
    import javax.swing.*;/* 类Calculator为主类实现main方法 */
    class Calculator extends JFrame 
    {
        public Calculator() 
        {
            super("计算器");
            setSize(300, 240);
            Container contentPane = getContentPane();
            contentPane.add(new CalculatorPanel());
        }    public static void main(String[] args) 
        {
            Calculator cal = new Calculator();
            cal.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            cal.setVisible(true);
        }
    }
    //---------------------------------class CalculatorPanel extends JPanel 
    {
        
        private static boolean descv = true;    private static String d;    private static double a, b, c;
        private static boolean isfir=true;
        
        private JLabel displayLabel = new JLabel("0");    private JPanel northPanel = new JPanel();    private JPanel centerPanel = new JPanel();
     
        private JButton backButton= new JButton("BackSpace");     public CalculatorPanel() {
            
            setLayout(new BorderLayout());
            add(northPanel, BorderLayout.NORTH);
            add(centerPanel);        northPanel.setLayout(new BorderLayout());
            northPanel.add(displayLabel);
            northPanel.add(backButton, BorderLayout.EAST);
            centerPanel.setLayout(new GridLayout(4, 4, 3, 3));        InsertAction in = new InsertAction();
            CommandAction co = new CommandAction();
            backButton.addActionListener(in);        final String s[] = { "7", "8", "9", "/", "4", "5", "6", "*", "1", "2", "3",
                    "-", "0", ".", "=", "+" };
            final ActionListener[] a = { in, in, in, co, in, in, in, co, in, in, in, co,
                    in, in, co, co };
            for (int count = 0; count < a.length; count++)
                addButton(s[count], a[count]);    }    private void addButton(String lable, ActionListener listener) 
        {
            JButton button = new JButton(lable);
            button.addActionListener(listener);
            centerPanel.add(button);
        }    
        private class InsertAction implements ActionListener
         {
            public void actionPerformed(ActionEvent e)
             {
                String str = e.getActionCommand();
                String a = displayLabel.getText().trim();            if (str.equals("BackSpace"))
                {
                    String aa = a.substring(0,a.length()-1);                displayLabel.setText(aa);
                    if (aa.indexOf('.') != -1)
                        descv = false;
                    else
                        descv = true;
                }
                else if (str.equals(".")) 
                {                if (a.equals("0")) 
                    {
                        displayLabel.setText("0.");
                        descv = false;
                    } 
                    else if (descv == true) 
                    {
                        displayLabel.setText(displayLabel.getText() + ".");
                        descv = false;
                    }            } else if (a.equals("0")) {
                    displayLabel.setText(str);
                } else {
                    displayLabel.setText(displayLabel.getText() + str);
                }
            }       
        }  
        private class CommandAction implements ActionListener 
        {
        boolean booladd = true, booldele = true, boolmult = true,
                    booldivi = true;
    boolean[] bool = { booladd, booldele, boolmult, booldivi };        public void actionPerformed(ActionEvent e) 
            {            String[] s1 = { "+", "-", "*", "/" };            Add add = new Add();
                Dele dele = new Dele();
                Mult mult = new Mult();
                Divi divi = new Divi();
                Calculate[] calculate = { add, dele, mult, divi };            for (int count = 0; count < s1.length; count++) 
                {                if (e.getActionCommand().equals(s1[count])) 
                    {
    isfir=true;
                        d = e.getActionCommand();
                        a = Double.parseDouble(displayLabel.getText());
                        displayLabel.setText("");                    if (displayLabel.getText().indexOf('.') != -1)
                            descv = false;
                        else
                            descv = true;
                    }                if (e.getActionCommand().equals("=") && s1[count].equals(d)) 
                    {
                        if ( isfir == true)
                        {
    b = Double.parseDouble(displayLabel.getText().trim());
    isfir=false;
    }
                        if (bool[count] == true) 
                        {
                            c = calculate[count].calc(a, b);
                            bool[count] = false;
    } else {
                            c = calculate[count].calc(c, b);
    }                    if ((int) c == c)
                            displayLabel.setText("" + (int) c);
                        else
                            displayLabel.setText("" + c);
                    }
                }            if (displayLabel.getText().indexOf('.') != -1)
                    descv = false;
                else
                    descv = true;        }
        }
    }abstract class Calculate {
        abstract double calc(double d1, double d2);
    }class Add extends Calculate {
        double calc(double d1, double d2) {
            return d1 + d2;
        }
    }class Dele extends Calculate {
        double calc(double d1, double d2) {
            return d1 - d2;
        }
    }class Mult extends Calculate {
        double calc(double d1, double d2) {
            return d1 * d2;
        }
    }class Divi extends Calculate {
        double calc(double d1, double d2) {
            return d1 / d2;
        }
    }
    //来自QQ:403170387的空间(QQ-ZONE)