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


Java FixedSizeButton.setIcon方法代码示例

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


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

示例1: createComponentWithMacroBrowse

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
@Deprecated // use MacroComboBoxWithBrowseButton instead
protected JComponent createComponentWithMacroBrowse(@Nonnull final TextFieldWithBrowseButton textAccessor) {
  final FixedSizeButton button = new FixedSizeButton(textAccessor);
  button.setIcon(AllIcons.RunConfigurations.Variables);
  button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      //noinspection unchecked
      final JList list = new JBList(myWorkingDirectoryComboBox.getChildComponent().getModel());
      JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(() -> {
        final Object value = list.getSelectedValue();
        if (value instanceof String) {
          textAccessor.setText((String)value);
        }
      }).setMovable(false).setResizable(false).createPopup().showUnderneathOf(button);
    }
  });

  JPanel panel = new JPanel(new BorderLayout());
  panel.add(textAccessor, BorderLayout.CENTER);
  panel.add(button, BorderLayout.EAST);
  return panel;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:24,代码来源:CommonProgramParametersPanel.java

示例2: ConfigurationArgumentsHelpArea

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public ConfigurationArgumentsHelpArea() {
  super(new BorderLayout());
  add(myPanel);
  setBorder(IdeBorderFactory.createEmptyBorder(10, 0, 0, 0));

  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(new MyCopyAction());
  myHelpArea.addMouseListener(
    new PopupHandler(){
      @Override
      public void invokePopup(final Component comp,final int x,final int y){
        ActionManager.getInstance().createActionPopupMenu(ActionPlaces.UNKNOWN, group).getComponent().show(comp, x, y);
      }
    }
  );

  FixedSizeButton copyButton = new FixedSizeButton(22);
  copyButton.setIcon(PlatformIcons.COPY_ICON);
  copyButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final StringSelection contents = new StringSelection(myHelpArea.getText().trim());
      CopyPasteManager.getInstance().setContents(contents);
    }
  });
  myToolbarPanel.add(copyButton, BorderLayout.NORTH);
  myToolbarPanel.setVisible(false);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:ConfigurationArgumentsHelpArea.java

示例3: createComponent

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public void createComponent() {
  removeAll();
  setLayout(new GridBagLayout());

  if (myLabelText != null) {
    myLabel = new JLabel(myLabelText);
    this.add(myLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));
    myLabel.setLabelFor(myComponent);
  }

  this.add(myComponent, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

  if (myBrowseButtonActionListener != null) {
    FixedSizeButton browseButton = new FixedSizeButton(getComponent());
    myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(browseButton);
    browseButton.setFocusable(false);
    browseButton.addActionListener(myBrowseButtonActionListener);
    myButtons.add(browseButton);
    this.add(browseButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0));
  }
  if (myViewerDialogTitle != null) {
    final FixedSizeButton showViewerButton = new FixedSizeButton(getComponent());
    if (myBrowseButtonActionListener == null) {
      LOG.assertTrue(myDoClickAction == null);
      myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(showViewerButton);
    }
    showViewerButton.setFocusable(false);
    showViewerButton.setIcon(PlatformIcons.OPEN_EDIT_DIALOG_ICON);
    showViewerButton.addActionListener(new ActionListener() {
      public void actionPerformed(ActionEvent e) {
        Viewer viewer = new Viewer();
        viewer.setTitle(myViewerDialogTitle);
        viewer.show();
      }
    });
    myButtons.add(showViewerButton);
    this.add(showViewerButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:AbstractFieldPanel.java

示例4: createComponentWithMacroBrowse

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
protected JComponent createComponentWithMacroBrowse(@NotNull final TextFieldWithBrowseButton textAccessor) {
  final FixedSizeButton button = new FixedSizeButton(textAccessor);
  button.setIcon(AllIcons.RunConfigurations.Variables);
  button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      List<String> macros = new SmartList<String>(PathMacros.getInstance().getUserMacroNames());
      if (myModuleContext != null || myHasModuleMacro) {
        macros.add(PathMacroUtil.MODULE_DIR_MACRO_NAME);
      }

      final JList list = new JBList(ArrayUtil.toStringArray(macros));
      JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
          final Object value = list.getSelectedValue();
          if (value instanceof String) {
            textAccessor.setText('$' + ((String)value) + '$');
          }
        }
      }).setMovable(false).setResizable(false).createPopup().showUnderneathOf(button);
    }
  });

  JPanel panel = new JPanel(new BorderLayout());
  panel.add(textAccessor, BorderLayout.CENTER);
  panel.add(button, BorderLayout.EAST);
  return panel;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:CommonProgramParametersPanel.java

