javax.swing.text.html.ParagraphView#com.intellij.ui.components.panels.NonOpaquePanel源码实例Demo

下面列出了javax.swing.text.html.ParagraphView#com.intellij.ui.components.panels.NonOpaquePanel 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: nosql4idea   文件: QueryPanel.java
void notifyOnErrorForOperator(JComponent component, Exception ex) {
    String message;
    if (ex instanceof JSONParseException) {
        message = StringUtils.removeStart(ex.getMessage(), "\n");
    } else {
        message = String.format("%s: %s", ex.getClass().getSimpleName(), ex.getMessage());
    }
    NonOpaquePanel nonOpaquePanel = new NonOpaquePanel();
    JTextPane textPane = Messages.configureMessagePaneUi(new JTextPane(), message);
    textPane.setFont(COURIER_FONT);
    textPane.setBackground(MessageType.ERROR.getPopupBackground());
    nonOpaquePanel.add(textPane, BorderLayout.CENTER);
    nonOpaquePanel.add(new JLabel(MessageType.ERROR.getDefaultIcon()), BorderLayout.WEST);

    JBPopupFactory.getInstance().createBalloonBuilder(nonOpaquePanel)
            .setFillColor(MessageType.ERROR.getPopupBackground())
            .createBalloon()
            .show(new RelativePoint(component, new Point(0, 0)), Balloon.Position.above);
}
 
源代码2 项目: nosql4idea   文件: RedisPanel.java
protected void buildQueryToolBar() {
    toolBarPanel.setLayout(new BorderLayout());

    filterField = new JBTextField("*");
    filterField.setColumns(10);

    NonOpaquePanel westPanel = new NonOpaquePanel();

    NonOpaquePanel filterPanel = new NonOpaquePanel();
    filterPanel.add(new JLabel("Filter: "), BorderLayout.WEST);
    filterPanel.add(filterField, BorderLayout.CENTER);
    filterPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST);
    westPanel.add(filterPanel, BorderLayout.WEST);

    toolBarPanel.add(westPanel, BorderLayout.WEST);

    addCommonsActions();
}
 
源代码3 项目: consulo   文件: DetailsComponent.java
public DetailsComponent(boolean detailsEnabled, boolean paintBorder) {
  myDetailsEnabled = detailsEnabled;
  myPaintBorder = paintBorder;
  myComponent = new JPanel(new BorderLayout());

  myComponent.setOpaque(false);
  myContentGutter.setOpaque(false);
  myContentGutter.setBorder(null);

  myBanner = new NonOpaquePanel(new BorderLayout());
  myBannerLabel = new Banner();

  if (myDetailsEnabled) {
    myBanner.add(myBannerLabel, BorderLayout.CENTER);
  }

  myEmptyContentLabel = new JLabel("", SwingConstants.CENTER);

  revalidateDetailsMode();
}
 
源代码4 项目: consulo   文件: SearchTextArea.java
protected void updateLayout() {
  JPanel historyButtonWrapper = new NonOpaquePanel(new BorderLayout());
  historyButtonWrapper.setBorder(JBUI.Borders.emptyTop(1));
  historyButtonWrapper.add(myHistoryPopupButton, BorderLayout.NORTH);
  JPanel iconsPanelWrapper = new NonOpaquePanel(new BorderLayout());
  iconsPanelWrapper.setBorder(JBUI.Borders.emptyTop(1));
  JPanel p = new NonOpaquePanel(new BorderLayout());
  p.add(myIconsPanel, BorderLayout.NORTH);
  iconsPanelWrapper.add(p, BorderLayout.WEST);
  iconsPanelWrapper.add(myExtraActionsPanel, BorderLayout.CENTER);

  removeAll();
  setLayout(new BorderLayout(JBUIScale.scale(3), 0));
  setBorder(JBUI.Borders.empty(SystemInfo.isLinux ? JBUI.scale(2) : JBUI.scale(1)));
  add(historyButtonWrapper, BorderLayout.WEST);
  add(myScrollPane, BorderLayout.CENTER);
  add(iconsPanelWrapper, BorderLayout.EAST);
  updateIconsLayout();
}
 
