Problem with Graphics

Ok, so I have multiple constructors, one with a menu with buttons that use the other constructors. One of constructors is supposed to make either black or white lines, depending on the data. The frame shows up, but the lines don't. I've printed out the data, so I know the program is reading it, the lines just aren't showing up.

Thanks

public Class(DataArray dataArray, Graphics g){

super.paint(g);

MenuBar menuBar =new MenuBar();

Menu menuFile =new Menu();

MenuItem menuFileExit =new MenuItem();

menuFile.setLabel("File");

menuFileExit.setLabel("Close");

// Add action listener.for the menu button

menuFileExit.addActionListener(

new ActionListener(){

publicvoid actionPerformed(ActionEvent e){

PrintFile.this.windowClosed();

}

}

);

w=0;

width /= (double)(dataArray.size() +1);

for(int i = 0; i<dataArray.size();i++,w+=width){

//System.out.println("Voltage for Data: "+i+" : "+dataArray.getDataArray()[i].getVoltage());

g.setColor(Color.WHITE);

if(dataArray.getDataArray()[i].getVoltage()>1.0){

g.setColor(Color.BLACK);

}

g.fillRect((int)w,0,(int)width,(int)height);

}

setVisible(true);

menuFile.add(menuFileExit);

menuBar.add(menuFile);

setTitle("Wall Image");

setMenuBar(menuBar);

Dimension d = Toolkit.getDefaultToolkit().getScreenSize();

width = d.width;

height = d.height;

setSize((int)width, (int)height);

// Add window listener.

this.addWindowListener(

new WindowAdapter(){

publicvoid windowClosing(WindowEvent e){

PrintFile.this.windowClosed();

}

}

);

}

[2941 byte] By [kcj989a] at [2007-11-26 14:29:53]
# 1
You're calling paint in a constructor? That makes me nervous. What class are you deriving from?
DrLaszloJamfa at 2007-7-8 2:24:24 > top of Java-index,Java Essentials,New To Java...
# 2
super.paint(g);!?
CaptainMorgan08a at 2007-7-8 2:24:24 > top of Java-index,Java Essentials,New To Java...
# 3
Also, next time post Swing-related items in the Swing forum, please.
ChuckBinga at 2007-7-8 2:24:24 > top of Java-index,Java Essentials,New To Java...