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


Java JBCheckBox.addActionListener方法代码示例

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


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

示例1: AndroidXmlCodeStylePanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
AndroidXmlCodeStylePanel(CodeStyleSettings currentSettings, CodeStyleSettings settings) {
  super(XMLLanguage.INSTANCE, currentSettings, settings);
  myPanel = new JPanel(new BorderLayout());
  myPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
  JPanel centerPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 0, 0, true, false));
  myPanel.add(centerPanel, BorderLayout.CENTER);
  myUseCustomSettings = new JBCheckBox("Use custom formatting settings for Android XML files");
  myPanel.add(myUseCustomSettings, BorderLayout.NORTH);

  myCodeStylePanels = new ArrayList<MyFileSpecificPanel>();

  myCodeStylePanels.add(new ManifestCodeStylePanel());
  myCodeStylePanels.add(new LayoutCodeStylePanel());
  myCodeStylePanels.add(new ValueResourcesCodeStylePanel());
  myCodeStylePanels.add(new OtherCodeStylePanel());

  myFileSpecificCodeStylesPanel = new JPanel(new GridLayout((myCodeStylePanels.size() + 1) / 2, 2, 15, 0));
  centerPanel.add(myFileSpecificCodeStylesPanel);

  myUseCustomSettings.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      UIUtil.setEnabled(myFileSpecificCodeStylesPanel, myUseCustomSettings.isSelected(), true);
    }
  });

  for (MyFileSpecificPanel panel : myCodeStylePanels) {
    final JPanel titledPanel = new JPanel(new BorderLayout());
    titledPanel.setBorder(IdeBorderFactory.createTitledBorder(panel.getTitle()));
    titledPanel.add(panel, BorderLayout.CENTER);
    myFileSpecificCodeStylesPanel.add(titledPanel);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:AndroidXmlCodeStylePanel.java

示例2: 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

示例3: AlternativeJREPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
  myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

  myFieldWithHistory = new TextFieldWithHistory();
  final ArrayList<String> foundJDKs = new ArrayList<String>();
  for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
    String path = provider.getJrePath();
    if (!StringUtil.isEmpty(path)) {
      foundJDKs.add(path);
    }
  }
  final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();
  for (Sdk jdk : allJDKs) {
    foundJDKs.add(jdk.getHomePath());
  }
  myFieldWithHistory.setHistory(foundJDKs);
  myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myCbEnabled, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

  myCbEnabled.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      enabledChanged();
    }
  });
  enabledChanged();

  setAnchor(myCbEnabled);

  updateUI();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:40,代码来源:AlternativeJREPanel.java

示例4: AlternativeJREPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
  myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

  myFieldWithHistory = new TextFieldWithHistory();
  final ArrayList<String> foundJDKs = new ArrayList<String>();
  final Sdk[] allJDKs = SdkTable.getInstance().getAllSdks();
  for (Sdk jdk : allJDKs) {
    foundJDKs.add(jdk.getHomePath());
  }
  myFieldWithHistory.setHistory(foundJDKs);
  myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myCbEnabled, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

  myCbEnabled.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      enabledChanged();
    }
  });
  enabledChanged();

  setAnchor(myCbEnabled);

  updateUI();
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:34,代码来源:AlternativeJREPanel.java

示例5: AlternativeJREPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
  myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

  myFieldWithHistory = new TextFieldWithHistory();
  myFieldWithHistory.setHistorySize(-1);
  final ArrayList<String> foundJDKs = new ArrayList<String>();
  final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();

  for (Sdk sdk : allJDKs) {
    foundJDKs.add(sdk.getName());
  }

  for (JreProvider provider : JreProvider.EP_NAME.getExtensions()) {
    String path = provider.getJrePath();
    if (!StringUtil.isEmpty(path)) {
      foundJDKs.add(path);
    }
  }

  for (Sdk jdk : allJDKs) {
    String homePath = jdk.getHomePath();

    if (!SystemInfo.isMac) {
      final File jre = new File(jdk.getHomePath(), "jre");
      if (jre.isDirectory()) {
        homePath = jre.getPath();
      }
    }

    if (!foundJDKs.contains(homePath)) {
      foundJDKs.add(homePath);
    }
  }
  myFieldWithHistory.setHistory(foundJDKs);
  myPathField = new ComponentWithBrowseButton<TextFieldWithHistory>(myFieldWithHistory, null);
  myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
                                      ExecutionBundle.message("run.configuration.select.jre.dir.label"),
                                      null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
                                      TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

  setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
  add(myCbEnabled, "shrinkx");
  add(myPathField, "growx, pushx");

  InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

  myCbEnabled.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      enabledChanged();
    }
  });
  enabledChanged();

  setAnchor(myCbEnabled);

  updateUI();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:58,代码来源:AlternativeJREPanel.java

