commentbutton.java

来自「Java version of ABC/HR comparator v0.5. 」· Java 代码 · 共 40 行

JAVA
40
字号
package abchr.gui.modulecontrols;

import abchr.CommentModule;
import abchr.ProjectModule;
import abchr.gui.CommentDialog;
import abchr.gui.CommentDialogListener;
import jlfgr.GraphicsRepository;

import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

public class CommentButton extends JButton implements ModuleControl,CommentDialogListener {
	private CommentModule commentModule;
	private CommentDialog dialog=new CommentDialog();

	public CommentButton(CommentModule commentModule) {
		super("General Comments...",GraphicsRepository.getToolbarIcon("general/Edit16.gif"));
		this.commentModule=commentModule;
		this.setEnabled(commentModule!=null);
		this.addActionListener(new ActionListener() {
			public void actionPerformed(ActionEvent e) {
				dialog.showDialogModeless(CommentButton.this.commentModule.getComment(),CommentButton.this);
			}
		});
	}

	public void dialogClosed(CommentDialog source,String text) {
		commentModule.setComment(text);
	}

	public CommentButton(){this(null);}

	public CommentModule getCommentModule(){return commentModule;}

	public void setModule(ProjectModule module) {
		this.commentModule=(CommentModule)module;
		this.setEnabled(commentModule!=null);
	}
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?