السلام عليكم ورحمة الله وبركاته
عندي مسألة بالجافا بشرح لكم شو المطلوب
هي عبارة عن رسم بال Applet
في البداية نطلب من ال user
يدخل رقمين الرقم الاول (نقول للuser كم خط افقي تبغي ترسم)
والرقم الثاني (نقول للuser كم خط رأسي تبغي ترسم)
مثلا اذا دخل ال ...................... user
5
والرقم الثاني 3
بتكون الرسمة عبارة عن 5 خطوط افقية و3 خطوط رأسية
انا بديت بالحل بس
import java.awt.Graphics;
import javax.swing.JApplet;
import javax.swing.JOptionPane;
public class bou extends JApplet {
public void init(){
int a,b;
String a1,b1;
a1= JOptionPane.showInputDialog("how many horizontal cells the user wants on the drawing area") ;
b1= JOptionPane.showInputDialog("how many vertical cells the user wants on the drawing area") ;
a=Integer.parseInt(a1) ;
b=Integer.parseInt(b1) ;
}
public void paint (Graphics g){
super.paint(g);
init();
for(int i=0;i<a;i++){
g.drawLine(15,10*(10*i),70,10*(10*i)) ;
}
for(int i=0;i<b;i++){
g.drawLine((20*i),6,(20*i),90);
}
}
}
ما اعرف اذا كنت بديت صح ولا لا