源代码5 项目: consulo   文件: SearchTextArea.java
public List<Component> setExtraActions(AnAction... actions) {
  myExtraActionsPanel.removeAll();
  myExtraActionsPanel.setBorder(JBUI.Borders.empty());
  ArrayList<Component> addedButtons = new ArrayList<>();
  if (actions != null && actions.length > 0) {
    JPanel buttonsGrid = new NonOpaquePanel(new GridLayout(1, actions.length, 0, 0));
    for (AnAction action : actions) {
      ActionButton button = new MyActionButton(action, true);
      addedButtons.add(button);
      buttonsGrid.add(button);
    }
    myExtraActionsPanel.setLayout(new BorderLayout());
    myExtraActionsPanel.add(buttonsGrid, BorderLayout.NORTH);
    myExtraActionsPanel.setBorder(new CompoundBorder(JBUI.Borders.customLine(JBUI.CurrentTheme.CustomFrameDecorations.separatorForeground(), 0, 1, 0, 0), JBUI.Borders.emptyLeft(4)));
  }
  return addedButtons;
}
 
源代码6 项目: consulo   文件: RunAnythingPopupUI.java
@Override
@Nonnull
public JPanel createTopLeftPanel() {
  myTextFieldTitle = new JLabel(IdeBundle.message("run.anything.run.anything.title"));
  JPanel topPanel = new NonOpaquePanel(new BorderLayout());
  Color foregroundColor = UIUtil.getLabelForeground();


  myTextFieldTitle.setForeground(foregroundColor);
  myTextFieldTitle.setBorder(BorderFactory.createEmptyBorder(3, 5, 5, 0));
  if (SystemInfo.isMac) {
    myTextFieldTitle.setFont(myTextFieldTitle.getFont().deriveFont(Font.BOLD, myTextFieldTitle.getFont().getSize() - 1f));
  }
  else {
    myTextFieldTitle.setFont(myTextFieldTitle.getFont().deriveFont(Font.BOLD));
  }

  topPanel.add(myTextFieldTitle);

  return topPanel;
}
 
@Nullable
@Override
protected JComponent createCenterPanel() {
    comboBox = new ComboBox<>(new CollectionComboBoxModel<>(configDirectoryCandidates));
    comboBox.setRenderer(new DefaultPsiElementCellRenderer());
    comboBox.setMinimumAndPreferredWidth(450);
    if (comboBox.getItemCount() > 0) {
        comboBox.setSelectedIndex(0);
    }
    final NonOpaquePanel panel = new NonOpaquePanel();
    panel.add(comboBox, BorderLayout.NORTH);
    return panel;
}
 
源代码8 项目: nosql4idea   文件: QueryPanel.java
private AggregatorPanel() {
    this.editor = createEditor();

    setLayout(new BorderLayout());
    NonOpaquePanel headPanel = new NonOpaquePanel();
    JLabel operatorLabel = new JLabel("Aggregation");
    headPanel.add(operatorLabel, BorderLayout.WEST);
    add(headPanel, BorderLayout.NORTH);
    add(this.editor.getComponent(), BorderLayout.CENTER);

    this.operatorCompletionAction = new OperatorCompletionAction(project, editor);


    myUpdateAlarm.setActivationComponent(this.editor.getComponent());
}
 
源代码9 项目: nosql4idea   文件: QueryPanel.java
private JPanel createSubOperatorPanel(String title, Editor subOperatorEditor) {
    JPanel selectPanel = new JPanel();
    selectPanel.setLayout(new BorderLayout());
    NonOpaquePanel headPanel = new NonOpaquePanel();
    JLabel operatorLabel = new JLabel(title);
    headPanel.add(operatorLabel, BorderLayout.WEST);
    selectPanel.add(headPanel, BorderLayout.NORTH);
    selectPanel.add(subOperatorEditor.getComponent(), BorderLayout.CENTER);

    myUpdateAlarm.setActivationComponent(subOperatorEditor.getComponent());

    return selectPanel;
}
 
