عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 09-03-2011, 07:40 PM   #3

رهين لحظة

جامعي

 
تاريخ التسجيل: Aug 2010
التخصص: تقنية المعلومات
نوع الدراسة: إنتظام
المستوى: السابع
الجنس: ذكر
المشاركات: 95
افتراضي رد: مساعده في الجرافيكس

هذا كود بسيط سويته ع الطاير . مو البرنامج كامل .. لكن ان شاء الله انه يفيدك
سويت لك 2 تيكست فيلدز . واليوزر راح يدخل قيم .. واول ما يضغط على البوتوم
راح يطلع له القيم اللي دخلها في الآت بوت .
إنتي عدلي عليه وبتوصلين لحلك ان شاء الله .. :)
مع تمنيااتي لك بالتوفيق

كود PHP:
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package grahpics;
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.*;
/
 *
 * @
author IPM
 
*/
public class 
Main {

    /
     * @
param args the command line arguments
     
*/
      static 
JTextField t=new JTextField(5);
     static  
JTextField  t2=new JTextField(5);
    public static 
void main(String[] args) {
        {

            
JFrame a = new JFrame();
            
a.setLayout(null);

        
JLabel l=new JLabel("First Coor : ");
        
JLabel l2=new JLabel("   second Coor : ");
      
        
a.add(l);

         
Container content a.getContentPane();
         
content.setLayout(new FlowLayout());

        
a.add(t);
        
a.add(l2);
        
a.add(t2);
       

        
a.setSize(350400);

       
content.setBackground(Color.white);
       
    
      
JButton b0= new JButton("Draw");


      
ActionListener al = new ActionListener() {
   public 
void actionPerformed(ActionEvent e) {
            
String command e.getActionCommand();
            if(
command.equals("Draw")) {
              
System.out.print("You have pressed Drawing Button");
                      if(!
t.getText().equals("")){
        
int first_coor=Integer.valueOf(t.getText());
        
System.out.print("\nThe first Coor : "+first_coor);
        }
     
                if(!
t2.getText().equals("")){
              
int second_coor=Integer.valueOf(t2.getText());
              
System.out.print("\nThe second coor : "+second_coor);
        }

            }
          }
      };

       
content.add(b0);
        
b0.addActionListener(al);
    
b0.setActionCommand("Draw");


       
a.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
       
a.setVisible(true);

    }

}

اوه توي انتبه انك هلالية ^_^ .. بس مو مشكلة ان شاء الله بكرة نكسر روسكم :p

 


التعديل الأخير تم بواسطة رهين لحظة ; 09-03-2011 الساعة 07:47 PM.
رهين لحظة غير متواجد حالياً   رد مع اقتباس