The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
January 2002



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.


java swing, passing parameters

Posted by Niamh Phelan on January 05, 2002 at 8:45 AM

Hi, my question is very simple, why does the following code not work???!!! I have made a which calls
in the following way

mychartPanel = new chartPanel(attributes);

I have indicated in the code below how far the code runs. attributes is a vector containing objects of the type attribute(a class i have defined)


public class chartPanel extends JPanel {
public chartPanel(Vector attributes)
System.out.println("got this far");

private int x1;
private int x2;
private int y1;
private int rectWidth;
private int rectHeight;

public void paintComponent(Graphics g, Vector attributes)
System.out.println("didnt get this far");

super.paintComponent(g); //paint background

for(int i=0;i {
attribute a = (attribute)attributes.elementAt(i);
x1 = a.getStart();
x2 = a.getFinish();




Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us