源代码10 项目: nosql4idea   文件: MongoPanel.java
private void initToolBar() {
    toolBar.setLayout(new BorderLayout());

    rowLimitField.setColumns(5);
    rowLimitField.setDocument(new NumberDocument());

    JPanel rowLimitPanel = new NonOpaquePanel();
    rowLimitPanel.add(new JLabel("Row limit:"), BorderLayout.WEST);
    rowLimitPanel.add(rowLimitField, BorderLayout.CENTER);
    rowLimitPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST);
    toolBar.add(rowLimitPanel, BorderLayout.WEST);

    installResultPanelActions();
}
 
源代码11 项目: nosql4idea   文件: CouchbasePanel.java
private void initToolbar() {
    toolBarPanel.setLayout(new BorderLayout());

    rowLimitField.setColumns(5);
    rowLimitField.setDocument(new NumberDocument());
    rowLimitField.setText("100");

    JPanel rowLimitPanel = new NonOpaquePanel();
    rowLimitPanel.add(new JLabel("Row limit:"), BorderLayout.WEST);
    rowLimitPanel.add(rowLimitField, BorderLayout.CENTER);
    rowLimitPanel.add(Box.createHorizontalStrut(5), BorderLayout.EAST);
    toolBarPanel.add(rowLimitPanel, BorderLayout.WEST);

    addCommonsActions();
}
 
源代码12 项目: consulo   文件: LoadingDecorator.java
protected NonOpaquePanel customizeLoadingLayer(JPanel parent, JLabel text, AsyncProcessIcon icon) {
  parent.setLayout(new GridBagLayout());

  final Font font = text.getFont();
  text.setFont(font.deriveFont(font.getStyle(), font.getSize() + 8));
  //text.setForeground(Color.black);

  final int gap = new JLabel().getIconTextGap();
  final NonOpaquePanel result = new NonOpaquePanel(new FlowLayout(FlowLayout.CENTER, gap * 3, 0));
  result.add(icon);
  result.add(text);
  parent.add(result);

  return result;
}
 
源代码13 项目: consulo   文件: GroupedElementsRenderer.java
@Override
protected void layout() {
  myRendererComponent.add(mySeparatorComponent, BorderLayout.NORTH);

  JComponent centerComponent = new NonOpaquePanel(myComponent) {
    @Override
    public Dimension getPreferredSize() {
      return UIUtil.updateListRowHeight(super.getPreferredSize());
    }
  };

  myRendererComponent.add(centerComponent, BorderLayout.CENTER);
}
 
源代码14 项目: consulo   文件: ActionPanel.java
public ActionPanel(JBTabsImpl tabs, TabInfo tabInfo, Pass<MouseEvent> pass) {
  myTabs = tabs;
  ActionGroup group = tabInfo.getTabLabelActions() != null ? tabInfo.getTabLabelActions() : new DefaultActionGroup();
  AnAction[] children = group.getChildren(null);

  final NonOpaquePanel wrapper = new NonOpaquePanel(new BorderLayout());
  wrapper.add(Box.createHorizontalStrut(2), BorderLayout.WEST);
  NonOpaquePanel inner = new NonOpaquePanel();
  inner.setLayout(new BoxLayout(inner, BoxLayout.X_AXIS));
  wrapper.add(inner, BorderLayout.CENTER);
  for (AnAction each : children) {
    ActionButton eachButton = new ActionButton(myTabs, tabInfo, each, tabInfo.getTabActionPlace(), pass, tabs.getTabActionsMouseDeadzone()) {
      @Override
      protected void repaintComponent(final Component c) {
        TabLabel tabLabel = (TabLabel) SwingUtilities.getAncestorOfClass(TabLabel.class, c);
        if (tabLabel != null) {
          Point point = SwingUtilities.convertPoint(c, new Point(0, 0), tabLabel);
          Dimension d = c.getSize();
          tabLabel.repaint(point.x, point.y, d.width, d.height);
        } else {
          super.repaintComponent(c);
        }
      }
    };

    myButtons.add(eachButton);
    InplaceButton component = eachButton.getComponent();
    inner.add(component);
  }

  add(wrapper);
}
 
