




يالله هاذ برنامج لغة الجافا لتصميم واجهه بتجتوي على زر خروج بحيث بس تضغطوا عليه يخرج من الواجهه وزر draw rect ليرسم اكثر من مستطيل بشكل عشوائي في حال الضغط عليها وفي عندكوا خط زنخ بالرسمه كمان تم رسمه بأستعمال كود .. يالله عيشوا وشوفوا هالتخبيصقسما اشي متعب
كود:/**كود:* AWT Sample application ** @author * @version 1.00 09/01/05 */ import ****x.swing.*; import ****.awt.*; import ****.awt.event.ActionListener; import ****.util.EventListener; import ****.awt.event.*; class Bord extends Canvas{ public void paint(Graphics g){ g.drawLine(10,10,60,40);}public Bord(){ setSize(200,200); this.setBackground(Color.green); this.setForeground(Color.red);}public void drawRect(Rect r){ Graphics a=this.getGraphics(); a.setColor(r.getColor()); a.drawRect(r.x,r.y,r.w,r.h);}} class Rect{ public int x,y,w,h; private Color c; public void setX(int x){this.x=x;} public void setY(int y){this.y=y;} public void setW(int w){this.w=w;} public void setH(int h){this.h=h;} public void setRect(int x,int y,int w,int h){ setX(x); setY(y); setW(w); setH(h);}public Rect() {setRect(0,0,0,0); c=Color.black; } public Rect(int x,int y,int w,int h){ setRect(x,y,w,h); c=Color.black;}public void setColor(Color c){ this.c=c;}public Color getColor(){ return c; } }public class DrawDemo extends JFrame implements ActionListener {Bord bord; Rect r1; public static void main(String[] args) {DrawDemo app=new DrawDemo();app.setSize(500,400); app.setTitle("Draw Demo Application"); app.set********(200,100); app.setVisible(true); app.setDefaultCloseOperation(app.EXIT_ON_CLOSE);}public DrawDemo(){ Container c; c=this.get*******Pane(); JPanel pn=new JPanel(new FlowLayout()); JPanel ps=new JPanel(new FlowLayout()); JButton bDraw=new JButton("Draw Rect"); JButton bExit=new JButton("EXIT"); c.add(pn,"North"); c.add(ps,"South"); ps.add(bExit); ps.add(bDraw); bDraw.addActionListener(this); bExit.addActionListener(this); bord=new Bord(); pn.add(bord);}public void actionPerformed(ActionEvent e){ int x,y,w,h; x=(int)(Math.random()*200); y=(int)(Math.random()*200); w=(int)(Math.random()*50); h=(int)(Math.random()*50); int r,g,b; r=(int)(Math.random()*256); g=(int)(Math.random()*256); b=(int)(Math.random()*256);r1=new Rect(x,y,w,h);r1.setColor(new Color(r,g,b) ); bord.drawRect(r1);//---exit---if(e.getActionCommand().equals("EXIT")) {System.exit(1); } } }
ههههههههه
كلهم بس شافوا الجافا هربوا
اما ناس![]()
الله بعين
شو بدنا نساوي![]()
"لا إله إلا أنت سبحانك إني كنت من الظالمين"
إذا قل ماء الوجه قل حيــــاؤه
ولا خير في وجه إذا قل ماؤه
****
حياءك فاحفظــه علـيـك وإنما
يدل على فعل الكريم حــيـاؤه
"لا إله إلا أنت سبحانك إني كنت من الظالمين"
إذا قل ماء الوجه قل حيــــاؤه
ولا خير في وجه إذا قل ماؤه
****
حياءك فاحفظــه علـيـك وإنما
يدل على فعل الكريم حــيـاؤه
"لا إله إلا أنت سبحانك إني كنت من الظالمين"
إذا قل ماء الوجه قل حيــــاؤه
ولا خير في وجه إذا قل ماؤه
****
حياءك فاحفظــه علـيـك وإنما
يدل على فعل الكريم حــيـاؤه
الذين يشاهدون الموضوع الآن: 28 (0 من الأعضاء و 28 زائر)
مواقع النشر (المفضلة)