我正在尝试在ActionListener中停止一个计时器.以下是我正在尝试做的代码.我想在actionPerformed方法中遇到某个条件时停止我创建的计时器.timer.stop()不起作用,编译器不允许我这样做.
任何帮助.建议,建议会非常有帮助.
public class ToggleAnnotationsAction extends IdentifiedMultiAction {
//This status indicates if the Toggle action has been completed
/**
* Defines the toggling direction of a <code>ToggleAnnotationAction</code> instance.
*/
public static enum Direction {FORWARD, BACKWARD};
private Direction myDir;
/**
* Create an action with the direction presets given by the provided <code>Enum</code>.
*
* @param dir An <code>Enum</code> defined in this class which maps to the correct direction of toggling
* @see behaviors.multiact.IdentifiedMultiAction#IdentifiedMultiAction(Enum)
*/
public ToggleAnnotationsAction(Direction dir) {
super(dir);
this.myDir …Run Code Online (Sandbox Code Playgroud) 肯定有一个更好的方法在C++中这样做吗?
if ( width_value < tipWidth )
{
if (tipWidth < threshold)
{
return threshold;
}
return tipWidth;
}
return width_value ;
Run Code Online (Sandbox Code Playgroud)