源代码15 项目: consulo   文件: SwingHelper.java
@Nonnull
public static JEditorPane createHtmlViewer(boolean lineWrap, @Nullable Font font, @Nullable Color background, @Nullable Color foreground) {
  final JEditorPane textPane;
  if (lineWrap) {
    textPane = new JEditorPane() {
      @Override
      public Dimension getPreferredSize() {
        // This trick makes text component to carry text over to the next line
        // if the text line width exceeds parent's width
        Dimension dimension = super.getPreferredSize();
        dimension.width = 0;
        return dimension;
      }
    };
  }
  else {
    textPane = new JEditorPane();
  }
  textPane.setFont(font != null ? font : UIUtil.getLabelFont());
  textPane.setEditorKit(UIUtil.getHTMLEditorKit());
  textPane.setEditable(false);
  if (background != null) {
    textPane.setBackground(background);
  }
  else {
    NonOpaquePanel.setTransparent(textPane);
  }
  textPane.setForeground(foreground != null ? foreground : UIUtil.getLabelForeground());
  textPane.setFocusable(false);
  return textPane;
}
 
源代码16 项目: consulo   文件: ProgressStripe.java
@Override
protected NonOpaquePanel customizeLoadingLayer(JPanel parent, JLabel text, AsyncProcessIcon icon) {
  parent.setLayout(new BorderLayout());

  NonOpaquePanel result = new NonOpaquePanel();
  result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));
  result.add(icon);

  parent.add(result, BorderLayout.NORTH);

  return result;
}
 
源代码17 项目: consulo   文件: InlineProgressIndicator.java
protected void createCompactTextAndProgress() {
  JPanel textAndProgress = new NonOpaquePanel(new BorderLayout());
  textAndProgress.add(myText, BorderLayout.CENTER);

  final NonOpaquePanel progressWrapper = new NonOpaquePanel(new BorderLayout());
  progressWrapper.setBorder(JBUI.Borders.empty(0, 4));
  progressWrapper.add(myProgress, BorderLayout.CENTER);

  textAndProgress.add(progressWrapper, BorderLayout.EAST);
  myComponent.add(textAndProgress, BorderLayout.CENTER);
}
 
源代码18 项目: consulo   文件: InlineProgressIndicator.java
static JPanel createButtonPanel(Iterable<? extends JComponent> components) {
  JPanel iconsPanel = new NonOpaquePanel(new GridBagLayout());
  GridBag gb = new GridBag().setDefaultFill(GridBagConstraints.BOTH);
  for (JComponent component : components) {
    iconsPanel.add(component, gb.next());
  }
  return iconsPanel;
}
 
源代码19 项目: consulo   文件: DesktopEditorComposite.java
@Nonnull
private List<JComponent> getTopBottomComponents(@Nonnull FileEditor editor, boolean top) {
  SmartList<JComponent> result = new SmartList<>();
  JComponent container = top ? myTopComponents.get(editor) : myBottomComponents.get(editor);
  for (Component each : container.getComponents()) {
    if (each instanceof NonOpaquePanel) {
      result.add(((NonOpaquePanel)each).getTargetComponent());
    }
  }
  return Collections.unmodifiableList(result);
}
 
