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; }
@Override protected void layout() { myRendererComponent.setOpaqueActive(false); mySeparator = new GroupSeparator(); myRendererComponent.add(Registry.is("ide.new.settings.dialog") ? mySeparator : mySeparatorComponent, BorderLayout.NORTH); final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout()); myHandle = new JLabel("", SwingConstants.CENTER); if (!SystemInfo.isMac) { myHandle.setBorder(new EmptyBorder(0, 2, 0, 2)); } myHandle.setOpaque(false); content.add(myHandle, BorderLayout.WEST); content.add(myComponent, BorderLayout.CENTER); myProjectIcon = new JLabel(" ", SwingConstants.LEFT); myProjectIcon.setOpaque(true); content.add(myProjectIcon, BorderLayout.EAST); myRendererComponent.add(content, BorderLayout.CENTER); }
public Advertiser() { myNextLabel = new JLabel(">>"); myNextLabel.setFont(adFont().deriveFont( ContainerUtil.<TextAttribute, Object>immutableMapBuilder().put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON).build())); myNextLabel.setForeground(JBColor.blue); new ClickListener() { @Override public boolean onClick(@NotNull MouseEvent e, int clickCount) { myCurrentItem++; updateAdvertisements(); return true; } }.installOn(myNextLabel); myNextLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); GridBag gb = new GridBag(); myComponent.add(myTextPanel, gb.next()); myComponent.add(myNextLabel, gb.next()); myComponent.add(new NonOpaquePanel(), gb.next().fillCellHorizontally().weightx(1)); }
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); }
@Override protected void layout() { myRendererComponent.setOpaqueActive(false); myRendererComponent.add(mySeparatorComponent, BorderLayout.NORTH); final NonOpaquePanel content = new NonOpaquePanel(new BorderLayout()); myHandle = new JLabel("", SwingConstants.CENTER); if (!SystemInfo.isMac) { myHandle.setBorder(new EmptyBorder(0, 2, 0, 2)); } myHandle.setOpaque(false); content.add(myHandle, BorderLayout.WEST); content.add(myComponent, BorderLayout.CENTER); myRendererComponent.add(content, BorderLayout.CENTER); }
public Advertiser() { myNextLabel = new JLabel(">>"); myNextLabel.setFont(adFont().deriveFont( ContainerUtil.<TextAttribute, Object>immutableMapBuilder().put(TextAttribute.UNDERLINE, TextAttribute.UNDERLINE_ON).build())); myNextLabel.setForeground(JBColor.blue); new ClickListener() { @Override public boolean onClick(MouseEvent e, int clickCount) { myCurrentItem++; updateAdvertisements(); return true; } }.installOn(myNextLabel); myNextLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); GridBag gb = new GridBag(); myComponent.add(myTextPanel, gb.next()); myComponent.add(myNextLabel, gb.next()); myComponent.add(new NonOpaquePanel(), gb.next().fillCellHorizontally().weightx(1)); }
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); }
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(); }
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(); }
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; }
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); }
public EditorNotificationPanel() { super(new BorderLayout()); JPanel panel = new NonOpaquePanel(new BorderLayout()); panel.add(BorderLayout.CENTER, myLabel); panel.add(BorderLayout.EAST, myLinksPanel); panel.setBorder(JBUI.Borders.empty(5, 0, 5, 5)); panel.setMinimumSize(new Dimension(0, 0)); add(BorderLayout.CENTER, panel); add(BorderLayout.EAST, myGearLabel); setBorder(JBUI.Borders.empty(0, 10)); }
private JComponent createBody() { NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); panel.add(createLogo(), BorderLayout.NORTH); panel.add(createActionPanel(), BorderLayout.CENTER); panel.add(createSettingsAndDocs(), BorderLayout.SOUTH); return panel; }
private JComponent createSettingsAndDocs() { JPanel panel = new NonOpaquePanel(new BorderLayout()); NonOpaquePanel toolbar = new NonOpaquePanel(); AnAction register = ActionManager.getInstance().getAction("Register"); boolean registeredVisible = false; if (register != null) { AnActionEvent e = AnActionEvent.createFromAnAction(register, null, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext(this)); register.update(e); Presentation presentation = e.getPresentation(); if (presentation.isEnabled()) { ActionLink registerLink = new ActionLink("Register", register); registerLink.setNormalColor(getLinkNormalColor()); NonOpaquePanel button = new NonOpaquePanel(new BorderLayout()); button.setBorder(JBUI.Borders.empty(4, 10)); button.add(registerLink); installFocusable(button, register, KeyEvent.VK_UP, KeyEvent.VK_RIGHT, true); NonOpaquePanel wrap = new NonOpaquePanel(); wrap.setBorder(JBUI.Borders.emptyLeft(10)); wrap.add(button); panel.add(wrap, BorderLayout.WEST); registeredVisible = true; } } toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.X_AXIS)); toolbar.add(createActionLink("Configure", IdeActions.GROUP_WELCOME_SCREEN_CONFIGURE, AllIcons.General.GearPlain, !registeredVisible)); 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; }
private JComponent createLogo() { NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); ApplicationInfoEx app = ApplicationInfoEx.getInstanceEx(); JLabel logo = new JLabel(IconLoader.getIcon(app.getWelcomeScreenLogoUrl())); logo.setBorder(JBUI.Borders.empty(30,0,10,0)); logo.setHorizontalAlignment(SwingConstants.CENTER); panel.add(logo, BorderLayout.NORTH); JLabel appName = new JLabel(ApplicationNamesInfo.getInstance().getFullProductName()); Font font = getProductFont(); appName.setForeground(JBColor.foreground()); appName.setFont(font.deriveFont(JBUI.scale(36f)).deriveFont(Font.PLAIN)); appName.setHorizontalAlignment(SwingConstants.CENTER); String appVersion = "Version " + app.getFullVersion(); if (app.isEAP() && app.getBuild().getBuildNumber() < Integer.MAX_VALUE) { appVersion += " (" + app.getBuild().asString() + ")"; } JLabel version = new JLabel(appVersion); version.setFont(getProductFont().deriveFont(JBUI.scale(16f))); version.setHorizontalAlignment(SwingConstants.CENTER); version.setForeground(Gray._128); panel.add(appName); panel.add(version, BorderLayout.SOUTH); panel.setBorder(JBUI.Borders.emptyBottom(20)); return panel; }
private void init() { enableEvents(AWTEvent.COMPONENT_EVENT_MASK); final JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(myHeader, BorderLayout.NORTH); JPanel innerPanel = new JPanel(new BorderLayout()); JComponent toolWindowComponent = myToolWindow.getComponent(); innerPanel.add(toolWindowComponent, BorderLayout.CENTER); final NonOpaquePanel inner = new NonOpaquePanel(innerPanel); inner.setBorder(new EmptyBorder(-1, 0, 0, 0)); 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); }
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); }
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); }
@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.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); if (myShowCheckboxes) { @SuppressWarnings("unchecked") CheckboxTree.NodeState state = getNodeStatus((ChangesBrowserNode)value); myCheckBox.setSelected(state != CheckboxTree.NodeState.CLEAR); myCheckBox.setEnabled(state != CheckboxTree.NodeState.PARTIAL && tree.isEnabled()); revalidate(); return this; } else { return myTextRenderer; } }
@Override public JComponent createCustomComponent(final Presentation presentation) { ComboBoxButton button = createComboBoxButton(presentation); button.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2)); NonOpaquePanel panel = new NonOpaquePanel(new BorderLayout()); panel.setBorder(IdeBorderFactory.createEmptyBorder(0, 0, 0, 2)); panel.add(button); return panel; }
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); }
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { removeAll(); final boolean hasRightRenderer = UISettings.getInstance().SHOW_ICONS_IN_QUICK_NAVIGATION; final ModuleRendererFactory factory = ModuleRendererFactory.findInstance(value); final LeftRenderer left = new LeftRenderer(!hasRightRenderer || !factory.rendersLocationString(), myMatcher); final Component leftCellRendererComponent = left.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final Color listBg = leftCellRendererComponent.getBackground(); add(leftCellRendererComponent, BorderLayout.WEST); setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg); if (hasRightRenderer){ final DefaultListCellRenderer moduleRenderer = factory.getModuleRenderer(); 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() : listBg); add(spacer, BorderLayout.CENTER); } return this; }
@Nullable @Override protected JComponent createCenterPanel() { modulesComboBox = new ModulesComboBox(); modulesComboBox.setMinimumAndPreferredWidth(300); modulesComboBox.fillModules(project); if(modulesComboBox.getItemCount() > 0) { modulesComboBox.setSelectedIndex(0); } final NonOpaquePanel panel = new NonOpaquePanel(); panel.add(modulesComboBox, BorderLayout.NORTH); return panel; }
private void init() { enableEvents(AWTEvent.COMPONENT_EVENT_MASK); final JPanel contentPane = new JPanel(new BorderLayout()); contentPane.add(myHeader, BorderLayout.NORTH); JPanel innerPanel = new JPanel(new BorderLayout()); JComponent toolWindowComponent = myToolWindow.getComponent(); innerPanel.add(toolWindowComponent, BorderLayout.CENTER); final NonOpaquePanel inner = new NonOpaquePanel(innerPanel); inner.setBorder(new EmptyBorder(0, 0, 0, 0)); contentPane.add(inner, BorderLayout.CENTER); add(contentPane, BorderLayout.CENTER); setBorder(new InnerPanelBorder(myToolWindow)); 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); }
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.getTreeCellRendererComponent(tree, value, selected, expanded, leaf, row, hasFocus); if (myShowCheckboxes) { ChangesBrowserNode node = (ChangesBrowserNode)value; CheckboxTree.NodeState state = getNodeStatus(node); myCheckBox.setSelected(state != CheckboxTree.NodeState.CLEAR); myCheckBox.setEnabled(state != CheckboxTree.NodeState.PARTIAL); revalidate(); return this; } else { return myTextRenderer; } }
@Override public Component getListCellRendererComponent( JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { EditorColorsScheme scheme = EditorColorsManager.getInstance().getGlobalScheme(); Font editorFont = new Font(scheme.getEditorFontName(), Font.PLAIN, scheme.getEditorFontSize()); setFont(editorFont); removeAll(); final boolean hasRightRenderer = UISettings.getInstance().SHOW_ICONS_IN_QUICK_NAVIGATION; final ModuleRendererFactory factory = ModuleRendererFactory.findInstance(value); final LeftRenderer left = new LeftRenderer(!hasRightRenderer || !factory.rendersLocationString(), myMatcher); final Component leftCellRendererComponent = left.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); final Color listBg = leftCellRendererComponent.getBackground(); add(leftCellRendererComponent, BorderLayout.WEST); setBackground(isSelected ? UIUtil.getListSelectionBackground() : listBg); if (hasRightRenderer){ final DefaultListCellRenderer moduleRenderer = factory.getModuleRenderer(); 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() : listBg); add(spacer, BorderLayout.CENTER); } return this; }
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()); }
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; }
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(); }
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(); }
@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; }
@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; }
static JPanel createButtonPanel(Iterable<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; }