السلام عليكــم ورحمـة الله وبركاتــه ،،
كيف حالك إن شاء الله دائمــاً بخير ؟
أود سؤالكم كيف أرسم السهم ـــــــــــــــــــــــــــــــــــــــــــــــــــ>ـ
ب java
تحياتي وودي
السلام عليكــم ورحمـة الله وبركاتــه ،،
كيف حالك إن شاء الله دائمــاً بخير ؟
أود سؤالكم كيف أرسم السهم ـــــــــــــــــــــــــــــــــــــــــــــــــــ>ـ
ب java
تحياتي وودي
السلام عليكــم ورحمـة الله وبركاتــه ،،
معقووووووووووووووووووووول ولا واحد
:cry: :ohmy: :cry:
هذا كود يوضح إحدى الطرق لرسم المتجهات
import java.awt.Graphics;
public class VectorShape extends javax.swing.JFrame {
public VectorShape() {
initComponents();
}
public void paint(Graphics g){
super.paint(g);
int x1 = 50;
int y1 = 150;
int x2 = 300;
int y2 = 150;
// this to draw the horezintal Line __________________________
g.drawLine(x1, y1, x2, y2);
// this to draw the up part of the arrow ( \ )
g.drawLine(x2 - 10, y2 - 5, x2, y2);
// this to draw the up part of the arrow ( / )
g.drawLine(x2 - 10, y2 + 5, x2, y2);
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGap(0, 300, Short.MAX_VALUE)
);
pack();
}// </editor-fold>
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new VectorShape().setVisible(true);
}
});
}
// Variables declaration - do not modify
// End of variables declaration
}