源代码20 项目: consulo   文件: DesktopContentManagerImpl.java
@Nonnull
@Override
public JComponent getComponent() {
  if (myComponent == null) {
    myComponent = new MyNonOpaquePanel();

    NonOpaquePanel contentComponent = new NonOpaquePanel();
    contentComponent.setContent(myUI.getComponent());
    contentComponent.setFocusCycleRoot(true);

    myComponent.add(contentComponent, BorderLayout.CENTER);
  }
  return myComponent;
}
 
源代码21 项目: consulo   文件: PopupFactoryImpl.java
@Nonnull
@Override
public BalloonBuilder createHtmlTextBalloonBuilder(@Nonnull final String htmlContent, @Nullable final Icon icon, Color textColor, final Color fillColor, @Nullable final HyperlinkListener listener) {
  JEditorPane text = IdeTooltipManager.initPane(htmlContent, new HintHint().setTextFg(textColor).setAwtTooltip(true), null);

  if (listener != null) {
    text.addHyperlinkListener(listener);
  }
  text.setEditable(false);
  NonOpaquePanel.setTransparent(text);
  text.setBorder(null);


  JLabel label = new JLabel();
  final JPanel content = new NonOpaquePanel(new BorderLayout((int)(label.getIconTextGap() * 1.5), (int)(label.getIconTextGap() * 1.5)));

  final NonOpaquePanel textWrapper = new NonOpaquePanel(new GridBagLayout());
  JScrollPane scrolledText = ScrollPaneFactory.createScrollPane(text, true);
  scrolledText.setBackground(fillColor);
  scrolledText.getViewport().setBackground(fillColor);
  textWrapper.add(scrolledText);
  content.add(textWrapper, BorderLayout.CENTER);
  if (icon != null) {
    final NonOpaquePanel north = new NonOpaquePanel(new BorderLayout());
    north.add(new JLabel(icon), BorderLayout.NORTH);
    content.add(north, BorderLayout.WEST);
  }

  content.setBorder(JBUI.Borders.empty(2, 4));

  final BalloonBuilder builder = createBalloonBuilder(content);

  builder.setFillColor(fillColor);

  return builder;
}
 
源代码22 项目: consulo   文件: ActionMacroManager.java
private Widget(StatusBar statusBar) {
  myStatusBar = statusBar;
  myPresentation = new WidgetPresentation() {
    @Override
    public String getTooltipText() {
      return "Macro is being recorded now";
    }

    @Override
    public Consumer<MouseEvent> getClickConsumer() {
      return Widget.this;
    }
  };


  new BaseButtonBehavior(myIcon) {
    @Override
    protected void execute(MouseEvent e) {
      showBalloon();
    }
  };

  myBalloonComponent = new NonOpaquePanel(new BorderLayout());

  final AnAction stopAction = ActionManager.getInstance().getAction("StartStopMacroRecording");
  final DefaultActionGroup group = new DefaultActionGroup();
  group.add(stopAction);
  final ActionToolbar tb = ActionManager.getInstance().createActionToolbar(ActionPlaces.STATUS_BAR_PLACE, group, true);
  tb.setMiniMode(true);

  final NonOpaquePanel top = new NonOpaquePanel(new BorderLayout());
  top.add(tb.getComponent(), BorderLayout.WEST);
  myText = new JLabel(RECORDED + "..." + TYPING_SAMPLE, SwingConstants.LEFT);
  final Dimension preferredSize = myText.getPreferredSize();
  myText.setPreferredSize(preferredSize);
  myText.setText("Macro recording started...");
  myLastTyping = "";
  top.add(myText, BorderLayout.CENTER);
  myBalloonComponent.add(top, BorderLayout.CENTER);
}
 
源代码23 项目: consulo   文件: RepositoryWithBranchPanel.java
private void layoutComponents() {
  add(myRepositoryCheckbox, BorderLayout.WEST);
  JPanel panel = new NonOpaquePanel(new BorderLayout());
  panel.add(myTextRenderer, BorderLayout.WEST);
  panel.add(myDestPushTargetPanelComponent, BorderLayout.CENTER);
  add(panel, BorderLayout.CENTER);
}
 
