My Actually I want to be able to highlight a paintwatch when I click on it, and if switch color one If it is the same as Here is my colorhold class: In addition to using par, you can choose one And should use ifs: Note that the second condition will always evaluate the truth - if the holder is not the color Equal to the color of the super, if it will be set in the first position. Also make sure that neither the patient nor the super color return to the null or check it out clearly. _holder.getColor () is considered to be red red by default and These conditional statements are not working I think I have a syntax wrong
ColorHolder , then I want to deselect it Swatch.
Import wheels.users. *; Import java.awt.color; Import java.awt.event.MouseEvent; Public class paintwatch oval {personal color holder _holder; Public int _i; Public PaintSwitch (Color C, Color Holder Holder) {Super (C); _holder = holder; _i = 1; } Public Zero MouseClicked (MouseEvent E) {If (_holder.getColor () !: Super.getColor ()) {super.setFrameColor (Color.BLACK); Super.setFrameThickness (3); _holder.setColor (super.getColor ()); } If (_holder.getColor () == Super.Gate Coiler ()) {Super. SetFrameTenches (10); Super.setFrameColor (Color.WHITE); _holder.setColor (Color.RED); }}}
import java.awt.color; Public Class Color Holder Color {Personal Color _currentColor; Public ColorHolder () {_currentColor = Color.RED; } Public color getColor () {back _currentColor; } Public Zero Set Collar (Color C) {_currentColor = c; }}
if (_holder.getColor ()! = Super.getColor ()) {... _holder.setColor (super.getColor ()); } If (_holder.getColor () == super.getColor ()) {...}
if (_holder.getColor (.) Equals (super.getColor ())) {... do sth} else {... do sth else}
No comments:
Post a Comment