示例5: PropertyValueCellEditor

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public PropertyValueCellEditor() {
  myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this);
  getChildComponent().setBorder(BorderFactory.createLineBorder(Color.black));

  FixedSizeButton button = myComponent.getComponentWithButton().getButton();
  button.setIcon(IconUtil.getAddIcon());
  button.setToolTipText(AntBundle.message("ant.property.value.editor.insert.macro.tooltip.text"));
  button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      MacrosDialog dialog = new MacrosDialog(getChildComponent());
      if (dialog.showAndGet() && dialog.getSelectedMacro() != null) {
        JTextField textField = getChildComponent();

        String macro = dialog.getSelectedMacro().getName();
        int position = textField.getCaretPosition();
        try {
          textField.getDocument().insertString(position, "$" + macro + "$", null);
          textField.setCaretPosition(position + macro.length() + 2);
        }
        catch (BadLocationException ex) {
          LOG.error(ex);
        }
        textField.requestFocus();
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:AntUIUtil.java

示例6: ConfigurationArgumentsHelpArea

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public ConfigurationArgumentsHelpArea() {
  super(new BorderLayout());
  add(myPanel);
  setBorder(IdeBorderFactory.createEmptyBorder(10, 0, 0, 0));

  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(new MyCopyAction());
  myHelpArea.addMouseListener(
    new PopupHandler(){
      public void invokePopup(final Component comp,final int x,final int y){
        createPopupMenu(group).getComponent().show(comp,x,y);
      }
    }
  );

  FixedSizeButton copyButton = new FixedSizeButton(22);
  copyButton.setIcon(PlatformIcons.COPY_ICON);
  copyButton.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final StringSelection contents = new StringSelection(myHelpArea.getText().trim());
      CopyPasteManager.getInstance().setContents(contents);
    }
  });
  myToolbarPanel.add(copyButton, BorderLayout.NORTH);
  myToolbarPanel.setVisible(false);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:28,代码来源:ConfigurationArgumentsHelpArea.java

示例7: PropertyValueCellEditor

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public PropertyValueCellEditor() {
  myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this);
  getChildComponent().setBorder(BorderFactory.createLineBorder(Color.black));

  FixedSizeButton button = myComponent.getComponentWithButton().getButton();
  button.setIcon(IconUtil.getAddIcon());
  button.setToolTipText(AntBundle.message("ant.property.value.editor.insert.macro.tooltip.text"));
  button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      MacrosDialog dialog = new MacrosDialog(getChildComponent());
      dialog.show();
      if (dialog.isOK() && dialog.getSelectedMacro() != null) {
        JTextField textField = getChildComponent();

        String macro = dialog.getSelectedMacro().getName();
        int position = textField.getCaretPosition();
        try {
          textField.getDocument().insertString(position, "$" + macro + "$", null);
          textField.setCaretPosition(position + macro.length() + 2);
        }
        catch (BadLocationException ex) {
          LOG.error(ex);
        }
        textField.requestFocus();
      }
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:29,代码来源:AntUIUtil.java

示例8: PropertyValueCellEditor

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public PropertyValueCellEditor()
{
	myComponent = new CellEditorComponentWithBrowseButton<JTextField>(new TextFieldWithBrowseButton(), this);
	getChildComponent().setBorder(BorderFactory.createLineBorder(Color.black));

	FixedSizeButton button = myComponent.getComponentWithButton().getButton();
	button.setIcon(IconUtil.getAddIcon());
	button.setToolTipText(AntBundle.message("ant.property.value.editor.insert.macro.tooltip.text"));
	button.addActionListener(new ActionListener()
	{
		@Override
		public void actionPerformed(ActionEvent e)
		{
			MacrosDialog dialog = new MacrosDialog(getChildComponent());
			dialog.show();
			if(dialog.isOK() && dialog.getSelectedMacro() != null)
			{
				JTextField textField = getChildComponent();

				String macro = dialog.getSelectedMacro().getName();
				int position = textField.getCaretPosition();
				try
				{
					textField.getDocument().insertString(position, "$" + macro + "$", null);
					textField.setCaretPosition(position + macro.length() + 2);
				}
				catch(BadLocationException ex)
				{
					LOG.error(ex);
				}
				textField.requestFocus();
			}
		}
	});
}
 
开发者ID:consulo,项目名称:consulo-apache-ant,代码行数:36,代码来源:AntUIUtil.java

