本文整理汇总了Java中com.intellij.ui.NonFocusableCheckBox.setMnemonic方法的典型用法代码示例。如果您正苦于以下问题:Java NonFocusableCheckBox.setMnemonic方法的具体用法?Java NonFocusableCheckBox.setMnemonic怎么用?Java NonFocusableCheckBox.setMnemonic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.NonFocusableCheckBox
的用法示例。
在下文中一共展示了NonFocusableCheckBox.setMnemonic方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getComponent
import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Nullable
protected JComponent getComponent() {
if (!myCantChangeFinalModifier) {
myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
myCanBeFinalCb.setSelected(createFinals());
myCanBeFinalCb.setMnemonic('f');
final FinalListener finalListener = new FinalListener(myEditor);
myCanBeFinalCb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
@Override
protected void run(@NotNull Result result) throws Throwable {
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
final PsiVariable variable = getVariable();
if (variable != null) {
finalListener.perform(myCanBeFinalCb.isSelected(), variable);
}
}
}.execute();
}
});
} else {
return null;
}
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(null);
if (myCanBeFinalCb != null) {
panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
}
panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));
return panel;
}
示例2: getComponent
import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Override
protected JComponent getComponent() {
myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
myCanBeFinalCb.setSelected(false);
myCanBeFinalCb.setMnemonic('f');
final GrFinalListener finalListener = new GrFinalListener(myEditor);
myCanBeFinalCb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
@Override
protected void run(@NotNull Result result) throws Throwable {
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
final GrVariable variable = getVariable();
if (variable != null) {
finalListener.perform(myCanBeFinalCb.isSelected(), variable);
}
}
}.execute();
}
});
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(null);
if (myCanBeFinalCb != null) {
panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL,
new Insets(5, 5, 5, 5), 0, 0));
}
panel.add(Box.createVerticalBox(),
new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
return panel;
}
示例3: getComponent
import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Nullable
protected JComponent getComponent() {
if (!myCantChangeFinalModifier) {
myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
myCanBeFinalCb.setSelected(createFinals());
myCanBeFinalCb.setMnemonic('f');
final FinalListener finalListener = new FinalListener(myEditor);
myCanBeFinalCb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
@Override
protected void run(com.intellij.openapi.application.Result result) throws Throwable {
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
final PsiVariable variable = getVariable();
if (variable != null) {
finalListener.perform(myCanBeFinalCb.isSelected(), variable);
}
}
}.execute();
}
});
} else {
return null;
}
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(null);
if (myCanBeFinalCb != null) {
panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
}
panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));
return panel;
}
示例4: getComponent
import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
@Nullable
@Override
protected JComponent getComponent() {
myCanBeFinalCb = new NonFocusableCheckBox("Declare final");
myCanBeFinalCb.setSelected(false);
myCanBeFinalCb.setMnemonic('f');
final GrFinalListener finalListener = new GrFinalListener(myEditor);
myCanBeFinalCb.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
new WriteCommandAction(myProject, getCommandName(), getCommandName()) {
@Override
protected void run(Result result) throws Throwable {
PsiDocumentManager.getInstance(myProject).commitDocument(myEditor.getDocument());
final GrVariable variable = getVariable();
if (variable != null) {
finalListener.perform(myCanBeFinalCb.isSelected(), variable);
}
}
}.execute();
}
});
final JPanel panel = new JPanel(new GridBagLayout());
panel.setBorder(null);
if (myCanBeFinalCb != null) {
panel.add(myCanBeFinalCb, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0));
}
panel.add(Box.createVerticalBox(), new GridBagConstraints(0, 2, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0));
return panel;
}
示例5: GitCheckinOptions
import com.intellij.ui.NonFocusableCheckBox; //导入方法依赖的package包/类
/**
* A constructor
*
* @param project
* @param roots
*/
GitCheckinOptions(Project project, Collection<VirtualFile> roots) {
myPanel = new JPanel(new GridBagLayout());
final Insets insets = new Insets(2, 2, 2, 2);
// add authors drop down
GridBagConstraints c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 0;
c.anchor = GridBagConstraints.WEST;
c.insets = insets;
final JLabel authorLabel = new JLabel(GitBundle.message("commit.author"));
myPanel.add(authorLabel, c);
c = new GridBagConstraints();
c.anchor = GridBagConstraints.CENTER;
c.insets = insets;
c.gridx = 1;
c.gridy = 0;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
final List<String> usersList = getUsersList(project, roots);
final Set<String> authors = usersList == null ? new HashSet<String>() : new HashSet<String>(usersList);
ContainerUtil.addAll(authors, mySettings.getCommitAuthors());
List<String> list = new ArrayList<String>(authors);
Collections.sort(list);
list = ObjectsConvertor.convert(list, new Convertor<String, String>() {
@Override
public String convert(String o) {
return StringUtil.shortenTextWithEllipsis(o, 30, 0);
}
});
myAuthor = new JComboBox(ArrayUtil.toObjectArray(list));
myAuthor.insertItemAt("", 0);
myAuthor.setSelectedItem("");
myAuthor.setEditable(true);
authorLabel.setLabelFor(myAuthor);
myAuthor.setToolTipText(GitBundle.getString("commit.author.tooltip"));
myPanel.add(myAuthor, c);
// add amend checkbox
c = new GridBagConstraints();
c.gridx = 0;
c.gridy = 1;
c.gridwidth = 2;
c.anchor = GridBagConstraints.CENTER;
c.insets = insets;
c.weightx = 1;
c.fill = GridBagConstraints.HORIZONTAL;
myAmend = new NonFocusableCheckBox(GitBundle.getString("commit.amend"));
myAmend.setMnemonic('m');
myAmend.setSelected(false);
myAmend.setToolTipText(GitBundle.getString("commit.amend.tooltip"));
myPanel.add(myAmend, c);
}