By clickiing the "add" button it is supposed to make the new bar or new slice pf the pie chart. I have implemented some action listeners but nothing shows up when the add button is clicked. Can anybody take a look at this one and see whats going on? As of now only the bar chart works so dont try the pie chart please. This one is due on Tuesday
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.swing.JComponent;
import java.awt.Rectangle;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
*
* @author hidden
*/
public class RectangleComponent extends JComponent{
int size;
Color color;
public RectangleComponent(int s, Color c)
{
size=s;
color = c;
}
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
g2.setBackground(color);
g2.fillRect(5, 5, size, 5);
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import javax.swing.JComponent;
import java.awt.Rectangle;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
/**
*
* @author hidden
*/
public class RectangleComponent extends JComponent{
int size;
Color color;
public RectangleComponent(int s, Color c)
{
size=s;
color = c;
}
public void paintComponent(Graphics g)
{
Graphics2D g2 = (Graphics2D) g;
g2.setBackground(color);
g2.fillRect(5, 5, size, 5);
}
}

New Topic/Question
Reply




MultiQuote




|