Java 类com.intellij.util.ui.JBUI 实例源码

项目:CodeGen    文件:TablePanel.java   
public TablePanel(Table table) {
    $$$setupUI$$$();
    rootPanel.setBorder(IdeBorderFactory.createTitledBorder(table.getTableName(), false));

    //不可整列移动
    fieldTable.getTableHeader().setReorderingAllowed(false);
    //不可拉动表格
    fieldTable.getTableHeader().setResizingAllowed(false);
    fieldTable.getEmptyText().setText("No Columns");
    JPanel panel = ToolbarDecorator.createDecorator(fieldTable)
            .setAddAction(it -> addAction())
            .setRemoveAction(it -> removeAction())
            .setEditAction(it -> editAction())
            .createPanel();
    panel.setPreferredSize(JBUI.size(300, 200));
    columnsPanel.setBorder(IdeBorderFactory.createTitledBorder("Columns", false));
    columnsPanel.add(panel, BorderLayout.CENTER);

    mainPanel.add(columnsPanel);

    modelTextField.setText(table.getModelName());
    tableTextField.setText(table.getTableName());
    initFields(table.getFields());

    this.getRootComponent().registerKeyboardAction(e -> this.getRootComponent().disable(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
项目:intellij-ce-playground    文件:AnalyzeStacktraceUtil.java   
public static StacktraceEditorPanel createEditorPanel(Project project, @NotNull Disposable parentDisposable) {
  EditorFactory editorFactory = EditorFactory.getInstance();
  Document document = editorFactory.createDocument("");
  Editor editor = editorFactory.createEditor(document, project);
  EditorSettings settings = editor.getSettings();
  settings.setFoldingOutlineShown(false);
  settings.setLineMarkerAreaShown(false);
  settings.setIndentGuidesShown(false);
  settings.setLineNumbersShown(false);
  settings.setRightMarginShown(false);

  StacktraceEditorPanel editorPanel = new StacktraceEditorPanel(project, editor);
  editorPanel.setPreferredSize(JBUI.size(600, 400));
  Disposer.register(parentDisposable, editorPanel);
  return editorPanel;
}
项目:intellij-ce-playground    文件:ConflictsDialog.java   
@Override
protected JComponent createCenterPanel() {
  JPanel panel = new JPanel(new BorderLayout(0, 2));

  panel.add(new JLabel(RefactoringBundle.message("the.following.problems.were.found")), BorderLayout.NORTH);

  @NonNls StringBuilder buf = new StringBuilder();
  for (String description : myConflictDescriptions) {
    buf.append(description);
    buf.append("<br><br>");
  }
  JEditorPane messagePane = new JEditorPane(UIUtil.HTML_MIME, buf.toString());
  messagePane.setEditable(false);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(messagePane,
                                                              ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
                                                              ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.setPreferredSize(JBUI.size(500, 400));
  panel.add(scrollPane, BorderLayout.CENTER);

  if (getOKAction().isEnabled()) {
    panel.add(new JLabel(RefactoringBundle.message("do.you.wish.to.ignore.them.and.continue")), BorderLayout.SOUTH);
  }

  return panel;
}
项目:intellij-ce-playground    文件:EditClassFiltersDialog.java   
protected JComponent createCenterPanel() {
  JPanel contentPanel = new JPanel(new BorderLayout());

  Box mainPanel = Box.createHorizontalBox();

  myClassFilterEditor = new ClassFilterEditor(myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern");
  myClassFilterEditor.setPreferredSize(JBUI.size(400, 200));
  myClassFilterEditor.setBorder(IdeBorderFactory.createTitledBorder(
    DebuggerBundle.message("class.filters.dialog.inclusion.filters.group"), false));
  mainPanel.add(myClassFilterEditor);

  myClassExclusionFilterEditor = new ClassFilterEditor(myProject, myChooserFilter, "reference.viewBreakpoints.classFilters.newPattern");
  myClassExclusionFilterEditor.setPreferredSize(JBUI.size(400, 200));
  myClassExclusionFilterEditor.setBorder(IdeBorderFactory.createTitledBorder(
    DebuggerBundle.message("class.filters.dialog.exclusion.filters.group"), false));
  mainPanel.add(myClassExclusionFilterEditor);

  contentPanel.add(mainPanel, BorderLayout.CENTER);

  return contentPanel;
}
项目:intellij-ce-playground    文件:DarculaCheckBoxUI.java   
protected void paintCheckSign(Graphics2D g, boolean enabled, int w, int h) {
  g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
  g.setStroke(new BasicStroke(1 * JBUI.scale(2.0f), BasicStroke.CAP_ROUND,BasicStroke.JOIN_ROUND));
  g.setPaint(getShadowColor(enabled, true));
  final int x1 = JBUI.scale(4);
  final int y1 = JBUI.scale(7);
  final int x2 = JBUI.scale(7);
  final int y2 = JBUI.scale(11);
  final int x3 = w;
  final int y3 = JBUI.scale(2);

  g.drawLine(x1, y1, x2, y2);
  g.drawLine(x2, y2, x3, y3);
  g.setPaint(getCheckSignColor(enabled, true));
  g.translate(0, -2);
  g.drawLine(x1, y1, x2, y2);
  g.drawLine(x2, y2, x3, y3);
  g.translate(0, 2);
}
项目:intellij-ce-playground    文件:RestoreReferencesDialog.java   
@Override
protected JComponent createCenterPanel() {
  final JPanel panel = new JPanel(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP));
  myList = new JBList(myNamedElements);
  myList.setCellRenderer(new FQNameCellRenderer());
  panel.add(ScrollPaneFactory.createScrollPane(myList), BorderLayout.CENTER);

  panel.add(new JBLabel(myContainsClassesOnly ?
                        CodeInsightBundle.message("dialog.paste.on.import.text") :
                        CodeInsightBundle.message("dialog.paste.on.import.text2"), SMALL, BRIGHTER), BorderLayout.NORTH);

  final JPanel buttonPanel = new JPanel(new VerticalFlowLayout());
  final JButton okButton = new JButton(CommonBundle.getOkButtonText());
  getRootPane().setDefaultButton(okButton);
  buttonPanel.add(okButton);
  final JButton cancelButton = new JButton(CommonBundle.getCancelButtonText());
  buttonPanel.add(cancelButton);

  panel.setPreferredSize(JBUI.size(500, 400));

  return panel;
}
项目:intellij-ce-playground    文件:DirDiffFrame.java   
public DirDiffFrame(Project project, DirDiffTableModel model) {
  super(project, "DirDiffDialog");
  setSize(JBUI.size(800, 600));
  setTitle(model.getTitle());
  myPanel = new DirDiffPanel(model, new DirDiffWindow(this));
  Disposer.register(this, myPanel);
  setComponent(myPanel.getPanel());
  if (project != null) {
    setProject(project);
  }
  closeOnEsc();
  DataManager.registerDataProvider(myPanel.getPanel(), new DataProvider() {
    @Override
    public Object getData(@NonNls String dataId) {
      if (PlatformDataKeys.HELP_ID.is(dataId)) {
        return "reference.dialogs.diff.folder";
      }
      return null;
    }
  });
}
项目:intellij-ce-playground    文件:SearchTextArea.java   
public SearchTextArea(boolean search) {
  myTextArea = new JTextArea();
  setBorder(JBUI.Borders.empty(6, 6, 6, 8));
  setLayout(new BorderLayout(JBUI.scale(4), 0));
  myTextArea.addPropertyChangeListener("background", this);
  myTextArea.addFocusListener(this);
  myTextArea.setBorder(null);
  myTextArea.setOpaque(false);
  JBScrollPane scrollPane = new JBScrollPane(myTextArea,
                                             ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                                             ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
  scrollPane.getVerticalScrollBar().setBackground(UIUtil.TRANSPARENT_COLOR);
  scrollPane.getViewport().setBorder(null);
  scrollPane.getViewport().setOpaque(false);
  scrollPane.setBorder(JBUI.Borders.emptyRight(2));
  scrollPane.setOpaque(false);
  ShowHistoryAction historyAction = new ShowHistoryAction(search);
  ActionButton button =
    new ActionButton(historyAction, historyAction.getTemplatePresentation(), ActionPlaces.UNKNOWN, new Dimension(JBUI.scale(16), JBUI.scale(16)));
  button.setLook(new InplaceActionButtonLook());
  JPanel p = new NonOpaquePanel(new BorderLayout());
  p.add(button, BorderLayout.NORTH);
  add(p, BorderLayout.WEST);
  add(scrollPane, BorderLayout.CENTER);
}
项目:intellij-ce-playground    文件:VcsPushDialog.java   
@NotNull
private JComponent createForcePushInfoLabel() {
  JPanel text = new JPanel();
  text.setLayout(new BoxLayout(text, BoxLayout.X_AXIS));
  JLabel label = new JLabel("You can enable and configure Force Push in " + ShowSettingsUtil.getSettingsMenuName() + ".");
  label.setEnabled(false);
  label.setFont(JBUI.Fonts.smallFont());
  text.add(label);
  ActionLink here = new ActionLink("Configure", new AnAction() {
    @Override
    public void actionPerformed(AnActionEvent e) {
      Project project = myController.getProject();
      VcsPushDialog.this.doCancelAction(e.getInputEvent());
      ShowSettingsUtilImpl.showSettingsDialog(project, "vcs.Git", "force push");
    }
  });
  here.setFont(JBUI.Fonts.smallFont());
  text.add(here);
  return JBUI.Panels.simplePanel().addToRight(text).withBorder(JBUI.Borders.emptyBottom(4));
}
项目:intellij-ce-playground    文件:MacIntelliJComboBoxUI.java   
@Override
protected JButton createArrowButton() {
  final Color bg = myComboBox.getBackground();
  final Color fg = myComboBox.getForeground();
  JButton button = new BasicArrowButton(SwingConstants.SOUTH, bg, fg, fg, fg) {
    @Override
    public void paint(Graphics g2) {
      Icon icon = MacIntelliJIconCache.getIcon("comboRight", false, myComboBox.hasFocus(), myComboBox.isEnabled());
      icon.paintIcon(this, g2, 0, 0);
    }

    @Override
    public Dimension getPreferredSize() {
      return JBUI.size(DEFAULT_ICON.getIconWidth(), DEFAULT_ICON.getIconHeight());
    }
  };
  button.setBorder(BorderFactory.createEmptyBorder());
  button.setOpaque(false);
  return button;
}
项目:intellij-ce-playground    文件:AgreementDialog.java   
protected JComponent createCenterPanel() {
  JTextArea licenseTextArea = new JTextArea(myText, 20, 50);
  licenseTextArea.getCaret().setDot(0);
  licenseTextArea.setFont(myFont);
  licenseTextArea.setLineWrap(true);
  licenseTextArea.setWrapStyleWord(true);
  licenseTextArea.setEditable(false);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(licenseTextArea);

  JPanel agreePanel = new JPanel(new GridLayout(1, 1));
  agreePanel.setBorder(JBUI.Borders.empty(10, 5, 5, 5));
  myAcceptCheckBox = new JCheckBox(myBundle.getString("license.agreement.accept.checkbox"));
  myAcceptCheckBox.setMnemonic(myAcceptCheckBox.getText().charAt(0));
  myAcceptCheckBox.setFont(myFont);
  agreePanel.add(myAcceptCheckBox);
  myAcceptCheckBox.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent event) {
      getOKAction().setEnabled(myAcceptCheckBox.isSelected());
    }
  });

  return JBUI.Panels.simplePanel()
    .addToCenter(scrollPane)
    .addToBottom(agreePanel);
}
项目:intellij-ce-playground    文件:VerticalFlowLayout.java   
@Override
public Dimension minimumLayoutSize(Container container) {
  Dimension dimension = JBUI.emptySize();
  for(int i = 0; i < container.getComponentCount(); i++){
    Component component = container.getComponent(i);
    if (!component.isVisible()) continue;
    Dimension dimension1 = component.getMinimumSize();
    dimension.width = Math.max(dimension.width, dimension1.width);
    if (i > 0){
      dimension.height += vGap;
    }
    dimension.height += dimension1.height;
  }
  addInsets(dimension, container);
  return dimension;
}
项目:intellij-ce-playground    文件:SaveSchemeDialog.java   
@Override
protected JComponent createNorthPanel() {
  JPanel panel = new JPanel(new GridBagLayout());
  GridBagConstraints gc = new GridBagConstraints();
  gc.gridx = 0;
  gc.gridy = 0;
  gc.weightx = 0;
  gc.insets = new Insets(5, 0, 5, 5);
  panel.add(new JLabel(ApplicationBundle.message("label.name")), gc);

  gc = new GridBagConstraints();
  gc.gridx = 1;
  gc.gridy = 0;
  gc.weightx = 1;
  gc.fill = GridBagConstraints.HORIZONTAL;
  gc.gridwidth = 2;
  gc.insets = new Insets(0, 0, 5, 0);
  panel.add(mySchemeName, gc);

  panel.setPreferredSize(JBUI.size(220, 40));
  return panel;
}
项目:intellij-ce-playground    文件:Splash.java   
private void paintProgress(Graphics g) {
  final Color color = getProgressColor();
  if (color == null) return;

  if (!mySplashIsVisible) {
    myImage.paintIcon(this, g, 0, 0);
    mySplashIsVisible = true;
  }

  int totalWidth = myImage.getIconWidth() - getProgressX();
  if (Registry.is("ide.new.about")) {
    totalWidth +=3;
  }
  final int progressWidth = (int)(totalWidth * myProgress);
  final int width = progressWidth - myProgressLastPosition;
  g.setColor(color);
  g.fillRect(getProgressX(), getProgressY(), width, getProgressHeight());
  if (myProgressTail != null) {
    myProgressTail.paintIcon(this, g, (int)(width - (myProgressTail.getIconWidth() / JBUI.scale(1f) / 2f * JBUI.scale(1f))),
                             (int)(getProgressY() - (myProgressTail.getIconHeight() - getProgressHeight()) / JBUI.scale(1f) / 2f * JBUI.scale(1f))); //I'll buy you a beer if you understand this line without playing with it
  }
  myProgressLastPosition = progressWidth;
}
项目:intellij-ce-playground    文件:NewRecentProjectPanel.java   
public NewRecentProjectPanel(Disposable parentDisposable) {
  super(parentDisposable);
  setBorder(null);
  setBackground(FlatWelcomeFrame.getProjectsBackground());
  JScrollPane scrollPane = UIUtil.findComponentOfType(this, JScrollPane.class);
  if (scrollPane != null) {
    scrollPane.setBackground(FlatWelcomeFrame.getProjectsBackground());
    final int width = 300;
    final int height = 460;
    scrollPane.setSize(JBUI.size(width, height));
    scrollPane.setMinimumSize(JBUI.size(width, height));
    scrollPane.setPreferredSize(JBUI.size(width, height));
  }
  ListWithFilter panel = UIUtil.findComponentOfType(this, ListWithFilter.class);
  if (panel != null) {
    panel.setBackground(FlatWelcomeFrame.getProjectsBackground());
  }
}
项目:intellij-ce-playground    文件:FlatWelcomeFrame.java   
private JComponent createActionLink(final String text, final String groupId, Icon icon, boolean focusListOnLeft) {
  final Ref<ActionLink> ref = new Ref<ActionLink>(null);
  AnAction action = new AnAction() {
    @Override
    public void actionPerformed(@NotNull AnActionEvent e) {
      ActionGroup configureGroup = (ActionGroup)ActionManager.getInstance().getAction(groupId);
      final PopupFactoryImpl.ActionGroupPopup popup = (PopupFactoryImpl.ActionGroupPopup)JBPopupFactory.getInstance()
        .createActionGroupPopup(null, new IconsFreeActionGroup(configureGroup), e.getDataContext(), JBPopupFactory.ActionSelectionAid.SPEEDSEARCH, false,
                                ActionPlaces.WELCOME_SCREEN);
      popup.showUnderneathOfLabel(ref.get());
      UsageTrigger.trigger("welcome.screen." + groupId);
    }
  };
  ref.set(new ActionLink(text, icon, action));
  ref.get().setPaintUnderline(false);
  ref.get().setNormalColor(getLinkNormalColor());
  NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
  panel.setBorder(JBUI.Borders.empty(4, 6, 4, 6));
  panel.add(ref.get());
  panel.add(createArrow(ref.get()), BorderLayout.EAST);
  installFocusable(panel, action, KeyEvent.VK_UP, KeyEvent.VK_DOWN, focusListOnLeft);
  return panel;
}
项目:intellij-ce-playground    文件:IdeStatusBarImpl.java   
IdeStatusBarImpl(@Nullable IdeStatusBarImpl master) {
  setLayout(new BorderLayout());
  setBorder(JBUI.Borders.empty());

  myInfoAndProgressPanel = new InfoAndProgressPanel();
  addWidget(myInfoAndProgressPanel, Position.CENTER);

  setOpaque(true);
  updateUI();

  if (master == null) {
    Disposer.register(Disposer.get("ui"), this);
  }

  if (master == null) {
    addWidget(new ToolWindowsWidget(this), Position.LEFT);
  }

  enableEvents(AWTEvent.MOUSE_EVENT_MASK);
  enableEvents(AWTEvent.MOUSE_MOTION_EVENT_MASK);
}
项目:intellij-ce-playground    文件:EditorGutterComponentImpl.java   
@SuppressWarnings("SuspiciousNameCombination")
private void drawSquareWithMinus(Graphics2D g,
                                 int anchorX,
                                 int y,
                                 int width,
                                 boolean active) {
  g.setColor(myEditor.getBackgroundColor());
  g.fillRect(anchorX, y, width, width);

  g.setColor(getOutlineColor(active));
  g.drawRect(anchorX, y, width, width);
  final int off = JBUI.scale(2);
  // Draw plus
  if (!active) g.setColor(getOutlineColor(true));
  UIUtil.drawLine(g, anchorX + off, y + width / 2, anchorX + width - off, y + width / 2);
}
项目:intellij-ce-playground    文件:StripeButton.java   
private void init() {
  setFocusable(false);
  setBackground(ourBackgroundColor);
  final Border border = JBUI.Borders.empty(5, 5, 0, 5);
  setBorder(border);
  updatePresentation();
  apply(myDecorator.getWindowInfo());
  addActionListener(this);
  addMouseListener(new MyPopupHandler());
  setRolloverEnabled(true);
  setOpaque(false);

  enableEvents(AWTEvent.MOUSE_EVENT_MASK);

  addMouseMotionListener(new MouseMotionAdapter() {
    @Override
    public void mouseDragged(final MouseEvent e) {
      processDrag(e);
    }
  });
  KeymapManager.getInstance().addKeymapManagerListener(myKeymapListener, this);
}
项目:intellij-ce-playground    文件:IdeBackgroundUtil.java   
public static void initFramePainters(@NotNull PaintersHelper painters) {
  PaintersHelper.initWallpaperPainter("idea.wallpaper.ide", painters);

  ApplicationInfoEx appInfo = ApplicationInfoEx.getInstanceEx();
  String path = UIUtil.isUnderDarcula()? appInfo.getEditorBackgroundImageUrl() : null;
  URL url = path == null ? null : appInfo.getClass().getResource(path);
  Image centerImage = url == null ? null : ImageLoader.loadFromUrl(url);

  if (centerImage != null) {
    painters.addPainter(PaintersHelper.newImagePainter(centerImage, PaintersHelper.FillType.TOP_CENTER, 1.0f, JBUI.insets(10, 0, 0, 0)), null);
  }
  painters.addPainter(new AbstractPainter() {
    EditorEmptyTextPainter p = ServiceManager.getService(EditorEmptyTextPainter.class);

    @Override
    public boolean needsRepaint() {
      return true;
    }

    @Override
    public void executePaint(Component component, Graphics2D g) {
      p.paintEmptyText((JComponent)component, g);
    }
  }, null);

}
项目:intellij-ce-playground    文件:IdeRootPane.java   
public Dimension preferredLayoutSize(Container parent) {
  Dimension rd, mbd;
  Insets i = getInsets();

  if (contentPane != null) {
    rd = contentPane.getPreferredSize();
  }
  else {
    rd = parent.getSize();
  }
  if (menuBar != null && menuBar.isVisible() && !myFullScreen) {
    mbd = menuBar.getPreferredSize();
  }
  else {
    mbd = JBUI.emptySize();
  }
  return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right,
                       rd.height + mbd.height + i.top + i.bottom);
}
项目:intellij-ce-playground    文件:IdeRootPane.java   
public Dimension minimumLayoutSize(Container parent) {
  Dimension rd, mbd;
  Insets i = getInsets();
  if (contentPane != null) {
    rd = contentPane.getMinimumSize();
  }
  else {
    rd = parent.getSize();
  }
  if (menuBar != null && menuBar.isVisible() && !myFullScreen) {
    mbd = menuBar.getMinimumSize();
  }
  else {
    mbd = JBUI.emptySize();
  }
  return new Dimension(Math.max(rd.width, mbd.width) + i.left + i.right,
                       rd.height + mbd.height + i.top + i.bottom);
}
项目:intellij-ce-playground    文件:IdeRootPane.java   
public Dimension maximumLayoutSize(Container target) {
  Dimension rd, mbd;
  Insets i = getInsets();
  if (menuBar != null && menuBar.isVisible() && !myFullScreen) {
    mbd = menuBar.getMaximumSize();
  }
  else {
    mbd = JBUI.emptySize();
  }
  if (contentPane != null) {
    rd = contentPane.getMaximumSize();
  }
  else {
    rd = new Dimension(Integer.MAX_VALUE,
                       Integer.MAX_VALUE - i.top - i.bottom - mbd.height - 1);
  }
  return new Dimension(Math.min(rd.width, mbd.width) + i.left + i.right,
                       rd.height + mbd.height + i.top + i.bottom);
}
项目:intellij-ce-playground    文件:EditorEmptyTextPainter.java   
public void paintEmptyText(@NotNull final JComponent splitters, @NotNull Graphics g) {
  UISettings.setupAntialiasing(g);
  g.setColor(new JBColor(Gray._80, Gray._160));
  g.setFont(JBUI.Fonts.label(16f));
  UIUtil.TextPainter painter = new UIUtil.TextPainter().withLineSpacing(1.8f);
  advertiseActions(splitters, painter);
  painter.draw(g, new PairFunction<Integer, Integer, Couple<Integer>>() {
    @Override
    public Couple<Integer> fun(Integer width, Integer height) {
      Dimension s = splitters.getSize();
      int w = (s.width - width) / 2;
      int h = s.height * 3 / 8; // fix vertical position @ golden ratio
      return Couple.of(w, h);
    }
  });
}
项目:intellij-ce-playground    文件:UnsafeUsagesDialog.java   
@Override
protected JComponent createCenterPanel() {
  JPanel panel = new JPanel(new BorderLayout());
  myMessagePane = new JEditorPane(UIUtil.HTML_MIME, "");
  myMessagePane.setEditable(false);
  JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myMessagePane);
  scrollPane.setPreferredSize(JBUI.size(500, 400));
  panel.add(new JLabel(RefactoringBundle.message("the.following.problems.were.found")), BorderLayout.NORTH);
  panel.add(scrollPane, BorderLayout.CENTER);

  @NonNls StringBuffer buf = new StringBuffer();
  for (String description : myConflictDescriptions) {
    buf.append(description);
    buf.append("<br><br>");
  }
  myMessagePane.setText(buf.toString());
  return panel;
}
项目:educational-plugin    文件:EduCoursesPanel.java   
private static JLabel createTagLabel(String tagText) {
  Border emptyBorder = JBUI.Borders.empty(3, 5);
  JBLabel label = new JBLabel(tagText);
  label.setOpaque(true);
  label.setBorder(emptyBorder);
  label.setBackground(new JBColor(COLOR, COLOR));
  return label;
}
项目:educational-plugin    文件:StudyStepicUserWidget.java   
@Override
public Dimension getPreferredSize() {
  final Dimension preferredSize = super.getPreferredSize();
  final int width = JBUI.scale(300);
  if (preferredSize.width < width){
    preferredSize.width = width;
  }
  return preferredSize;
}
项目:CodeGen    文件:TemplateEditorUI.java   
public TemplateEditorUI() {
    $$$setupUI$$$();
    this.rootPanel.setPreferredSize(JBUI.size(340, 100));
    this.editor = emptyEditor();
    this.rootPanel.add(this.editor.getComponent(), BorderLayout.CENTER);
    infoPanel.setBorder(BorderFactory.createEmptyBorder(0, 0, 5, 0));
}
项目:MissingInActions    文件:TextPaneTableCellRenderer.java   
public TextPaneTableCellRenderer(@Nullable String contentType) {
    super(new GridBagLayout());
    if (contentType != null) {
        myPane.setContentType(contentType);
    }

    add(myPane,
            new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.emptyInsets(), 0, 0));
}
项目:MissingInActions    文件:ApplicationSettingsForm.java   
public void setContentBody(String text) {
    JLabel label = new JLabel();
    Font font = label.getFont();
    Color textColor = label.getForeground();
    String out = "<html><head></head><body><div style='font-family:" + font.getFontName() + ";" + "font-size:" + JBUI.scale(font.getSize()) + "pt; color:" + Utils.toRgbString(textColor) + "'>" +
            (text == null ? "" : text) +
            "</div></body></html>";
    myCaretVisualAttributesPane.setText(out);
    myMainPanel.validate();
}
项目:MissingInActions    文件:ContentChooser.java   
private void updateViewerForSelection() {
    if (myAllContents.isEmpty()) return;
    String fullString = getSelectedText();

    if (myViewer != null) {
        EditorFactory.getInstance().releaseEditor(myViewer);
    }

    if (myUseIdeaEditor) {
        myViewer = createIdeaEditor(fullString);
        JComponent component = myViewer.getComponent();
        JComponent aboveEditorComponent = getAboveEditorComponent();
        component.setPreferredSize(JBUI.size(300, 500));
        if (aboveEditorComponent != null) {
            JPanel panel = JBUI.Panels.simplePanel(0, 10)
                    .addToTop(aboveEditorComponent)
                    .addToCenter(component);

            mySplitter.setSecondComponent(panel);
        } else {
            mySplitter.setSecondComponent(component);
        }
        updateViewerForSelection(myViewer, myAllContents, getSelectedIndices());
    } else {
        final JTextArea textArea = new JTextArea(fullString);
        textArea.setRows(3);
        textArea.setWrapStyleWord(true);
        textArea.setLineWrap(true);
        textArea.setSelectionStart(0);
        textArea.setSelectionEnd(textArea.getText().length());
        textArea.setEditable(false);
        mySplitter.setSecondComponent(ScrollPaneFactory.createScrollPane(textArea));
    }
    mySplitter.revalidate();
}
项目:MissingInActions    文件:ComboBoxAction.java   
@Override
public JComponent createCustomComponent(Presentation presentation) {
    JPanel panel = new JPanel(new GridBagLayout());
    ComboBoxButton button = createComboBoxButton(presentation);
    panel.add(button,
            new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.BOTH, JBUI.insets(0, 3, 0, 3), 0, 0));
    return panel;
}
项目:MissingInActions    文件:ComboBoxAction.java   
@Override
public Dimension getPreferredSize() {
    final boolean isEmpty = getIcon() == null && StringUtil.isEmpty(getText());
    int width = isEmpty ? JBUI.scale(10) + getArrowIcon().getIconWidth() : super.getPreferredSize().width;
    if (isSmallVariant() && !((SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()))) {
        width += JBUI.scale(4);
        if (UIUtil.isUnderWin10LookAndFeel()) {
            width += JBUI.scale(8);
        }
    }
    return new Dimension(width, isSmallVariant() ? JBUI.scale(19) : super.getPreferredSize().height);
}
项目:intellij-ce-playground    文件:DarculaLaf.java   
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private void patchStyledEditorKit(UIDefaults defaults) {
  URL url = getClass().getResource(getPrefix() + (JBUI.isHiDPI() ? "@2x.css" : ".css"));
  StyleSheet styleSheet = UIUtil.loadStyleSheet(url);
  defaults.put("StyledEditorKit.JBDefaultStyle", styleSheet);
  try {
    Field keyField = HTMLEditorKit.class.getDeclaredField("DEFAULT_STYLES_KEY");
    keyField.setAccessible(true);
    AppContext.getAppContext().put(keyField.get(null), UIUtil.loadStyleSheet(url));
  }
  catch (Exception e) {
    log(e);
  }
}
项目:intellij-ce-playground    文件:ChooserDialog.java   
public ChooserDialog(final Project project, ElementsChooser<T> chooser, final String title, final String description) {
  super(project, true);
  myChooser = chooser;
  myChooser.setPreferredSize(JBUI.size(300, 150));
  setTitle(title);
  myDescription = description;

  init();
}
项目:intellij-ce-playground    文件:GenerateTemplateConfigurable.java   
public JComponent createComponent() {
  final JComponent component = myEditor.getComponent();
  if (availableImplicits.isEmpty()) {
    return component;
  }
  final JPanel panel = new JPanel(new BorderLayout());
  panel.add(component, BorderLayout.CENTER);
  MultiLineLabel label =
    new MultiLineLabel("<html>Available implicit variables:\n" + StringUtil.join(availableImplicits, ", ") + "</html>");
  label.setPreferredSize(JBUI.size(250, 30));
  panel.add(label, BorderLayout.SOUTH);
  return panel;
}
项目:intellij-ce-playground    文件:DarculaTextFieldUI.java   
protected Rectangle getDrawingRect() {
  final JTextComponent c = myTextField;
  final JBInsets i = JBInsets.create(c.getInsets());
  final int x = i.right - JBUI.scale(4) - JBUI.scale(16);
  final int y = i.top - 3;
  final int w = c.getWidth() - i.width() + JBUI.scale(16*2 +7*2  - 5);
  int h = c.getBounds().height - i.height() + JBUI.scale(4*2 - 3);
  if (h%2==1) h++;
  return new Rectangle(x, y, w, h);
}
项目:intellij-ce-playground    文件:AbstractNavBarUI.java   
@Override
public Insets getWrapperPanelInsets(Insets insets) {
  final JBInsets result = JBUI.insets(insets);
  if (shouldPaintWrapperPanel()) {
    result.top += JBUI.scale(1);
  }
  return result;
}
项目:intellij-ce-playground    文件:EditInstanceFiltersDialog.java   
protected JComponent createCenterPanel() {
  JPanel contentPanel = new JPanel(new BorderLayout());

  Box mainPanel = Box.createHorizontalBox();

  myInstanceFilterEditor = new InstanceFilterEditor(myProject);
  myInstanceFilterEditor.setPreferredSize(JBUI.size(400, 200));
  myInstanceFilterEditor.setBorder(IdeBorderFactory.createTitledBorder(
    DebuggerBundle.message("instance.filters.dialog.instance.filters.group"), false));
  mainPanel.add(myInstanceFilterEditor);

  contentPanel.add(mainPanel, BorderLayout.CENTER);

  return contentPanel;
}
项目:intellij-ce-playground    文件:FileChooserDialogImpl.java   
@Nullable
protected final JComponent createTitlePane() {
  final String description = myChooserDescriptor.getDescription();
  if (StringUtil.isEmptyOrSpaces(description)) return null;

  final JLabel label = new JLabel(description);
  label.setBorder(BorderFactory.createCompoundBorder(
    new SideBorder(UIUtil.getPanelBackground().darker(), SideBorder.BOTTOM),
    JBUI.Borders.empty(0, 5, 10, 5)));
  return label;
}