源代码24 项目: consulo   文件: BranchActionGroupPopup.java
private void createTitlePanelToolbar(@Nonnull String dimensionKey) {
  myTitleToolbarPanel = new NonOpaquePanel();
  myTitleToolbarPanel.setLayout(new BoxLayout(myTitleToolbarPanel, BoxLayout.LINE_AXIS));
  myTitleToolbarPanel.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
  myRestoreSizeButton = new MyToolbarButton("Restore Size", CollapseComponent, CollapseComponentHover, e -> {
    WindowStateService.getInstance(myProject).putSizeFor(myProject, dimensionKey, null);
    myInternalSizeChanged = true;
    pack(true, true);
  }) {
    @Override
    protected boolean isButtonEnabled() {
      return myUserSizeChanged;
    }
  };

  mySettingsButton = new MyToolbarButton("Settings", AllIcons.General.GearPlain, null, e -> {
    final ActionPopupMenu popupMenu = ActionManager.getInstance().createActionPopupMenu(BRANCH_POPUP, new DefaultActionGroup(mySettingsActions));
    popupMenu.getComponent().show(mySettingsButton, 0, assertNotNull(mySettingsButton).getHeight());
  }) {
    @Override
    protected boolean isButtonEnabled() {
      return !mySettingsActions.isEmpty();
    }
  };

  myTitleToolbarPanel.add(mySettingsButton);
  myTitleToolbarPanel.add(myRestoreSizeButton);
  getTitle().setButtonComponent(new ActiveComponent.Adapter() {
    @Nonnull
    @Override
    public JComponent getComponent() {
      return myTitleToolbarPanel;
    }
  }, JBUI.Borders.emptyRight(2));
}
 
源代码25 项目: consulo   文件: ChangesTreeList.java
@Override
public Component getTreeCellRendererComponent(JTree tree,
                                              Object value,
                                              boolean selected,
                                              boolean expanded,
                                              boolean leaf,
                                              int row,
                                              boolean hasFocus) {

  if (UIUtil.isUnderGTKLookAndFeel() || UIUtil.isUnderNimbusLookAndFeel()) {
    NonOpaquePanel.setTransparent(this);
    NonOpaquePanel.setTransparent(myCheckBox);
  } else {
    setBackground(null);
    myCheckBox.setBackground(null);
    myCheckBox.setOpaque(false);
  }

  myTextRenderer.setOpaque(false);
  myTextRenderer.setTransparentIconBackground(true);
  myTextRenderer.setToolTipText(null);
  myTextRenderer.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus);
  if (myShowCheckboxes) {
    @SuppressWarnings("unchecked")
    CheckboxTree.NodeState state = getNodeStatus((ChangesBrowserNode)value);
    myCheckBox.setSelected(state != CheckboxTree.NodeState.CLEAR);
    //noinspection unchecked
    myCheckBox.setEnabled(tree.isEnabled() && isNodeEnabled((ChangesBrowserNode)value));
    revalidate();

    return this;
  }
  else {
    return myTextRenderer;
  }
}
 
源代码26 项目: consulo   文件: RunConfigurationsComboBoxAction.java
@Nonnull
@Override
public JComponent createCustomComponent(final Presentation presentation) {
  ComboBoxButton button = createComboBoxButton(presentation);
  NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout());
  panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2));
  panel.add(button.getComponent());
  return panel;
}
 
