New 2dShapes with Jbutton in JApplet

Why this code is ok (=user can add new shapes by pressing the button) but when I try to do same in JApplet, with JButton to get new 2dshapes it doesn't work? I can't find any examples or tutorial including any help. (I have found only tutorials on how to reshape an existing 2dshape by pressing buttons)

if (e.getActionCommand() == "ok") {

if (list3.getSelectedItem() == "Polygon"){

...

Graphics z = getGraphics();

Polygon p = new Polygon();

p.addPoint(x,y);p.addPoint(y,x);p.addPoint(50,50);

z.drawPolygon(p);

}

[577 byte] By [Tuikea] at [2007-10-1 1:01:46]
# 1
never compare objects with '==', always:someObject.equals(someOtherObject);....
rustypupa at 2007-7-8 1:20:35 > top of Java-index,Security,Event Handling...