皮皮网
皮皮网
Copyright源码

【破解网站源码查看】【北斗 c源码】【竞价手机源码】猜喜欢源码_猜你喜欢代码

时间:2024-12-26 15:48:35 分类:探索 编辑:占卜网页源码
1.急求猜数字小游戏代码

猜喜欢源码_猜你喜欢代码

急求猜数字小游戏代码

       本人是猜喜JAVA语言爱好者,赠送你我的欢源破解网站源码查看源码。

       还是码猜北斗 c源码学学JAVA吧。

       import java.awt.*;

       import javax.swing.*;

       import java.awt.event.*;

       import javax.swing.event.*;

       class Guess extends JFrame implements ActionListener{

        int rand;

        JLabel label = new JLabel("Enter whole number:");

        JLabel label_image = new JLabel( new ImageIcon(".gif"));

        JTextField textfield = new JTextField();

        JButton button_guess = new JButton("Guess");

        JButton button_again = new JButton("Once again");

        JPanel panel_north = new JPanel();

        JPanel panel_center = new JPanel();

        JPanel panel_north_middle = new JPanel();

        TextArea textarea = new TextArea(null,喜欢竞价手机源码,,TextArea.SCROLLBARS_BOTH);

        //---------------------------------------

        Guess(){

        this.setSize(,);

        this.rand=(int)(Math.random()*);

        Container face =this.getContentPane();

        face.add(panel_north,"North");

        face.add(panel_center);

        panel_north.setLayout(new GridLayout(1,3,3,1));

        panel_north.add(label);

        panel_north.add(textfield);

        panel_north.add(button_guess);

        panel_north.add(button_again);

        panel_center.add(textarea);

        panel_center.add(label_image);

        button_guess.addActionListener(this);

        button_again.addActionListener(this);

        this.setVisible(true);

        }

        //---------------------------------------------

        public void actionPerformed(ActionEvent w){

        try{

        if(w.getSource()==button_guess){

        String s=textfield.getText();

        int x=Integer.parseInt(s);

        if(x==rand){

        textarea.append("Congratulate!\n");

        }

        else if(x>rand){

        textarea.append("The number on the height side!\n");

        }

        else if(x<rand){

        textarea.append("The number on the low side!\n");

        }

        textfield.setText("");

        textfield.requestFocusInWindow();

        }

        else if(w.getSource()==button_again){

        textarea.setText("");

        rand=(int)(Math.random()*);

        }

        }catch(Exception e){ }

        }

       //-----------------------------------------------------------

        public static void main(String arg[]){

        new Guess().setDefaultLookAndFeelDecorated(true);

        }

        }

本文地址:http://581.net.cn/html/21f249497484.html

copyright © 2016 powered by 皮皮网   sitemap