hey guys,
I drew many lines for the purpose of my project but for some reason, I cannot draw this specific line(code line 44) and cannot figure out why.
Note: I have debugged the code and this code line is red by Java but it's not applied to the graphic.
package projectilemotion;
/**
*
* @author Taimoor
*/
import javax.swing.*;
import java.awt.*;
public class DrawProjectilePath extends JPanel
{
int yIncrement = 535;
int xIncrement = 25;
final int xLeft = 23;
final int xRight = 27;
@Override
public void paintComponent(Graphics g)
{
super.paintComponent(g);
this.setBackground(Color.LIGHT_GRAY);
g.drawString("Y Axes", 20, 25);
g.drawLine(25, 25, 25, 535);
g.drawLine(26, 25, 26, 535);
g.drawLine(25, 25, 20, 30);
g.drawLine(25, 26, 20, 31);
g.drawLine(26, 25, 31, 30);
g.drawLine(27, 27, 31, 31);
g.drawString("X Axes", 570, 550);
g.drawLine(25, 535, 575, 535);
g.drawLine(25, 536, 575, 536);
g.drawLine(575, 535, 570, 530);
g.drawLine(574, 535, 569, 530);
g.drawLine(575, 536, 570, 541);
g.drawLine(574, 536, 569, 541);
//g.drawLine(23, 408, 27, 408);
while (yIncrement > 25)
{
yIncrement -= 127;
g.setColor(Color.RED);
g.drawLine(xRight, yIncrement, xLeft, yIncrement);
}
}
}