当前位置: 首页>>代码示例>>Java>>正文


Java JBCheckBox.setMnemonic方法代码示例

本文整理汇总了Java中com.intellij.ui.components.JBCheckBox.setMnemonic方法的典型用法代码示例。如果您正苦于以下问题:Java JBCheckBox.setMnemonic方法的具体用法?Java JBCheckBox.setMnemonic怎么用?Java JBCheckBox.setMnemonic使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.ui.components.JBCheckBox的用法示例。


在下文中一共展示了JBCheckBox.setMnemonic方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: GitPushTagPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public GitPushTagPanel(@Nullable GitPushTagMode defaultMode, boolean followTagsSupported) {
  String checkboxText = "Push Tags";
  if (followTagsSupported) {
    checkboxText += ": ";
  }
  myCheckBox = new JBCheckBox(checkboxText);
  myCheckBox.setMnemonic('T');
  myCheckBox.setSelected(defaultMode != null);

  setLayout(new BorderLayout());
  add(myCheckBox, BorderLayout.WEST);

  if (followTagsSupported) {
    myCombobox = new ComboBox(GitPushTagMode.getValues());
    myCombobox.setRenderer(new ListCellRendererWrapper<GitPushTagMode>() {
      @Override
      public void customize(JList list, GitPushTagMode value, int index, boolean selected, boolean hasFocus) {
        setText(value.getTitle());
      }
    });
    myCombobox.setEnabled(myCheckBox.isSelected());
    if (defaultMode != null) {
      myCombobox.setSelectedItem(defaultMode);
    }

    myCheckBox.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(@NotNull ActionEvent e) {
        myCombobox.setEnabled(myCheckBox.isSelected());
      }
    });
    add(myCombobox, BorderLayout.CENTER);
  }
  else {
    myCombobox = null;
  }

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:GitPushTagPanel.java

示例2: createCenterPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  JLabel description = new JBLabel(
    "<html>You are about to commit CRLF line separators to the Git repository.<br/>" +
    "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE +
    "</code> to avoid line separator issues.</html>");

  JLabel additionalDescription = new JBLabel(
    "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" +
    "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL);

  JLabel readMore = new LinkLabel("Read more", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      BrowserUtil.browse("https://help.github.com/articles/dealing-with-line-endings");
    }
  });

  JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
  myDontWarn = new JBCheckBox("Don't warn again");
  myDontWarn.setMnemonic('w');

  JPanel rootPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  rootPanel.add(icon, g.nextLine().next().coverColumn(4));
  rootPanel.add(description, g.next());
  rootPanel.add(readMore, g.nextLine().next().next());
  rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP));
  rootPanel.add(myDontWarn,  g.nextLine().next().next().insets(0, 0, 0, 0));

  return rootPanel;

}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:38,代码来源:GitCrlfDialog.java

