Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void paintComponent(Graphics g) {
- super.paintComponent(g);
- Graphics2D g2 = (Graphics2D)g;
- g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
- RenderingHints.VALUE_ANTIALIAS_ON);
- int w = getWidth();
- int h = getHeight();
- // Draw ordinate.
- g2.draw(new Line2D.Double(PAD, PAD, PAD, h-PAD));
- // Draw abcissa.
- g2.draw(new Line2D.Double(PAD, h-PAD, w-PAD, h-PAD));
- // Mark data points.
- g2.setPaint(Color.red);
- for(int i = 0; i < positions.size(); i++)
- {
- g2.fill(new Ellipse2D.Double(w/2 + positions.get(i).getX(), h/2 + positions.get(i).getY(), 4, 4));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement