com.intellij.ui.components.JBPanel Java Examples
The following examples show how to use
com.intellij.ui.components.JBPanel.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubmissionsPanel.java From leetcode-editor with Apache License 2.0 | 7 votes |
public SubmissionsPanel(@Nullable Project project, TableModel tableModel) { super(project, true); jpanel = new JBPanel(new BorderLayout()); jpanel.setMinimumSize(new Dimension(400, 400)); jpanel.setPreferredSize(new Dimension(400, 400)); table = new JBTable(tableModel); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); table.setRowSelectionAllowed(true); table.setRowSelectionInterval(0, 0); table.getColumnModel().getColumn(0).setPreferredWidth(350); table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(100); table.getColumnModel().getColumn(3).setPreferredWidth(200); table.getColumnModel().getColumn(4).setPreferredWidth(100); jpanel.add(new JBScrollPane(table, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); setModal(true); init(); }
Example #2
Source File: SolutionPanel.java From leetcode-editor with Apache License 2.0 | 6 votes |
public SolutionPanel(@Nullable Project project, TableModel tableModel) { super(project, true); this.jpanel = new JBPanel(new BorderLayout());; jpanel.setPreferredSize(new Dimension(600, 400)); table = new JBTable(tableModel); table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); table.getTableHeader().setReorderingAllowed(false); table.setRowSelectionAllowed(true); table.setRowSelectionInterval(0, 0); table.getColumnModel().getColumn(0).setPreferredWidth(350); table.getColumnModel().getColumn(1).setPreferredWidth(200); table.getColumnModel().getColumn(2).setPreferredWidth(700); jpanel.add(new JBScrollPane(table, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); setModal(true); init(); }
Example #3
Source File: ClearAllAction.java From leetcode-editor with Apache License 2.0 | 5 votes |
public ClearAllWarningPanel(@Nullable Project project) { super(project, true); jpanel = new JBPanel(); jpanel.add(new JLabel("Clear All File?")); jpanel.setMinimumSize(new Dimension(200, 100)); setModal(true); init(); }
Example #4
Source File: TestcasePanel.java From leetcode-editor with Apache License 2.0 | 5 votes |
public TestcasePanel(@Nullable Project project) { super(project, true); jpanel = new JBPanel(); jpanel.setLayout(new BorderLayout()); caseText = new JTextArea(); caseText.setMinimumSize(new Dimension(400, 200)); caseText.setPreferredSize(new Dimension(400, 200)); jpanel.add(new JBScrollPane(caseText, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_NEVER), BorderLayout.CENTER); setModal(true); init(); }
Example #5
Source File: ClosableTabHost.java From SmartIM4IntelliJ with Apache License 2.0 | 5 votes |
public Component createTab(String text) { JPanel panel = new JBPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); JLabel label = JBLabelDecorator.createJBLabelDecorator(text); label.setOpaque(false); panel.add(label); TabButton btn = new TabButton(); panel.add(btn); panel.setBackground(Color.black); panel.setOpaque(false); UIUtil.setNotOpaqueRecursively(panel); return panel; }
Example #6
Source File: LegalNotice.java From KodeBeagle with Apache License 2.0 | 5 votes |
@Nullable @Override protected final JComponent createCenterPanel() { JPanel iconPanel = new JBPanel(new BorderLayout()); iconPanel.add(new JBLabel(AllIcons.General.WarningDialog), BorderLayout.NORTH); JEditorPane messageEditorPane = new JEditorPane(); messageEditorPane.setEditorKit(UIUtil.getHTMLEditorKit()); messageEditorPane.setEditable(false); messageEditorPane.setPreferredSize(MESSAGE_EDITOR_PANE_PREFERRED_SIZE); messageEditorPane.setBorder(BorderFactory.createLineBorder(Gray._200)); String text = DIV_STYLE_MARGIN_5PX + getLegalNoticeMessage() + "\n" + KODEBEAGLE_PRIVACY_POLICY + DIV; messageEditorPane.setText(text); JPanel legalNoticePanel = new JPanel(LEGAL_NOTICE_LAYOUT); legalNoticePanel.add(iconPanel, BorderLayout.WEST); legalNoticePanel.add(messageEditorPane, BorderLayout.CENTER); messageEditorPane.addHyperlinkListener(new HyperlinkListener() { public void hyperlinkUpdate(final HyperlinkEvent he) { if (he.getEventType() == HyperlinkEvent.EventType.ACTIVATED) { BrowserUtil.browse(he.getURL()); } } }); return legalNoticePanel; }
Example #7
Source File: ShowAmbigTreesDialog.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static void popupAmbigTreesDialog(PreviewState previewState, AmbiguityInfo ambigInfo) { // pop up subtrees for ambig intrepretation ShowAmbigTreesDialog dialog = new ShowAmbigTreesDialog(); Parser parser = previewState.parsingResult.parser; int startRuleIndex = parser.getRuleIndex(previewState.startRuleName); List<ParserRuleContext> ambiguousParseTrees = null; try { ambiguousParseTrees = GrammarParserInterpreter.getAllPossibleParseTrees(previewState.g, parser, parser.getTokenStream(), ambigInfo.decision, ambigInfo.ambigAlts, ambigInfo.startIndex, ambigInfo.stopIndex, startRuleIndex); } catch (ParseCancellationException pce) { // 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 ambiguous trees while there are syntax errors in your input.")); dialog.treeScrollPane.setViewportView(errPanel); } if ( ambiguousParseTrees!=null ) { TokenStream tokens = previewState.parsingResult.parser.getInputStream(); String phrase = tokens.getText(Interval.of(ambigInfo.startIndex, ambigInfo.stopIndex)); if ( phrase.length()>MAX_PHRASE_WIDTH ) { phrase = phrase.substring(0, MAX_PHRASE_WIDTH)+"..."; } String title = ambiguousParseTrees.size()+ " Interpretations of Ambiguous Input Phrase: "+ phrase; dialog.ambigPhraseLabel.setText(title); dialog.setTrees(previewState, ambiguousParseTrees, title, 0, true); } dialog.pack(); dialog.setVisible(true); }
Example #8
Source File: ShowAmbigTreesDialog.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 5 votes |
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, false); } dialog.pack(); dialog.setVisible(true); }
Example #9
Source File: ProgressStripe.java From consulo with Apache License 2.0 | 5 votes |
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 = Disposable.newDisposable(); Disposer.register(parent, disposable); return new MyLoadingDecorator(targetComponent, myPanel, disposable, startDelayMs); }; createLoadingDecorator(); }
Example #10
Source File: IdeaUIComponentFactory.java From netbeans-mmd-plugin with Apache License 2.0 | 4 votes |
@Override @Nonnull public JPanel makePanel() { return new JBPanel(); }
Example #11
Source File: MindMapDocumentEditor.java From netbeans-mmd-plugin with Apache License 2.0 | 4 votes |
public MindMapDocumentEditor( final Project project, final VirtualFile file ) { this.project = project; this.file = file; this.panelController = new MindMapPanelControllerImpl(this); this.mindMapPanel = new MindMapPanel(panelController); this.mindMapPanel.putTmpObject("project", project); this.mindMapPanel.putTmpObject("editor", this); this.mindMapPanel.addMindMapListener(this); this.mainScrollPane = new JScrollPane(this.mindMapPanel, JBScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JBScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED); // NB! JBScrollPane sometime doesn't show scrollbars so that it replaced by swing panel this.mainScrollPane.getVerticalScrollBar().setUnitIncrement(16); this.mainScrollPane.getVerticalScrollBar().setBlockIncrement(128); this.mainScrollPane.getHorizontalScrollBar().setUnitIncrement(16); this.mainScrollPane.getHorizontalScrollBar().setBlockIncrement(128); this.mainScrollPane.setWheelScrollingEnabled(true); this.mainScrollPane.setAutoscrolls(true); final Document document = FileDocumentManager.getInstance().getDocument(this.file); this.documents = new Document[] {document}; this.mindMapPanel.setDropTarget(new DropTarget(this.mindMapPanel, this)); loadMindMapFromDocument(); this.undoHelper = new UndoHelper(this.project, this); this.undoHelper.addWatchedDocument(getDocument()); this.documentListener = new DocumentAdapter() { @Override public void documentChanged(DocumentEvent e) { loadMindMapFromDocument(); } }; this.getDocument().addDocumentListener(this.documentListener); DataManager.registerDataProvider(this.mainScrollPane, this); this.findTextPanel = new FindTextPanel(this); this.mainScrollPane.setColumnHeaderView(this.findTextPanel); this.mainScrollPane.getHorizontalScrollBar().addAdjustmentListener(this); this.mainScrollPane.getVerticalScrollBar().addAdjustmentListener(this); this.mainPanel = new JBPanel(new BorderLayout()); this.mainPanel.add(this.mainScrollPane, BorderLayout.CENTER); this.mainPanel.add(this.findTextPanel, BorderLayout.NORTH); }
Example #12
Source File: ShowAmbigTreesDialog.java From intellij-plugin-v4 with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void setTrees(PreviewState previewState, List<? extends RuleContext> ambiguousParseTrees, String title, int highlightTreeIndex, boolean highlightDiffs) { if ( ambiguousParseTrees!=null ) { int numTrees = ambiguousParseTrees.size(); setTitle(title); treeViewers = new TreeViewer[numTrees]; JBPanel panelOfTrees = new JBPanel(); PreviewInterpreterRuleContext chosenTree = (PreviewInterpreterRuleContext) ambiguousParseTrees.get(highlightTreeIndex); panelOfTrees.setLayout(new BoxLayout(panelOfTrees, BoxLayout.X_AXIS)); for (int i = 0; i<numTrees; i++) { if ( i>0 ) { panelOfTrees.add(new JSeparator(JSeparator.VERTICAL)); } PreviewInterpreterRuleContext ctx = (PreviewInterpreterRuleContext) ambiguousParseTrees.get(i); treeViewers[i] = new TrackpadZoomingTreeView(null, null, highlightDiffs); // && ctx != chosenTree); AltLabelTextProvider treeText = new AltLabelTextProvider(previewState.parsingResult.parser, previewState.g); treeViewers[i].setTreeTextProvider(treeText); treeViewers[i].setTree(ctx); treeViewers[i].setHighlightedBoxColor(new JBColor(JBColor.lightGray, JBColor.GREEN)); // highlight root so people can see it across trees; might not be top node treeViewers[i].addHighlightedNodes(singletonList(ParsingUtils.findOverriddenDecisionRoot(ctx))); if ( ctx!=chosenTree ) { mark(chosenTree, ctx); } JBPanel wrapper = new JBPanel(new BorderLayout()); if ( i==highlightTreeIndex ) { wrapper.setBackground(JBColor.white); } else if ( UIUtil.isUnderDarcula() ) { wrapper.setBackground(Gray._43); } wrapper.add(treeViewers[i], BorderLayout.CENTER); panelOfTrees.add(wrapper); } // Wrap tree viewer components in scroll pane treeScrollPane.setViewportView(panelOfTrees); } }