源代码27 项目: consulo   文件: MnemonicChooser.java
public MnemonicChooser() {
  super(new VerticalFlowLayout());
  JPanel numbers = new NonOpaquePanel(new GridLayout(2, 5, 2, 2));
  for (char i = '1'; i <= '9'; i++) {
    numbers.add(new MnemonicLabel(i));
  }
  numbers.add(new MnemonicLabel('0'));
  

  JPanel letters = new NonOpaquePanel(new GridLayout(5, 6, 2, 2));
  for (char c = 'A'; c <= 'Z'; c++) {
    letters.add(new MnemonicLabel(c));
  }

  add(numbers);
  add(new JSeparator());
  add(letters);
  setBackground(UIUtil.getListBackground());

  addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
        onCancelled();
      }
      else if (e.getModifiersEx() == 0) {
        final char typed = Character.toUpperCase(e.getKeyChar());
        if (typed >= '0' && typed <= '9' || typed >= 'A' && typed <= 'Z') {
          onMnemonicChosen(typed);
        }
      }
    }
  });

  setFocusable(true);
}
 
源代码28 项目: consulo   文件: NavigationItemListCellRenderer.java
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
  removeAll();

  final boolean hasRightRenderer = UISettings.getInstance().getShowIconInQuickNavigation();

  final LeftRenderer left = new LeftRenderer(true, MatcherHolder.getAssociatedMatcher(list));
  final Component leftCellRendererComponent = left.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
  final Color listBg = leftCellRendererComponent.getBackground();
  add(leftCellRendererComponent, BorderLayout.WEST);

  setBackground(isSelected ? UIUtil.getListSelectionBackground(true) : listBg);

  if (hasRightRenderer) {
    final DefaultListCellRenderer moduleRenderer = new PsiElementModuleRenderer();

    final Component rightCellRendererComponent = moduleRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
    ((JComponent)rightCellRendererComponent).setOpaque(false);
    rightCellRendererComponent.setBackground(listBg);
    add(rightCellRendererComponent, BorderLayout.EAST);
    final JPanel spacer = new NonOpaquePanel();

    final Dimension size = rightCellRendererComponent.getSize();
    spacer.setSize(new Dimension((int)(size.width * 0.015 + leftCellRendererComponent.getSize().width * 0.015), size.height));
    spacer.setBackground(isSelected ? UIUtil.getListSelectionBackground(true) : listBg);
    add(spacer, BorderLayout.CENTER);
  }
  return this;
}
 
源代码29 项目: consulo   文件: FlatWelcomePanel.java
private JComponent createSettingsAndDocs() {
  JPanel panel = new NonOpaquePanel(new BorderLayout());
  NonOpaquePanel toolbar = new NonOpaquePanel();

  toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS));
  toolbar.add(createEventsLink());
  toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.GearPlain, true));
  toolbar.add(createActionLink("Get Help", IdeActions.GROUP_WELCOME_SCREEN_DOC, null, false));

  panel.add(toolbar, BorderLayout.EAST);


  panel.setBorder(JBUI.Borders.empty(0, 0, 8, 11));
  return panel;
}
 
源代码30 项目: consulo   文件: DesktopInternalDecorator.java
private void init(boolean dumbAware) {
  enableEvents(AWTEvent.COMPONENT_EVENT_MASK);

  final JPanel contentPane = new JPanel(new BorderLayout());
  installFocusTraversalPolicy(contentPane, new LayoutFocusTraversalPolicy());
  contentPane.add(myHeader, BorderLayout.NORTH);

  JPanel innerPanel = new JPanel(new BorderLayout());
  JComponent toolWindowComponent = myToolWindow.getComponent();
  if (!dumbAware) {
    toolWindowComponent = DumbService.getInstance(myProject).wrapGently(toolWindowComponent, myProject);
  }
  innerPanel.add(toolWindowComponent, BorderLayout.CENTER);

  final NonOpaquePanel inner = new NonOpaquePanel(innerPanel);

  contentPane.add(inner, BorderLayout.CENTER);
  add(contentPane, BorderLayout.CENTER);
  if (SystemInfo.isMac) {
    setBackground(new JBColor(Gray._200, Gray._90));
  }

  // Add listeners
  registerKeyboardAction(new ActionListener() {
    @Override
    public void actionPerformed(final ActionEvent e) {
      ToolWindowManager.getInstance(myProject).activateEditorComponent();
    }
  }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT);
}