الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

ارجووووووووووو المساعدة في لغة Java Jbolder2006 حصراً

بدأه حياة كلبي في 19 مايو 2008 · 2 رد · 687 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

اخواني الاعزام

السلام عليكم ورحمة الله وبركاته

رجاءاً اطلب منكم طلب مستعجل طبعاً للي يعرف يشتغل على لغة البرمجة جافا وحصراً على (JBolder2006)للعلم اني طالب هندسة حاسبات مرحلة ثانية واخذنه هذي اللغة بكورس واحد وكانت عندي ضروووووف صعبة مما ادى الى عدم الاهتمام بها .....والدكتور طلب من عندي ان اقدم تقرير نهائي عن اللغة وهو عبارة عن لعبة اشرح لكم محتواها

طبعاً البرامج هو لعبة وهذي اللي هي :

اندخل باسوورد من 4 او 5 خانات ويقوم واحد ثاني بتوقع الباسوورد فأن ادخلهُ خطأ لاكثر من 10 مرات ينهي البرانامج ويطبع الباسوورد ان ادخلهُ صحيح طبعاً نستخدم الارقام (من 1 الى 9) والاحرف (z , m , o) فقط

ارجو المساعدة باقرب وقت واذا ممكن اريد كوووووووود اللعبة

احمد العبيدي

ahmed_baldawi2006@yahoo.com

#2

هيدا البرنامج متل ما بدك

وعلى ال

Jbuilder 2006

أرجو ان يكون فيه الفائدة

 

/**
 * <p>Title: </p>
 *
 * <p>Description: </p>
 *
 * <p>Copyright: Copyright © 2008</p>
 *
 * <p>Company: </p>
 *
 * @author not attributable
 * @version 1.0
 */