示例6: RepositoryWithBranchPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public RepositoryWithBranchPanel(@NotNull final Project project, @NotNull String repoName,
                                 @NotNull String sourceName, @NotNull PushTargetPanel<T> destPushTargetPanelComponent) {
  super();
  setLayout(new BorderLayout());
  myRepositoryCheckbox = new JBCheckBox();
  myRepositoryCheckbox.setFocusable(false);
  myRepositoryCheckbox.setOpaque(false);
  myRepositoryCheckbox.setBorder(null);
  myRepositoryCheckbox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(@NotNull ActionEvent e) {
      fireOnSelectionChange(myRepositoryCheckbox.isSelected());
    }
  });
  myRepositoryLabel = new JLabel(repoName);
  myLocalBranch = new JBLabel(sourceName);
  myArrowLabel = new JLabel(" " + UIUtil.rightArrow() + " ");
  myDestPushTargetPanelComponent = destPushTargetPanelComponent;
  myTextRenderer = new ColoredTreeCellRenderer() {
    public void customizeCellRenderer(@NotNull JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {

    }
  };
  myTextRenderer.setOpaque(false);
  layoutComponents();

  setInputVerifier(new InputVerifier() {
    @Override
    public boolean verify(JComponent input) {
      ValidationInfo error = myDestPushTargetPanelComponent.verify();
      if (error != null) {
        //noinspection ConstantConditions
        PopupUtil.showBalloonForComponent(error.component, error.message, MessageType.WARNING, false, project);
      }
      return error == null;
    }
  });

  JCheckBox emptyBorderCheckBox = new JCheckBox();
  emptyBorderCheckBox.setBorder(null);
  Dimension size = emptyBorderCheckBox.getPreferredSize();
  myCheckBoxWidth = size.width;
  myCheckBoxHeight = size.height;
  myLoadingIcon = LoadingIcon.create(myCheckBoxWidth, size.height);
  myCheckBoxLoadingIconGapH = myCheckBoxWidth - myLoadingIcon.getIconWidth();
  myCheckBoxLoadingIconGapV = size.height - myLoadingIcon.getIconHeight();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:54,代码来源:RepositoryWithBranchPanel.java

示例7: AlternativeJREPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public AlternativeJREPanel() {
    myCbEnabled = new JBCheckBox(ExecutionBundle.message("run.configuration.use.alternate.jre.checkbox"));

    myFieldWithHistory = new TextFieldWithHistory();
    myFieldWithHistory.setHistorySize(-1);
    final List<String> foundJDKs = new ArrayList<>();
    final Sdk[] allJDKs = ProjectJdkTable.getInstance().getAllJdks();

    String javaHomeOfCurrentProcess = System.getProperty("java.home");
    if (javaHomeOfCurrentProcess != null && !javaHomeOfCurrentProcess.isEmpty()) {
        foundJDKs.add(javaHomeOfCurrentProcess);
    }

    for (Sdk sdk : allJDKs) {
        String name = sdk.getName();
        if (!foundJDKs.contains(name)) {
            foundJDKs.add(name);
        }
    }

    for (Sdk jdk : allJDKs) {
        String homePath = jdk.getHomePath();

        if (!SystemInfo.isMac) {
            final File jre = new File(jdk.getHomePath(), "jre");
            if (jre.isDirectory()) {
                homePath = jre.getPath();
            }
        }

        if (!foundJDKs.contains(homePath)) {
            foundJDKs.add(homePath);
        }
    }

    myFieldWithHistory.setHistory(foundJDKs);
    myPathField = new ComponentWithBrowseButton<>(myFieldWithHistory, null);
    myPathField.addBrowseFolderListener(ExecutionBundle.message("run.configuration.select.alternate.jre.label"),
            ExecutionBundle.message("run.configuration.select.jre.dir.label"),
            null, BrowseFilesListener.SINGLE_DIRECTORY_DESCRIPTOR,
            TextComponentAccessor.TEXT_FIELD_WITH_HISTORY_WHOLE_TEXT);

    setLayout(new MigLayout("ins 0, gap 10, fill, flowx"));
    add(myCbEnabled, "shrinkx");
    add(myPathField, "growx, pushx");

    InsertPathAction.addTo(myFieldWithHistory.getTextEditor());

    myCbEnabled.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            enabledChanged();
        }
    });
    enabledChanged();

    setAnchor(myCbEnabled);

    updateUI();
}
 
开发者ID:ligasgr,项目名称:intellij-xquery,代码行数:60,代码来源:AlternativeJREPanel.java

示例8: RepositoryWithBranchPanel

import com.intellij.ui.components.JBCheckBox; //导入方法依赖的package包/类
public RepositoryWithBranchPanel(@Nonnull final Project project, @Nonnull String repoName,
                                 @Nonnull String sourceName, @Nonnull PushTargetPanel<T> destPushTargetPanelComponent) {
  super();
  setLayout(new BorderLayout());
  myRepositoryCheckbox = new JBCheckBox();
  myRepositoryCheckbox.setFocusable(false);
  myRepositoryCheckbox.setOpaque(false);
  myRepositoryCheckbox.setBorder(null);
  myRepositoryCheckbox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(@Nonnull ActionEvent e) {
      fireOnSelectionChange(myRepositoryCheckbox.isSelected());
    }
  });
  myRepositoryLabel = new JLabel(repoName);
  myLocalBranch = new JBLabel(sourceName);
  myArrowLabel = new JLabel(" " + UIUtil.rightArrow() + " ");
  myDestPushTargetPanelComponent = destPushTargetPanelComponent;
  myTextRenderer = new ColoredTreeCellRenderer() {
    @RequiredDispatchThread
    @Override
    public void customizeCellRenderer(@Nonnull JTree tree,
                                      Object value,
                                      boolean selected,
                                      boolean expanded,
                                      boolean leaf,
                                      int row,
                                      boolean hasFocus) {

    }
  };
  myTextRenderer.setOpaque(false);
  layoutComponents();

  setInputVerifier(new InputVerifier() {
    @Override
    public boolean verify(JComponent input) {
      ValidationInfo error = myDestPushTargetPanelComponent.verify();
      if (error != null) {
        //noinspection ConstantConditions
        PopupUtil.showBalloonForComponent(error.component, error.message, MessageType.WARNING, false, project);
      }
      return error == null;
    }
  });

  JCheckBox emptyBorderCheckBox = new JCheckBox();
  emptyBorderCheckBox.setBorder(null);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:50,代码来源:RepositoryWithBranchPanel.java

示例9: 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.addActionListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。