本文整理汇总了Java中com.intellij.ui.components.JBPanel.add方法的典型用法代码示例。如果您正苦于以下问题:Java JBPanel.add方法的具体用法?Java JBPanel.add怎么用?Java JBPanel.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.ui.components.JBPanel
的用法示例。
在下文中一共展示了JBPanel.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createIssuesComponentsTreeView
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private JComponent createIssuesComponentsTreeView() {
issuesCount = new JBLabel("Issues (0) ");
JPanel componentsTreePanel = new JBPanel(new BorderLayout()).withBackground(UIUtil.getTableBackground());
JLabel componentsTreeTitle = new JBLabel(" Components Tree");
componentsTreeTitle.setFont(componentsTreeTitle.getFont().deriveFont(TITLE_FONT_SIZE));
componentsTreePanel.add(componentsTreeTitle, BorderLayout.LINE_START);
componentsTreePanel.add(issuesCount, BorderLayout.LINE_END);
issuesCountPanel = new JBPanel().withBackground(UIUtil.getTableBackground());
issuesCountPanel.setLayout(new BoxLayout(issuesCountPanel, BoxLayout.Y_AXIS));
issuesComponentsTree.setCellRenderer(new IssuesTreeCellRenderer());
issuesComponentsTree.expandRow(0);
issuesComponentsTree.setRootVisible(false);
issuesTreeExpansionListener = new IssuesTreeExpansionListener(issuesComponentsTree, issuesCountPanel, issuesCountPanels);
JBPanel treePanel = new JBPanel(new BorderLayout()).withBackground(UIUtil.getTableBackground());
TreeSpeedSearch treeSpeedSearch = new TreeSpeedSearch(issuesComponentsTree);
treePanel.add(treeSpeedSearch.getComponent(), BorderLayout.WEST);
treePanel.add(issuesCountPanel, BorderLayout.CENTER);
JScrollPane treeScrollPane = ScrollPaneFactory.createScrollPane(treePanel);
treeScrollPane.getVerticalScrollBar().setUnitIncrement(SCROLL_BAR_SCROLLING_UNITS);
return new TitledPane(JSplitPane.VERTICAL_SPLIT, TITLE_LABEL_SIZE, componentsTreePanel, treeScrollPane);
}
示例2: createNavigationSplitter
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
@NotNull
public static JBSplitter createNavigationSplitter(@Nullable JComponent leftPanelContents, @Nullable JComponent rightPanelContents) {
JBPanel navigationPanel = new JBPanel(new BorderLayout());
navigationPanel.setBackground(JBColor.background());
if (leftPanelContents != null) {
navigationPanel.add(leftPanelContents, BorderLayout.CENTER);
}
JBPanel contextInformationPanel = new JBPanel(new BorderLayout());
contextInformationPanel.setBackground(JBColor.background());
if (rightPanelContents != null) {
contextInformationPanel.add(rightPanelContents, BorderLayout.CENTER);
}
JBSplitter navigationSplitter = new JBSplitter(false);
navigationSplitter.setFirstComponent(navigationPanel);
navigationSplitter.setSecondComponent(contextInformationPanel);
navigationSplitter.setDividerWidth(DIVIDER_WIDTH);
return navigationSplitter;
}
示例3: buildForOne
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private void buildForOne(JBPanel panel, final FilePath root) {
final GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST,
GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 0, 0);
c.fill = GridBagConstraints.HORIZONTAL;
c.gridwidth = 2;
final JBLabel comp = new JBLabel("Please select remote URL:");
comp.setFont(comp.getFont().deriveFont(Font.BOLD));
panel.add(comp, c);
final JBTextField value = new JBTextField();
value.setColumns(100);
final String preset = myCheckoutURLs.get(root.getIOFile());
if (preset != null) {
value.setText(preset);
}
myFields.put(root.getIOFile(), value);
++ c.gridy;
panel.add(value, c);
addWarning(panel, c);
}
示例4: createUnsupportedView
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private JPanel createUnsupportedView() {
JLabel label = new JBLabel();
label.setText("Unsupported project type, currently only Maven, Gradle and npm projects are supported.");
JBPanel panel = new JBPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
panel.add(label, c);
panel.setBackground(UIUtil.getTableBackground());
return panel;
}
示例5: createNoCredentialsView
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private JComponent createNoCredentialsView() {
HyperlinkLabel link = new HyperlinkLabel();
link.setHyperlinkText("To start using the JFrog Plugin, please ", "configure", " your JFrog Xray details.");
link.addHyperlinkListener(e -> ShowSettingsUtil.getInstance().showSettingsDialog(project, XrayGlobalConfiguration.class));
JBPanel panel = new JBPanel(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
c.fill = GridBagConstraints.BOTH;
c.anchor = GridBagConstraints.CENTER;
panel.add(link, c);
panel.setBackground(UIUtil.getTableBackground());
return panel;
}
示例6: addUiForGroup
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private void addUiForGroup(@NotNull GradleEditorEntityGroup group) {
JBPanel panel = new JBPanel(new BorderLayout());
panel.setBackground(UIUtil.getTableBackground());
panel.setBorder(IdeBorderFactory.createTitledBorder(group.getName()));
GradleEditorEntityTable table = new GradleEditorEntityTable(myProject);
for (GradleEditorEntity entity : group.getEntities()) {
table.getModel().add(entity);
}
panel.add(table);
addUiForGroup(group.getName(), panel, table);
}
示例7: initializeToolWindow
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private void initializeToolWindow() {
JBPanel mainPanel = new JBPanel(new BorderLayout());
JBPanel addressPanel = new JBPanel(new FlowLayout(FlowLayout.LEFT));
ActionToolbar rightToolbar = createToolbar();
JBLabel addressLabel = new JBLabel("Location: ");
addressTextField = new JBTextField(25);
addressPanel.add(addressLabel);
addressPanel.add(addressTextField);
mainPanel.add(addressPanel, BorderLayout.NORTH);
requestTextField = new EditorTextField();
responseTextField = new EditorTextField();
requestTextField.setPlaceholder("Request");
responseTextField.setPlaceholder("Response");
JBSplitter splitter = new JBSplitter(false, 0.5f);
splitter.setShowDividerControls(true);
splitter.setFirstComponent(requestTextField);
splitter.setSecondComponent(responseTextField);
mainPanel.add(splitter, BorderLayout.CENTER);
setContent(mainPanel);
setToolbar(rightToolbar.getComponent());
}
示例8: buildForMultiple
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private void buildForMultiple(JBPanel panel) {
final GridBagConstraints c = new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(1, 1, 1, 1), 0, 0);
c.gridwidth = 2;
c.fill = GridBagConstraints.HORIZONTAL;
final JBLabel comp = new JBLabel("Please select remote URLs for roots:");
comp.setFont(comp.getFont().deriveFont(Font.BOLD));
panel.add(comp, c);
c.gridwidth = 1;
for (FilePath root : myRoots) {
c.weighty = 0;
c.gridx = 0;
++ c.gridy;
c.fill = GridBagConstraints.NONE;
panel.add(new JBLabel(root.getName() + " (" + root.getParentPath() + ")"), c);
++ c.gridx;
c.fill = GridBagConstraints.HORIZONTAL;
c.weighty = 1;
final JBTextField field = new JBTextField();
panel.add(field, c);
myFields.put(root.getIOFile(), field);
final String preset = myCheckoutURLs.get(root.getIOFile());
if (preset != null) {
field.setText(preset);
}
}
addWarning(panel, c);
}
示例9: addWarning
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
private void addWarning(JBPanel panel, GridBagConstraints c) {
if (myWarning != null && myWarning.length() > 0) {
++ c.gridy;
c.gridx = 0;
c.gridwidth = 2;
c.fill = GridBagConstraints.HORIZONTAL;
final JLabel label = new JLabel(new TextUtil().insertLineCuts("Warning: " + myWarning));
label.setUI(new MultiLineLabelUI());
label.setForeground(SimpleTextAttributes.ERROR_ATTRIBUTES.getFgColor());
panel.add(label, c);
}
}
示例10: getWelcomePanel
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
@Override
public JComponent getWelcomePanel() {
final JBPanel root = new JBPanel(new BorderLayout()) {
@Override
public Dimension getPreferredSize() {
return new Dimension(940, 580);
}
@Override
protected void paintComponent(Graphics g) {
super.paintComponent(g);
final int w = getWidth();
final int iw = logo.getIconWidth();
((Graphics2D)g).setPaint(new RadialGradientPaint(w / 2, 80, Math.max(getWidth()/2, getHeight()), new float[]{0.0f, 1.0f}, new Color[]{Gray._255.withAlpha(70), Gray._255.withAlpha(0)}));
((Graphics2D)g).fillRect(0, 0, getWidth(), getHeight());
logo.paintIcon(this, g, w / 2 - iw /2, 30);
final Font tahoma = new Font("Tahoma", Font.BOLD, 22);
final int stringWidth = SwingUtilities2.stringWidth(this, getFontMetrics(tahoma), "Develop with Pleasure");
final GraphicsConfig config = GraphicsUtil.setupAAPainting(g);
g.setColor(Gray._255.withAlpha(40));
g.setFont(tahoma);
((Graphics2D)g).drawString("Develop with Pleasure", (w - stringWidth) / 2, getHeight() - 19);
g.setColor(UIUtil.getPanelBackground());
((Graphics2D)g).drawString("Develop with Pleasure", (w - stringWidth)/2, getHeight() - 20);
config.restore();
}
};
root.setBackgroundImage(IconLoader.getIcon("/frame_background.png"));
root.setOpaque(false);
root.setBorder(new LineBorder(Gray._128));
root.add(new DarculaWelcomeScreenForm(this).getComponent(), BorderLayout.CENTER);
return root;
}
示例11: createUIComponents
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
/** Create UI components. */
private void createUIComponents() {
templatesListPanel = new TemplatesListPanel();
editorPanel = new EditorPanel();
editorPanel.setPreferredSize(new Dimension(Integer.MAX_VALUE, 200));
templatesSplitter = new Splitter(false, 0.3f);
templatesSplitter.setFirstComponent(templatesListPanel);
templatesSplitter.setSecondComponent(editorPanel);
languagesTable = new JBTable();
languagesTable.setModel(new LanguagesTableModel());
languagesTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
languagesTable.setColumnSelectionAllowed(false);
languagesTable.setRowHeight(22);
languagesTable.setPreferredScrollableViewportSize(new Dimension(-1,
languagesTable.getRowHeight() * IgnoreBundle.LANGUAGES.size() / 2));
languagesTable.setStriped(true);
languagesTable.setShowGrid(false);
languagesTable.setBorder(createEmptyBorder());
languagesTable.setDragEnabled(false);
languagesPanel = ScrollPaneFactory.createScrollPane(languagesTable);
donatePanel = new JBPanel(new BorderLayout());
donatePanel.setBorder(new EmptyBorder(10, 0, 10, 0));
donatePanel.add(new JBLabel(IgnoreBundle.message("settings.general.donate")), BorderLayout.WEST);
donatePanel.add(createLink(
"Donate with PayPal",
"https://www.paypal.me/hsz"
), BorderLayout.CENTER);
}
示例12: popupLookaheadTreesDialog
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
public static void popupLookaheadTreesDialog(PreviewState previewState, LookaheadEventInfo lookaheadInfo) {
// pop up subtrees for lookahead
ShowAmbigTreesDialog dialog = new ShowAmbigTreesDialog();
ParserInterpreter parser = (ParserInterpreter) previewState.parsingResult.parser;
int startRuleIndex = parser.getRuleIndex(previewState.startRuleName);
List<ParserRuleContext> lookaheadParseTrees =
GrammarParserInterpreter.getLookaheadParseTrees(previewState.g,
parser,
parser.getTokenStream(),
startRuleIndex,
lookaheadInfo.decision,
lookaheadInfo.startIndex,
lookaheadInfo.stopIndex);
if ( parser.getNumberOfSyntaxErrors()>0 ) {
// should be no errors for ambiguities, unless original
// input itself has errors. Just display error in this case.
JBPanel errPanel = new JBPanel(new BorderLayout());
errPanel.add(new JBLabel("Cannot display lookahead trees while there are syntax errors in your input."));
dialog.treeScrollPane.setViewportView(errPanel);
lookaheadParseTrees = null;
}
if ( lookaheadParseTrees!=null ) {
Interval range = Interval.of(lookaheadInfo.startIndex, lookaheadInfo.stopIndex);
String phrase = parser.getTokenStream().getText(range);
if ( phrase.length()>MAX_PHRASE_WIDTH ) {
phrase = phrase.substring(0, MAX_PHRASE_WIDTH)+"...";
}
String title = lookaheadParseTrees.size()+
" Interpretations of Lookahead Phrase: "+
phrase;
dialog.ambigPhraseLabel.setText(title);
dialog.setTrees(previewState, lookaheadParseTrees, title, lookaheadInfo.predictedAlt-1,
lookaheadInfo.startIndex, lookaheadInfo.stopIndex, false);
}
dialog.pack();
dialog.setVisible(true);
}
示例13: ProgressStripe
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
public ProgressStripe(@Nonnull JComponent targetComponent, @Nonnull Disposable parent, int startDelayMs) {
super(new BorderLayout());
myPanel = new JBPanel(new BorderLayout());
myPanel.setOpaque(false);
myPanel.add(targetComponent);
myCreateLoadingDecorator = () -> {
Disposable disposable = Disposer.newDisposable();
Disposer.register(parent, disposable);
return new MyLoadingDecorator(targetComponent, myPanel, disposable, startDelayMs);
};
createLoadingDecorator();
}
示例14: createHint
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
@NotNull
public static EmmetPreviewHint createHint(@NotNull final EditorEx parentEditor,
@NotNull String templateText,
@NotNull FileType fileType) {
EditorFactory editorFactory = EditorFactory.getInstance();
Document document = editorFactory.createDocument(templateText);
final EditorEx previewEditor = (EditorEx)editorFactory.createEditor(document, parentEditor.getProject(), fileType, true);
MarkupModelEx model = previewEditor.getMarkupModel();
if (model instanceof EditorMarkupModel) {
((EditorMarkupModel)model).setErrorStripeVisible(true);
}
final EditorSettings settings = previewEditor.getSettings();
settings.setLineNumbersShown(false);
settings.setAdditionalLinesCount(1);
settings.setAdditionalColumnsCount(1);
settings.setRightMarginShown(false);
settings.setFoldingOutlineShown(false);
settings.setLineMarkerAreaShown(false);
settings.setIndentGuidesShown(false);
settings.setVirtualSpace(false);
settings.setWheelFontChangeEnabled(false);
settings.setAdditionalPageAtBottom(false);
settings.setCaretRowShown(false);
previewEditor.setCaretEnabled(false);
previewEditor.setBorder(IdeBorderFactory.createEmptyBorder());
JBPanel panel = new JBPanel(new BorderLayout()) {
@NotNull
@Override
public Dimension getPreferredSize() {
Dimension size = super.getPreferredSize();
Dimension parentEditorSize = parentEditor.getScrollPane().getSize();
int maxWidth = (int)parentEditorSize.getWidth() / 3;
int maxHeight = (int)parentEditorSize.getHeight() / 2;
final int width = settings.isUseSoftWraps() ? maxWidth : Math.min((int)size.getWidth(), maxWidth);
final int height = Math.min((int)size.getHeight(), maxHeight);
return new Dimension(width, height);
}
@NotNull
@Override
public Insets getInsets() {
return new Insets(1, 2, 0, 0);
}
};
panel.setBackground(previewEditor.getBackgroundColor());
panel.add(previewEditor.getComponent(), BorderLayout.CENTER);
return new EmmetPreviewHint(panel, previewEditor, parentEditor);
}
示例15: DiagnosticPanel
import com.intellij.ui.components.JBPanel; //导入方法依赖的package包/类
public DiagnosticPanel(Application application) {
component = new JBPanel(new BorderLayout());
DefaultListModel<BundleDiagnosis> listModel = JBList.createDefaultListModel();
JBList list = new JBList(listModel);
JBScrollPane scrollPane = new JBScrollPane(list);
list.setSelectionModel(new DefaultListSelectionModel() {
@Override
public void setSelectionInterval(int index0, int index1) {
super.setSelectionInterval(-1, -1);
}
});
list.getEmptyText().setText("No diagnosis is ready");
component.add(scrollPane, BorderLayout.CENTER);
list.setCellRenderer(new ColoredListCellRenderer<BundleDiagnosis>() {
@Override
protected void customizeCellRenderer(JList jList, BundleDiagnosis o, int i, boolean b, boolean b1) {
this.setBackground(null);
if (o.getStatus() == BundleDiagnosis.Status.OK) {
this.setIcon(AllIcons.RunConfigurations.TestPassed);
append(o.getName(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
} else {
this.setIcon(AllIcons.RunConfigurations.TestError);
append(o.getName(), SimpleTextAttributes.ERROR_ATTRIBUTES);
}
mySelected = false;
append(" (" + o.getId() + ")", SimpleTextAttributes.GRAY_ATTRIBUTES);
}
});
application.getMessageBus().connect()
.subscribe(FinishedDiagnosticNotifier.DIAGNOSTIC_TOPIC, new FinishedDiagnosticNotifier() {
@Override
public void diagnosisSuccessful(java.util.List<BundleDiagnosis> bundles) {
ApplicationManager.getApplication().invokeLater(
() -> {
listModel.clear();
bundles.stream().forEach(e -> listModel.addElement(e));
long errorBundles =
bundles.stream().filter(e -> e.getStatus() == BundleDiagnosis.Status.NOT)
.count();
if (errorBundles > 0) {
Notification bundleErrorNotification =
new Notification("wuff.diagnostic.error", "Wuff Diagnostic Error",
errorBundles + " bundle" + (errorBundles != 1 ? "s" : "")
+ " not resolved", NotificationType.ERROR);
bundleErrorNotification.setImportant(true);
Notifications.Bus.notify(bundleErrorNotification);
}
});
}
@Override
public void diagnosisStarted() {
ApplicationManager.getApplication().invokeLater(() -> {
list.getEmptyText().setText("Diagnosis in progress...");
listModel.clear();
});
}
@Override
public void diagnosisFailed(String message) {
ApplicationManager.getApplication().invokeLater(() -> {
list.getEmptyText().setText("Diagnosis Failed");
listModel.clear();
});
}
});
}