import javax.swing.JFrame;
import javax.swing.JPasswordField;
import java.awt.Rectangle;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JButton;
import javax.swing.JTextField;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class Password extends JFrame{

    public int tryTimes = 0;
    public Password() {
        super("Password Game");
        try {
            jbInit();
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        setSize(400,400);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }

    private void jbInit() throws Exception {
        this.getContentPane().setLayout(null);
        orginalPassword.setBounds(new Rectangle(17, 39, 124, 28));
        jLabel1.setText("Enter your orginal Password:");
        jLabel1.setBounds(new Rectangle(17, 11, 309, 22));
        jLabel2.setText("Try to guess my password:");
        jLabel2.setBounds(new Rectangle(17, 122, 273, 19));
        tryPassword.setEnabled(false);
        tryPassword.setBounds(new Rectangle(17, 162, 202, 27));
        tryButton.setBounds(new Rectangle(253, 161, 99, 27));
        tryButton.setEnabled(false);
        tryButton.setText("Try");
        tryButton.addActionListener(new Password_tryButton_actionAdapter(this));
        jLabel3.setText("Try Numbers:");
        jLabel3.setBounds(new Rectangle(17, 215, 127, 24));
        times.setText("0");
        times.setBounds(new Rectangle(205, 214, 87, 25));
        submitButton.addActionListener(new Password_submitButton_actionAdapter(this));
        this.getContentPane().add(jLabel1);
        submitButton.setBounds(new Rectangle(192, 39, 106, 26));
        submitButton.setText("Ok");
        this.getContentPane().add(orginalPassword);
        this.getContentPane().add(submitButton);
        this.getContentPane().add(jLabel2);
        this.getContentPane().add(tryPassword);
        this.getContentPane().add(tryButton);
        this.getContentPane().add(jLabel3);
        this.getContentPane().add(times);

    }

    JPasswordField orginalPassword = new JPasswordField(5);
    JLabel jLabel1 = new JLabel();
    JButton submitButton = new JButton();
    JLabel jLabel2 = new JLabel();
    JTextField tryPassword = new JTextField();
    JButton tryButton = new JButton();
    JLabel jLabel3 = new JLabel();
    JLabel times = new JLabel();

    public void submitButton_actionPerformed(ActionEvent e) {
        if(orginalPassword.getPassword().length == 0 || orginalPassword.getPassword().length > 5){
            JOptionPane.showMessageDialog(this,
                    "Please enter Password from 5 letter at most");
            return;
        }
        for(int i=0;i<orginalPassword.getPassword().length; i++){
            if (orginalPassword.getPassword() > '0' &&
                orginalPassword.getPassword() <= '9')
                continue;
            if (orginalPassword.getPassword() == 'o' ||
                orginalPassword.getPassword() == 'm' ||
                orginalPassword.getPassword() == 'z')
                continue;
            JOptionPane.showMessageDialog(this, "Please Password must contain just number from 1 to 9\n" +
                    "letters 'o', 'm' or 'z'");
            return;
        }
        submitButton.setEnabled(false);
        orginalPassword.setEnabled(false);
        tryButton.setEnabled(true);
        tryPassword.setEnabled(true);
    }

    public static void main(String [] arg){
        Password pass = new Password();
    }

    public void checkTimes(){
        if(tryTimes >= 10){
            JOptionPane.showMessageDialog(this,
                                          "You failed to guess the password from 10 try" + 
                    "\nPlay again");
            submitButton.setEnabled(true);
            orginalPassword.setEnabled(true);
            tryButton.setEnabled(false);
            tryPassword.setEnabled(false);
            tryTimes = 0;
        }
        times.setText("" + tryTimes);
    }

    public void tryButton_actionPerformed(ActionEvent e) {
        if(tryPassword.getText().length() == 0 || tryPassword.getText().length() > 5){
            JOptionPane.showMessageDialog(this,
                                          "Password from 5 letter don't lose your try");
            tryTimes++;
            checkTimes();
            return;
        }
        for (int i = 0; i < tryPassword.getText().length(); i++) {
            if (tryPassword.getText().charAt(i) > '0' &&
                tryPassword.getText().charAt(i) <= '9')
                continue;
            if (tryPassword.getText().charAt(i) == 'o' ||
                tryPassword.getText().charAt(i) == 'm' ||
                tryPassword.getText().charAt(i) == 'z')
                continue;
            JOptionPane.showMessageDialog(this,
                                          "Password contain just number from 1 to 9\n" +
                                          "letters 'o', 'm' or 'z'" +
                                          "you lose try");
            tryTimes++;
            checkTimes();
            return;
        }
        for (int i = 0; i < tryPassword.getText().length(); i++) {
            if( i > orginalPassword.getPassword().length){
                JOptionPane.showMessageDialog(this,
                                              "another failed try");
                tryTimes++;
                checkTimes();
                return;
            }
            if (tryPassword.getText().charAt(i) != orginalPassword.getPassword()){
                JOptionPane.showMessageDialog(this,
                                              "another failed try");
                tryTimes++;
                checkTimes();
                return;
            }
        }
        JOptionPane.showMessageDialog(this,
                                      "congratulation!!! you have success try and the password is:" +
                "\n" + tryPassword.getText());
        JOptionPane.showMessageDialog(this,
                                      "Play again");
        submitButton.setEnabled(true);
        orginalPassword.setEnabled(true);
        tryButton.setEnabled(false);
        tryPassword.setEnabled(false);
        tryTimes = 0;
        times.setText("" + tryTimes);
    }
}


class Password_tryButton_actionAdapter implements ActionListener {
    private Password adaptee;
    Password_tryButton_actionAdapter(Password adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.tryButton_actionPerformed(e);
    }
}


class Password_submitButton_actionAdapter implements ActionListener {
    private Password adaptee;
    Password_submitButton_actionAdapter(Password adaptee) {
        this.adaptee = adaptee;
    }

    public void actionPerformed(ActionEvent e) {
        adaptee.submitButton_actionPerformed(e);
    }
}

ready to do full students projects

digitalscenter@hotmail.com

+966530357742

#3

تسلم اخوية العزيز والله ماقصرت وتعبتك هواية تسلم مرة اخرى وعاجز على الكلام سويت عليه فضل ما ينسي ابد والله يسلمووووووووووو

بس بعد ما جربته اتمنى ان تكون انت مجربه

مواضيع مشابهة