| | |
How to draw a line
![]() |
•
•
Join Date: Nov 2004
Posts: 12
Reputation:
Solved Threads: 0
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
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
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);
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
FireFox
Hijack This
Ad-Aware
Hijack this tutorial
Microsoft AntiSpyware
CompUchat
![]() |
Similar Threads
- How to draw a line in a VB.NET form? (VB.NET)
- remind the draw line on panel (C#)
- Draw a line in datagridviewcolumn (C#)
- draw line (C#)
- Draw a Line or other Shape (Design Time) (VB.NET)
- How to draw this line? (C++)
Other Threads in the Java Forum
- Previous Thread: I need a good java compiler
- Next Thread: Creating a GUI that accepts user input help
| Thread Tools | Search this Thread |
2dgraphics 3d @param affinetransform android api applet application arc arguments array arrays automation banking binary bluetooth byte chat chatprogramusingobjects class client code color compare component count database design detection eclipse eclipsedevelopment encryption error fractal game givemetehcodez graphics gridlayout gui guitesting helpwithhomework html ide if_statement image input integer interface j2me java java.xls javadesktopapplications javaprojects jni jpanel julia keytool keyword linux list loop macintosh map method methods mobile netbeans newbie object os pong problem producer program programming project projectideas read recursion reference replaysolutions rim scanner server set size sms sort sql string swing terminal threads transforms tree ui unicode validation web windows





