Can anyone give a suggestion for the following :
hi to all
i'm working on creating a paint application that has 2 buttons circle and RECTANGLE below that empty space appears that enables you to draw one of these shapes as based on the button selected
for example
1 ) selects a circle button
2) circle will be drawn in a space after your mouse movements on the empty area
so in this i try to create a another check-box in which you select a color to be filled within the shape before your mouse movements so to implement this i was told to create action-listener but it was not working
as far as i tried something like this for applying color to shape as based on color and the shape is selected
i have been trying this for last 2 days still could not find anything useful
and inside action block my codings are as follows
Code:
public void actionPerformed(ActionEvent e)
{
JComboBox box1 = (JComboBox)e.getSource();
String Name = (String)cb.getSelectedItem();
if (Name.equals("GREEN")) && (e.getSource() == bRect)
g.setColor(0, 0, 255);
g.fillRect(start.x, start.y, width, height);
else if (Name.equals("BLUE")) && (e.getSource() == bRect)
g.setColor(0,0,0);
g.fillRect(start.x, start.y, width, height);
return(true);
} else
return(false);
i don't know how to implement this can anyone give me idea
thnx in advance
mano