示例3: getComponent

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@Override
protected JComponent getComponent() {

  JPanel previewPanel = new JPanel(new BorderLayout());
  previewPanel.add(getPreviewEditor().getComponent(), BorderLayout.CENTER);
  previewPanel.setBorder(new EmptyBorder(2, 2, 6, 2));

  DocumentAdapter documentAdapter = new DocumentAdapter() {
    @Override
    public void documentChanged(DocumentEvent e) {
      final TemplateState templateState = TemplateManagerImpl.getTemplateState(myEditor);
      if (templateState != null) {
        final TextResult value = templateState.getVariableValue(InplaceRefactoring.PRIMARY_VARIABLE_NAME);
        if (value != null) {
          updateTitle(getVariable(), value.getText());
        }
      }
    }
  };
  myEditor.getDocument().addDocumentListener(documentAdapter);

  myDelegateCB = new JBCheckBox("Delegate via overloading method");
  myDelegateCB.setMnemonic('l');
  myDelegateCB.setFocusable(false);

  JPanel panel = new JPanel(new BorderLayout());
  panel.add(previewPanel, BorderLayout.CENTER);
  panel.add(myDelegateCB, BorderLayout.SOUTH);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GrInplaceParameterIntroducer.java

示例4: createCenterPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {
  JLabel description = new JBLabel(
    "<html>You are about to commit CRLF line separators to the Git repository.<br/>" +
    "It is recommended to set core.autocrlf Git attribute to <code>" + RECOMMENDED_VALUE +
    "</code> to avoid line separator issues.</html>");

  JLabel additionalDescription = new JBLabel(
    "<html>Fix and Commit: <code>git config --global core.autocrlf " + RECOMMENDED_VALUE + "</code> will be called,<br/>" +
    "Commit as Is: the config value won't be set.</html>", UIUtil.ComponentStyle.SMALL);

  JLabel readMore = new LinkLabel("Read more", null, new LinkListener() {
    @Override
    public void linkSelected(LinkLabel aSource, Object aLinkData) {
      BrowserUtil.launchBrowser("https://help.github.com/articles/dealing-with-line-endings");
    }
  });

  JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
  myDontWarn = new JBCheckBox("Don't warn again");
  myDontWarn.setMnemonic('w');

  JPanel rootPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  rootPanel.add(icon, g.nextLine().next().coverColumn(4));
  rootPanel.add(description, g.next());
  rootPanel.add(readMore, g.nextLine().next().next());
  rootPanel.add(additionalDescription, g.nextLine().next().next().pady(DEFAULT_HGAP));
  rootPanel.add(myDontWarn,  g.nextLine().next().next().insets(0, 0, 0, 0));

  return rootPanel;

}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:38,代码来源:GitCrlfDialog.java

示例5: createCenterPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@Override
protected JComponent createCenterPanel() {

  JLabel icon = new JLabel(UIUtil.getWarningIcon(), SwingConstants.LEFT);
  JLabel description = new JLabel(getMessageText());

  myNameTextField = new JTextField(20);
  JBLabel nameLabel = new JBLabel("Name: ");
  nameLabel.setDisplayedMnemonic('n');
  nameLabel.setLabelFor(myNameTextField);

  myEmailTextField = new JTextField(20);
  JBLabel emailLabel = new JBLabel("E-mail: ");
  emailLabel.setDisplayedMnemonic('e');
  emailLabel.setLabelFor(myEmailTextField);

  if (myProposedValues != null) {
    myNameTextField.setText(myProposedValues.getFirst());
    myEmailTextField.setText(myProposedValues.getSecond());
  }
  else {
    myNameTextField.setText(SystemProperties.getUserName());
  }

  myGlobalCheckbox = new JBCheckBox("Set properties globally", true);
  myGlobalCheckbox.setMnemonic('g');

  JPanel rootPanel = new JPanel(new GridBagLayout());
  GridBag g = new GridBag()
    .setDefaultInsets(new Insets(0, 0, DEFAULT_VGAP, DEFAULT_HGAP))
    .setDefaultAnchor(GridBagConstraints.LINE_START)
    .setDefaultFill(GridBagConstraints.HORIZONTAL);

  rootPanel.add(description, g.nextLine().next().coverLine(3).pady(DEFAULT_HGAP));
  rootPanel.add(icon, g.nextLine().next().coverColumn(3));
  rootPanel.add(nameLabel, g.next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
  rootPanel.add(myNameTextField, g.next());
  rootPanel.add(emailLabel, g.nextLine().next().next().fillCellNone().insets(new Insets(0, 6, DEFAULT_VGAP, DEFAULT_HGAP)));
  rootPanel.add(myEmailTextField, g.next());
  rootPanel.add(myGlobalCheckbox, g.nextLine().next().next().coverLine(2));

  return rootPanel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:GitUserNameNotDefinedDialog.java

示例6: createCenterPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
@NotNull
public JComponent createCenterPanel() {
  MigLayout migLayout = new MigLayout("flowy,ins 0, fill");
  JPanel contentPane = new JPanel(migLayout);

  myPullCheckBox = new JBCheckBox("Pull", true);
  myPullCheckBox.setMnemonic('p');
  myPullCheckBox.setToolTipText("Pull from the default remote repository");
  myPullCheckBox.setSelected(true);

  myOnlyUpdateButton = new JRadioButton("Only Update", true);
  myOnlyUpdateButton.setMnemonic('u');
  myOnlyUpdateButton.setToolTipText("Update to the head of the current branch");

  myMergeRadioButton = new JRadioButton("Merge", false);
  myMergeRadioButton.setMnemonic('m');
  myMergeRadioButton.setToolTipText("Merge if pulling resulted in extra heads");
  myMergeRadioButton.addItemListener(new ItemListener() {
    @Override
    public void itemStateChanged(ItemEvent e) {
      updateEnabledStates();
    }
  });

  myCommitAfterMergeCheckBox = new JCheckBox("Commit after merge without conflicts", false);
  myCommitAfterMergeCheckBox.setMnemonic('c');
  myCommitAfterMergeCheckBox.setToolTipText("Commit automatically after the merge");
  myCommitAfterMergeCheckBox.setSelected(false);

  myRebaseRadioButton = new JRadioButton("Rebase", false);
  myRebaseRadioButton.setToolTipText("Rebase changesets to a branch tip as destination");
  myRebaseRadioButton.setMnemonic('r');


  contentPane.add(myPullCheckBox, "left");
  JPanel strategyPanel = new JPanel(migLayout);
  strategyPanel.setBorder(IdeBorderFactory.createTitledBorder("Update Strategy", false));
  strategyPanel.add(myOnlyUpdateButton, "left");
  strategyPanel.add(myMergeRadioButton, "left");
  strategyPanel.add(myCommitAfterMergeCheckBox, "gapx 5%");
  strategyPanel.add(myRebaseRadioButton, "left");
  contentPane.add(strategyPanel);
  ButtonGroup group = new ButtonGroup();
  group.add(myOnlyUpdateButton);
  group.add(myRebaseRadioButton);
  group.add(myMergeRadioButton);
  updateEnabledStates();
  return contentPane;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:50,代码来源:HgUpdateDialog.java

示例7: MoveChangesDialog

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public MoveChangesDialog(final Project project, Collection<Change> selected, final Set<ChangeList> changeLists, VirtualFile current) {
  super(project, true);
  mySelected = selected;
  setTitle("Move Changes to Active Changelist");
  myTreeList = new ChangesTreeList<Change>(project, selected, true, false, null, null) {

    @Override
    protected DefaultTreeModel buildTreeModel(List<Change> changes, ChangeNodeDecorator changeNodeDecorator) {
      return TreeModelBuilder.buildFromChangeLists(project, isShowFlatten(), changeLists);
    }

    @Override
    protected List<Change> getSelectedObjects(ChangesBrowserNode<Change> node) {
      return node.getAllChangesUnder();
    }

    @Override
    protected Change getLeadSelectedObject(ChangesBrowserNode node) {
      final Object o = node.getUserObject();
      if (o instanceof Change) {
        return (Change) o;
      }
      return null;
    }
  };

  myChanges = new ArrayList<>();
  for (ChangeList list : changeLists) {
    myChanges.addAll(list.getChanges());
  }
  myTreeList.setChangesToDisplay(myChanges, current);

  myCheckBox = new JBCheckBox("Select current file only");
  myCheckBox.setMnemonic('c');
  myCheckBox.addActionListener(e -> setSelected(myCheckBox.isSelected()));

  boolean selectCurrent = PropertiesComponent.getInstance().getBoolean(MOVE_CHANGES_CURRENT_ONLY);
  myCheckBox.setSelected(selectCurrent);
  setSelected(selectCurrent);

  init();
}
 
开发者ID:consulo,项目名称:consulo,代码行数:43,代码来源:MoveChangesDialog.java


注:本文中的com.intellij.ui.components.JBCheckBox.setMnemonic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。