示例9: createComponent

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
public void createComponent() {
  removeAll();
  setLayout(new GridBagLayout());

  if (myLabelText != null) {
    myLabel = new JLabel(myLabelText);
    this.add(myLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));
    myLabel.setLabelFor(myComponent);
  }

  this.add(myComponent, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

  if (myBrowseButtonActionListener != null) {
    FixedSizeButton browseButton = new FixedSizeButton(getComponent());
    myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(browseButton);
    browseButton.setFocusable(false);
    browseButton.addActionListener(myBrowseButtonActionListener);
    myButtons.add(browseButton);
    this.add(browseButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 2, 0, 0), 0, 0));
  }
  if (myViewerDialogTitle != null) {
    final FixedSizeButton showViewerButton = new FixedSizeButton(getComponent());
    if (myBrowseButtonActionListener == null) {
      LOG.assertTrue(myDoClickAction == null);
      myDoClickAction = new TextFieldWithBrowseButton.MyDoClickAction(showViewerButton);
    }
    showViewerButton.setFocusable(false);
    showViewerButton.setIcon(AllIcons.Actions.ShowViewer);
    showViewerButton.addActionListener(new ActionListener() {
      @Override
      public void actionPerformed(ActionEvent e) {
        Viewer viewer = new Viewer();
        viewer.setTitle(myViewerDialogTitle);
        viewer.show();
      }
    });
    myButtons.add(showViewerButton);
    this.add(showViewerButton, new GridBagConstraints(GridBagConstraints.RELATIVE, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:41,代码来源:AbstractFieldPanel.java

示例10: layoutPanel

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
private void layoutPanel() {
  myCoursesComboBox = new ComboBox<>();

  final LabeledComponent<ComboBox> coursesCombo = LabeledComponent.create(myCoursesComboBox, "Courses:", BorderLayout.WEST);

  myRefreshButton = new FixedSizeButton(coursesCombo);
  if (SystemInfo.isMac && !UIUtil.isUnderDarcula())
    myRefreshButton.putClientProperty("JButton.buttonType", null);
  myRefreshButton.setIcon(AllIcons.Actions.Refresh);
  myBrowseButton = new FixedSizeButton(coursesCombo);

  final JPanel comboPanel = new JPanel(new BorderLayout());
  comboPanel.add(coursesCombo, BorderLayout.CENTER);
  comboPanel.add(myRefreshButton, BorderLayout.EAST);

  final JPanel coursesPanel = new JPanel(new BorderLayout());
  coursesPanel.add(comboPanel, BorderLayout.CENTER);
  coursesPanel.add(myBrowseButton, BorderLayout.EAST);

  add(coursesPanel);
  myAnchor = coursesCombo;

  final JPanel panel = new JPanel(new BorderLayout());
  final JLabel invisibleLabel = new JLabel();
  invisibleLabel.setPreferredSize(new JLabel("Location: ").getPreferredSize());
  panel.add(invisibleLabel, BorderLayout.WEST);

  myInfoPanel = new JPanel(new VerticalFlowLayout());
  myAuthorLabel = new JLabel();
  myDescriptionPane = new JTextPane();
  myDescriptionPane.setEditable(true);
  myDescriptionPane.setEnabled(true);
  myAuthorLabel.setEnabled(true);
  myDescriptionPane.setPreferredSize(new Dimension(150, 200));
  myDescriptionPane.setFont(coursesCombo.getFont());
  myInfoPanel.add(myAuthorLabel);
  myInfoPanel.add(new JBScrollPane(myDescriptionPane));

  panel.add(myInfoPanel, BorderLayout.CENTER);
  add(panel);
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:42,代码来源:StudyNewProjectPanel.java

示例11: initComponents

import com.intellij.openapi.ui.FixedSizeButton; //导入方法依赖的package包/类
protected void initComponents() {
  myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
                                                         ExecutionBundle.message("run.configuration.program.parameters"));

  final JPanel panel = new JPanel(new BorderLayout());
  myWorkingDirectoryField = new TextFieldWithBrowseButton(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
      fileChooserDescriptor.setTitle(ExecutionBundle.message("select.working.directory.message"));
      fileChooserDescriptor.putUserData(LangDataKeys.MODULE_CONTEXT, myModuleContext);
      Project project = myModuleContext != null ? myModuleContext.getProject() : null;
      VirtualFile file = FileChooser.chooseFile(fileChooserDescriptor, myWorkingDirectoryComponent, project, null);
      if (file != null) {
        setWorkingDirectory(file.getPresentableUrl());
      }
    }
  }) {
    @Override
    protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor) {
      super.installPathCompletion(FileChooserDescriptorFactory.createSingleFolderDescriptor());
    }
  };
  panel.add(myWorkingDirectoryField, BorderLayout.CENTER);

  final FixedSizeButton button = new FixedSizeButton(myWorkingDirectoryField);
  button.setIcon(AllIcons.RunConfigurations.Variables);
  button.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      final List<String> macros = new ArrayList<String>(PathMacros.getInstance().getUserMacroNames());
      if (myHaveModuleContext) macros.add("MODULE_DIR");

      final JList list = new JBList(ArrayUtil.toStringArray(macros));
      final JBPopup popup = JBPopupFactory.getInstance().createListPopupBuilder(list).setItemChoosenCallback(new Runnable() {
        @Override
        public void run() {
          final Object value = list.getSelectedValue();
          if (value instanceof String) {
            setWorkingDirectory("$" + value + "$");
          }
        }
      }).setMovable(false).setResizable(false).createPopup();
      popup.showUnderneathOf(button);
    }
  });
  panel.add(button, BorderLayout.EAST);

  myWorkingDirectoryComponent = LabeledComponent.create(panel, ExecutionBundle.message("run.configuration.working.directory.label"));
  myEnvVariablesComponent = new EnvironmentVariablesComponent();

  myEnvVariablesComponent.setLabelLocation(BorderLayout.WEST);
  myProgramParametersComponent.setLabelLocation(BorderLayout.WEST);
  myWorkingDirectoryComponent.setLabelLocation(BorderLayout.WEST);

  addComponents();

  setPreferredSize(new Dimension(10, 10));

  setAnchor(myEnvVariablesComponent.getLabel());
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:62,代码来源:CommonProgramParametersPanel.java


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