Results 1 to 3 of 3
Thread: paint and repaint problem
- 05-20-2010, 01:00 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 20
- Rep Power
- 0
paint and repaint problem
Hallo,
I use Netbeans 6.5 and just to make simple, I made a GUI with Netbeans GUI Builder.
Say that I have made a JFrame with a JPanel. And I want to draw the graph in this JPanel.
In JPanel "ProfilPanelLinks" I have add this methode:
and the class for another is:Java Code:private void gambar(Graphics g){ ProfilPanelLinks.add(dataModel); dataModel.doDraw(g); ProfilPanelLinks.repaint(); }
Java Code:public class EvaluateDataModel { private EvaluateDrawing draw; protected EvaluateDataModel(){ draw = new EvaluateDrawing(); } public void doDraw(Graphics g) { draw.draw(g); } }There are 2 classes, yes, since this is just a cut from a long class. I need to paint at least 6 more graph from another ArrayList. But it won´t draw just a simple line.Java Code:public class EvaluateDrawing extends JPanel { public void draw(Graphics g) { Graphics2D g2d = (Graphics2D)g; super.paint(g2d); g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g2d.setStroke(new BasicStroke(1)); g2d.setColor(Color.blue); g2d.drawLine(0, 0, 100, 100); } }
Can anyone help me, how can I draw it with netbeans panel?
Thank you very much.
- 05-20-2010, 06:36 PM #2
Senior Member
- Join Date
- May 2010
- Posts
- 436
- Rep Power
- 4
This is not really a NetBeans issue but a how to draw graphics in Swing issue, and I think that your best bet is to go to the Sun Java tutorials and check out the tutorials that cover this. There's a bit to learn, but it is all worthwhile.
- 05-21-2010, 06:43 AM #3
Similar Threads
-
Problem with repaint();
By dunafrothint in forum AWT / SwingReplies: 8Last Post: 01-07-2010, 12:33 AM -
Repaint problem
By citizenXL in forum New To JavaReplies: 4Last Post: 10-28-2009, 03:02 PM -
other than paint repaint
By amith in forum Java 2DReplies: 1Last Post: 07-01-2008, 11:39 PM -
Repaint problem
By swimberl in forum Java 2DReplies: 1Last Post: 02-16-2008, 09:12 PM -
Repaint problem
By swimberl in forum Java 2DReplies: 0Last Post: 01-06-2008, 03:28 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks