小编Kri*_*nan的帖子

从Action Listener内部停止一个swing计时器

我正在尝试在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)

java swing

28
推荐指数
1
解决办法
2万
查看次数

C++使用阈值检查较低数字的条件

肯定有一个更好的方法在C++中这样做吗?

    if ( width_value < tipWidth )
    {
        if (tipWidth < threshold)
        {
            return threshold;
        }
        return tipWidth;
    }
    return width_value ;
Run Code Online (Sandbox Code Playgroud)

c++

0
推荐指数
1
解决办法
44
查看次数

标签 统计

c++ ×1

java ×1

swing ×1