How to draw a line

Reply

Join Date: Nov 2004
Posts: 12
Reputation: bsunkel is an unknown quantity at this point 
Solved Threads: 0
bsunkel bsunkel is offline Offline
Newbie Poster

How to draw a line

 
0
  #1
Feb 21st, 2005
HI,

All I want to do is put a straight line under my 3 labels which I have loaded into a JFrame.

After my JFrame has loaded I use the method repaint() which is supposed to call:

public void paintComponent(Graphics comp) {
Graphics2D comp2D = (Graphics2D)comp;
comp2D.drawLine(0,60,100,60);

}

Which does not draw my line. The method repaint() does not even allow me to go to the method paintComponent(Graphics comp). What am I doing wrong

Any help would be appreciated
Reply With Quote Quick reply to this message  
Join Date: Aug 2004
Posts: 780
Reputation: OurNation is an unknown quantity at this point 
Solved Threads: 9
OurNation's Avatar
OurNation OurNation is offline Offline
Master Poster

Re: How to draw a line

 
0
  #2
Feb 21st, 2005
This is how I do my lines but I just started java a month ago and it is the only way I have been introduced to.
public void paint(Graphics g) {
g.drawLine(25, 0, 25, 50);
g.setColor(Color.black);
PETA People for the Eating of Tasty Animals.


FireFox
Hijack This
Ad-Aware
Hijack this tutorial
Microsoft AntiSpyware
CompUchat
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC