private static void doShowError(String title, String description, DialogBuilder builder) { builder.setTitle(title); final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setText(description); textArea.setWrapStyleWord(false); textArea.setLineWrap(true); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(textArea); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel panel = new JPanel(new BorderLayout(10, 0)); panel.setPreferredSize(new Dimension(600, 400)); panel.add(scrollPane, BorderLayout.CENTER); panel.add(new JBLabel("Details:", Messages.getErrorIcon(), SwingConstants.LEFT), BorderLayout.NORTH); builder.setCenterPanel(panel); builder.setButtonsAlignment(SwingConstants.CENTER); builder.addOkAction(); builder.show(); }
@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; }
@Nullable @Override protected JComponent createCenterPanel() { final List<MemberInfo> info = TestIntegrationUtils.extractClassMethods(mySourceClass, false); disableMethodsWithTests(info); final JPanel panel = new JPanel(new BorderLayout()); myTable = new MemberSelectionTable(info, null); panel.add(ScrollPaneFactory.createScrollPane(myTable), BorderLayout.CENTER); panel.add(myIncludeInheritedCb, BorderLayout.NORTH); myIncludeInheritedCb.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { updateMethodsTable(); } }); return panel; }
protected JPanel createListAndVisibilityPanels() { myList = createTargetVariableChooser(); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myList); final JPanel hBox = new JPanel(new GridBagLayout()); final GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.weightx = 1; gbConstraints.weighty = 1; gbConstraints.gridheight = 1; gbConstraints.gridx = 0; gbConstraints.gridy = 0; gbConstraints.insets = new Insets(0, 0, 0, 0); hBox.add(scrollPane, gbConstraints); hBox.add(Box.createHorizontalStrut(4)); gbConstraints.weightx = 0; gbConstraints.fill = GridBagConstraints.NONE; gbConstraints.anchor = GridBagConstraints.NORTH; gbConstraints.gridx++; myVisibilityPanel = createVisibilityPanel(); hBox.add (myVisibilityPanel, gbConstraints); return hBox; }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); final JEditorPane messagePane = new JEditorPane(UIUtil.HTML_MIME, ""); messagePane.setEditable(false); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(messagePane); 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>"); } messagePane.setText(buf.toString()); return panel; }
public DetectedRootsChooser() { myModel = new ListTableModel<DetectedRootData>(); myTable = new TableView<DetectedRootData>(myModel); myTable.setTableHeader(null); myTable.setShowGrid(false); myComponent = ScrollPaneFactory.createScrollPane(myTable); myTable.registerKeyboardAction( new ActionListener() { public void actionPerformed(ActionEvent e) { invertSelectedRows(); } }, KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0), JComponent.WHEN_FOCUSED ); }
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); }
private JComponent createComments(final JComponent addComp) { final Splitter splitter = new Splitter(false); final JLabel label = new JLabel("Commit Message:") { @Override public Dimension getPreferredSize() { return new Dimension(getWidth(), 21); } }; JPanel panel = new JPanel(new BorderLayout(4, 4)); panel.add(label, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(myComments), BorderLayout.CENTER); myComments.setRows(5); myComments.setEditable(false); myComments.setLineWrap(true); splitter.setFirstComponent(panel); splitter.setSecondComponent(addComp); return splitter; }
public Browser(@NotNull InspectionResultsView view) { super(new BorderLayout()); myView = view; myCurrentEntity = null; myCurrentDescriptor = null; myHTMLViewer = new JEditorPane(UIUtil.HTML_MIME, InspectionsBundle.message("inspection.offline.view.empty.browser.text")); myHTMLViewer.setEditable(false); myHyperLinkListener = new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { Browser.this.hyperlinkUpdate(e); } }; myHTMLViewer.addHyperlinkListener(myHyperLinkListener); final JScrollPane pane = ScrollPaneFactory.createScrollPane(myHTMLViewer); pane.setBorder(null); add(pane, BorderLayout.CENTER); setupStyle(); }
protected MyIndentOptionsWrapper(CodeStyleSettings settings, LanguageCodeStyleSettingsProvider provider, IndentOptionsEditor editor) { super(settings); myProvider = provider; myTopPanel.add(myLeftPanel, BorderLayout.WEST); myRightPanel = new JPanel(); installPreviewPanel(myRightPanel); myEditor = editor; if (myEditor != null) { JPanel panel = myEditor.createPanel(); panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); JScrollPane scroll = ScrollPaneFactory.createScrollPane(panel, true); scroll.setPreferredSize(new Dimension(panel.getPreferredSize().width + scroll.getVerticalScrollBar().getPreferredSize().width + 5, -1)); myLeftPanel.add(scroll, BorderLayout.CENTER); } myTopPanel.add(myRightPanel, BorderLayout.CENTER); }
public ContentEntryTreeEditor(Project project, List<ModuleSourceRootEditHandler<?>> editHandlers) { myProject = project; myEditHandlers = editHandlers; myTree = new Tree(); myTree.setRootVisible(true); myTree.setShowsRootHandles(true); myEditingActionsGroup = new DefaultActionGroup(); TreeUtil.installActions(myTree); new TreeSpeedSearch(myTree); myTreePanel = new MyPanel(new BorderLayout()); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTree); myTreePanel.add(scrollPane, BorderLayout.CENTER); myTreePanel.setVisible(false); myDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor(); myDescriptor.setShowFileSystemRoots(false); }
private DisposerTree(Disposable parent) { myModificationToFilter = -1; final DisposerStructure structure = new DisposerStructure(this); final DefaultTreeModel model = new DefaultTreeModel(new DefaultMutableTreeNode()); final Tree tree = new Tree(model); tree.setRootVisible(false); tree.setShowsRootHandles(true); tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myTreeBuilder = new FilteringTreeBuilder(tree, DisposerTree.this, structure, AlphaComparator.INSTANCE) { @Override public boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) { return structure.getRootElement() == getOriginalNode(nodeDescriptor); } }; myTreeBuilder.setFilteringMerge(200, MergingUpdateQueue.ANY_COMPONENT); Disposer.register(this, myTreeBuilder); myTree = tree; setLayout(new BorderLayout()); add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER); Disposer.getTree().addListener(this); Disposer.register(parent, this); }
public PalettePanel() { super(new GridLayout(1, 1)); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myPaletteContainer); scrollPane.setBorder(null); add(scrollPane); new AnAction() { @Override public void actionPerformed(AnActionEvent e) { clearActiveItem(); } }.registerCustomShortcutSet(CommonShortcuts.ESCAPE, scrollPane); if (!ApplicationManager.getApplication().isHeadlessEnvironment()) { DragSource.getDefaultDragSource().addDragSourceListener(myDragSourceListener); } }
protected JComponent createNorthPanel() { BorderLayoutPanel panel = JBUI.Panels.simplePanel(15, 10); if (myIcon != null) { JLabel iconLabel = new JLabel(myIcon); panel.addToLeft(JBUI.Panels.simplePanel().addToTop(iconLabel)); } BorderLayoutPanel messagePanel = JBUI.Panels.simplePanel(); if (myMessage != null) { JLabel textLabel = new JLabel(myMessage); textLabel.setBorder(JBUI.Borders.emptyBottom(5)); textLabel.setUI(new MultiLineLabelUI()); messagePanel.addToTop(textLabel); } panel.add(messagePanel, BorderLayout.CENTER); final JScrollPane jScrollPane = ScrollPaneFactory.createScrollPane(); jScrollPane.setViewportView(myView); jScrollPane.setPreferredSize(JBUI.size(300, 80)); panel.addToBottom(jScrollPane); return panel; }
@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; }
/** * Creates panel and fills its table (see {@link #init(com.intellij.refactoring.classMembers.MemberInfoModel, java.util.Collection)} ) with members info * * @param title Title for panel * @param memberInfo list of members * @param model model */ public PyMemberSelectionPanel(String title, List<PyMemberInfo<PyElement>> memberInfo, final MemberInfoModel<PyElement, PyMemberInfo<PyElement>> model, final boolean supportAbstract) { Border titledBorder = IdeBorderFactory.createTitledBorder(title, false); Border emptyBorder = BorderFactory.createEmptyBorder(0, 5, 5, 5); Border border = BorderFactory.createCompoundBorder(titledBorder, emptyBorder); setBorder(border); setLayout(new BorderLayout()); myTable = new PyMemberSelectionTable(memberInfo, model, supportAbstract); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); add(scrollPane, BorderLayout.CENTER); }
private void createUIComponents() { Splitter splitter = new Splitter(false, 0.5f, 0.2f, 0.8f); myBody = splitter; myComponentsTable = new JBTable(); myComponentDescription = new JTextPane(); splitter.setShowDividerIcon(false); splitter.setShowDividerControls(false); splitter.setFirstComponent(ScrollPaneFactory.createScrollPane(myComponentsTable, false)); splitter.setSecondComponent(ScrollPaneFactory.createScrollPane(myComponentDescription, false)); myComponentDescription.setFont(UIUtil.getLabelFont()); myComponentDescription.setEditable(false); myComponentDescription.setBorder(BorderFactory.createEmptyBorder(WizardConstants.STUDIO_WIZARD_INSET_SIZE, WizardConstants.STUDIO_WIZARD_INSET_SIZE, WizardConstants.STUDIO_WIZARD_INSET_SIZE, WizardConstants.STUDIO_WIZARD_INSET_SIZE)); }
GroovyDocGenerationPanel() { myInputDir.addBrowseFolderListener(GroovyDocBundle.message("groovydoc.generate.directory.browse"), null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor()); myOutputDir.addBrowseFolderListener(GroovyDocBundle.message("groovydoc.generate.directory.browse"), null, null, FileChooserDescriptorFactory.createSingleFolderDescriptor()); myDataModel = new DefaultListModel(); myPackagesList = new JBList(myDataModel); myPackagesList.setMinimumSize(JBUI.size(100, 150)); JScrollPane packagesScrollPane = ScrollPaneFactory.createScrollPane(myPackagesList); myPackagesPanel.setLayout(new BorderLayout()); myPackagesPanel.setBorder(IdeBorderFactory.createTitledBorder("Source packages", false)); ActionToolbar actionToolbar = ActionManager.getInstance().createActionToolbar("GroovyDoc", getActionGroup(), true); myPackagesPanel.add(actionToolbar.getComponent(), BorderLayout.NORTH); myPackagesPanel.add(packagesScrollPane, BorderLayout.SOUTH); actionToolbar.updateActionsImmediately(); myPanel.setMinimumSize(JBUI.size(275, 350)); }
public GroupList(PsiClass[] classes) { super(new BorderLayout()); SortedListModel<String> model = new SortedListModel<String>(new Comparator<String>() { public int compare(String s1, String s2) { return s1.compareTo(s2); } }); list = new JBList(model); Set<String> groups = TestNGUtil.getAnnotationValues("groups", classes); String[] array = ArrayUtil.toStringArray(groups); Arrays.sort(array); model.addAll(array); add(ScrollPaneFactory.createScrollPane(list)); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); ScrollingUtil.ensureSelectionExists(list); }
private void createErrorPage() { myErrorLabel.setOpaque(false); myErrorLabel.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent e) { initSceneBuilder(true); } }); myErrorStack = new JTextArea(50, 20); myErrorStack.setEditable(false); myErrorPanel.add(myErrorLabel, BorderLayout.NORTH); myErrorPanel.add(ScrollPaneFactory.createScrollPane(myErrorStack), BorderLayout.CENTER); myPanel.add(myErrorPanel); }
private void createErrorCard() { myErrorPanel = new JPanel(new BorderLayout()); myErrorMessages = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5, true, false)); myErrorPanel.add(myErrorMessages, BorderLayout.PAGE_START); myErrorStack = new JTextArea(50, 20); myErrorStack.setEditable(false); myErrorStackLayout = new CardLayout(); myErrorStackPanel = new JPanel(myErrorStackLayout); myErrorStackPanel.add(new JLabel(), ERROR_NO_STACK_CARD); myErrorStackPanel.add(ScrollPaneFactory.createScrollPane(myErrorStack), ERROR_STACK_CARD); myErrorPanel.add(myErrorStackPanel, BorderLayout.CENTER); myPanel.add(myErrorPanel, ERROR_CARD); }
private void createComponent() { setLayout(new BorderLayout()); myRepositoryTree = new Tree(); myRepositoryTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); myRepositoryTree.setRootVisible(false); myRepositoryTree.setShowsRootHandles(true); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myRepositoryTree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); add(scrollPane, BorderLayout.CENTER); myRepositoryTree.setCellRenderer(new SvnRepositoryTreeCellRenderer()); TreeSpeedSearch search = new TreeSpeedSearch(myRepositoryTree, new Convertor<TreePath, String>() { @Override public String convert(TreePath o) { Object component = o.getLastPathComponent(); if (component instanceof RepositoryTreeNode) { return ((RepositoryTreeNode)component).getURL().toDecodedString(); } return null; } }); search.setComparator(new SpeedSearchComparator(false, true)); EditSourceOnDoubleClickHandler.install(myRepositoryTree); }
SeedStackNavigatorPanel(Project project, SimpleTree tree) { super(true, true); this.project = project; this.tree = tree; final ActionManager actionManager = ActionManager.getInstance(); ActionToolbar actionToolbar = actionManager.createActionToolbar( "SeedStack Navigator Toolbar", (DefaultActionGroup) actionManager.getAction("SeedStack.NavigatorActionsToolbar"), true ); actionToolbar.setTargetComponent(tree); setToolbar(actionToolbar.getComponent()); setContent(ScrollPaneFactory.createScrollPane(tree)); }
public InspectPanel(Project project, DebuggerStateManager stateManager, @NotNull NodeDescriptorImpl inspectDescriptor) { super(project, stateManager); getInspectTree().setInspectDescriptor(inspectDescriptor); add(ScrollPaneFactory.createScrollPane(getInspectTree()), BorderLayout.CENTER); registerDisposable(DebuggerAction.installEditAction(getInspectTree(), DebuggerActions.EDIT_NODE_SOURCE)); overrideShortcut(getInspectTree(), DebuggerActions.COPY_VALUE, CommonShortcuts.getCopy()); setUpdateEnabled(true); }
public ThreadsPanel(Project project, final DebuggerStateManager stateManager) { super(project, stateManager); final Disposable disposable = DebuggerAction.installEditAction(getThreadsTree(), DebuggerActions.EDIT_FRAME_SOURCE); registerDisposable(disposable); getThreadsTree().addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER && getThreadsTree().getSelectionCount() == 1) { DebuggerTreeNodeImpl node = (DebuggerTreeNodeImpl)getThreadsTree().getLastSelectedPathComponent(); if (node != null) { NodeDescriptorImpl descriptor = node.getDescriptor(); if (descriptor instanceof StackFrameDescriptorImpl) { selectFrame(node); } } } } }); add(ScrollPaneFactory.createScrollPane(getThreadsTree()), BorderLayout.CENTER); stateManager.addListener(new DebuggerContextListener() { @Override public void changeEvent(@NotNull DebuggerContextImpl newContext, DebuggerSession.Event event) { if (DebuggerSession.Event.ATTACHED == event || DebuggerSession.Event.RESUME == event) { startLabelsUpdate(); } else if (DebuggerSession.Event.PAUSE == event || DebuggerSession.Event.DETACHED == event || DebuggerSession.Event.DISPOSE == event) { myUpdateLabelsAlarm.cancelAllRequests(); } if (DebuggerSession.Event.DETACHED == event || DebuggerSession.Event.DISPOSE == event) { stateManager.removeListener(this); } } }); startLabelsUpdate(); }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(); panel.setLayout(new BorderLayout(UIUtil.DEFAULT_HGAP, UIUtil.DEFAULT_VGAP)); final JLabel classListLabel = new JLabel(); panel.add(classListLabel, BorderLayout.NORTH); mySuperClassesList = new JBList(mySuperClasses.toArray()); mySuperClassesList.setCellRenderer(new ClassCellRenderer(mySuperClassesList.getCellRenderer())); mySuperClassesList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); classListLabel.setText(RefactoringBundle.message("turnRefsToSuper.change.usages.to", mySubClass.getQualifiedName())); PsiClass nearestBase = RefactoringHierarchyUtil.getNearestBaseClass(mySubClass, true); int indexToSelect = 0; if(nearestBase != null) { indexToSelect = mySuperClasses.indexOf(nearestBase); } mySuperClassesList.setSelectedIndex(indexToSelect); panel.add(ScrollPaneFactory.createScrollPane(mySuperClassesList), BorderLayout.CENTER); myCbReplaceInstanceOf.setText(RefactoringBundle.message("turnRefsToSuper.use.superclass.in.instanceof")); myCbReplaceInstanceOf.setSelected(false); myCbReplaceInstanceOf.setFocusable(false); panel.add(myCbReplaceInstanceOf, BorderLayout.SOUTH); return panel; }
protected JComponent createCenterPanel() { JPanel mainPanel = new JPanel(new GridBagLayout()); final TitledSeparator separator = new TitledSeparator(); mainPanel.add(separator, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 2, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0,0)); myList = createTargetVariableChooser(); myList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { validateTextFields(e.getFirstIndex()); } }); separator.setText(RefactoringBundle.message("moveInstanceMethod.select.an.instance.parameter")); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myList); mainPanel.add(scrollPane, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0,0,0,0), 0,0)); myVisibilityPanel = createVisibilityPanel(); mainPanel.add(myVisibilityPanel, new GridBagConstraints(1, GridBagConstraints.RELATIVE, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.VERTICAL, new Insets(0,0,0,0), 0,0)); final JPanel parametersPanel = createParametersPanel(); if (parametersPanel != null) { mainPanel.add(parametersPanel, new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0,0)); } mainPanel.add(initOpenInEditorCb(), new GridBagConstraints(0, GridBagConstraints.RELATIVE, 1, 1, 1, 0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0,0,0,0), 0,0)); separator.setLabelFor(myList); validateTextFields(myList.getSelectedIndex()); updateOnChanged(myList); return mainPanel; }
/** * @param title if title contains 'm' - it would look and feel as mnemonic */ public MemberSelectionPanel(String title, List<MemberInfo> memberInfo, String abstractColumnHeader) { super(); setLayout(new BorderLayout()); myTable = createMemberSelectionTable(memberInfo, abstractColumnHeader); JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); add(SeparatorFactory.createSeparator(title, myTable), BorderLayout.NORTH); add(scrollPane, BorderLayout.CENTER); }
protected JComponent createNorthPanel() { JPanel panel = new JPanel(); panel.setLayout(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); gbConstraints.insets = new Insets(4, 8, 4, 8); gbConstraints.weighty = 0; gbConstraints.weightx = 1; gbConstraints.gridy = 0; gbConstraints.gridwidth = GridBagConstraints.REMAINDER; gbConstraints.gridheight = 1; gbConstraints.fill = GridBagConstraints.BOTH; gbConstraints.anchor = GridBagConstraints.WEST; panel.add(new JLabel(RefactoringBundle.message("introduce.parameter.to.method")), gbConstraints); gbConstraints.weighty = 1; myEnclosingMethodsList = new JBList(myEnclosingMethods.toArray()); myEnclosingMethodsList.setCellRenderer(new MethodCellRenderer()); myEnclosingMethodsList.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); int indexToSelect = 0; myEnclosingMethodsList.setSelectedIndex(indexToSelect); gbConstraints.gridy++; panel.add(ScrollPaneFactory.createScrollPane(myEnclosingMethodsList), gbConstraints); return panel; }
private SelectedElementInfo(@Nullable E element) { myElement = element; if (myElement != null) { //noinspection unchecked myCurrentPanel = element.getType().createElementPropertiesPanel(myElement, myContext); myPropertiesPanel.removeAll(); if (myCurrentPanel != null) { myPropertiesPanel.add(BorderLayout.CENTER, ScrollPaneFactory.createScrollPane(myCurrentPanel.createComponent(), true)); myCurrentPanel.reset(); myPropertiesPanel.revalidate(); } } }
private static JScrollPane wrapInScrollPane(JPanel panel) { JPanel wrapper = new JPanel(new BorderLayout()); wrapper.add(panel); wrapper.setBorder(IdeBorderFactory.createEmptyBorder(5)); return ScrollPaneFactory.createScrollPane(wrapper, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); }
private void initChunksPanel() { List<Chunk<Module>> chunks = getCycleChunks(); if (chunks.isEmpty()) { return; } myChunksPanel.setLayout(new BorderLayout()); myChunksPanel.setBorder( IdeBorderFactory.createTitledBorder(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.title"), true)); JLabel textLabel = new JLabel(CompilerBundle.message("generate.ant.build.dialog.cyclic.modules.table.description")); textLabel.setUI(new MultiLineLabelUI()); textLabel.setBorder(IdeBorderFactory.createEmptyBorder(4, 4, 6, 4)); myChunksPanel.add(textLabel, BorderLayout.NORTH); myTableModel = new MyTableModel(chunks); myTable = new Table(myTableModel); final MyTableCellRenderer cellRenderer = new MyTableCellRenderer(); final TableColumn nameColumn = myTable.getColumnModel().getColumn(MyTableModel.NAME_COLUMN); nameColumn.setCellEditor(ComboBoxTableCellEditor.INSTANCE); nameColumn.setCellRenderer(cellRenderer); final TableColumn labelColumn = myTable.getColumnModel().getColumn(MyTableModel.NUMBER_COLUMN); labelColumn.setCellRenderer(cellRenderer); final Dimension preferredSize = new Dimension(myTable.getPreferredSize()); preferredSize.height = (myTableModel.getRowCount() + 2) * myTable.getRowHeight() + myTable.getTableHeader().getHeight(); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myTable); scrollPane.setPreferredSize(preferredSize); myChunksPanel.add(scrollPane, BorderLayout.CENTER); }
/** * Shows dialog with text area to edit long strings that don't fit in text field. */ public static void showTextAreaDialog(final JTextField textField, final @Nls(capitalization = Nls.Capitalization.Title) String title, @NonNls final String dimensionServiceKey, final Function<String, List<String>> parser, final Function<List<String>, String> lineJoiner) { if (isApplicationInUnitTestOrHeadless()) { ourTestImplementation.show(title); } else { final JTextArea textArea = new JTextArea(10, 50); UIUtil.addUndoRedoActions(textArea); textArea.setWrapStyleWord(true); textArea.setLineWrap(true); List<String> lines = parser.fun(textField.getText()); textArea.setText(StringUtil.join(lines, "\n")); InsertPathAction.copyFromTo(textField, textArea); final DialogBuilder builder = new DialogBuilder(textField); builder.setDimensionServiceKey(dimensionServiceKey); builder.setCenterPanel(ScrollPaneFactory.createScrollPane(textArea)); builder.setPreferredFocusComponent(textArea); String rawText = title; if (StringUtil.endsWithChar(rawText, ':')) { rawText = rawText.substring(0, rawText.length() - 1); } builder.setTitle(rawText); builder.addOkAction(); builder.addCancelAction(); builder.setOkOperation(new Runnable() { @Override public void run() { textField.setText(lineJoiner.fun(Arrays.asList(StringUtil.splitByLines(textArea.getText())))); builder.getDialogWrapper().close(DialogWrapper.OK_EXIT_CODE); } }); builder.show(); } }
protected JComponent doCreateCenterPanel() { JPanel panel = new JPanel(new BorderLayout(15, 0)); if (myIcon != null) { JLabel iconLabel = new JLabel(myIcon); Container container = new Container(); container.setLayout(new BorderLayout()); container.add(iconLabel, BorderLayout.NORTH); panel.add(container, BorderLayout.WEST); } if (myMessage != null) { final JTextPane messageComponent = createMessageComponent(myMessage); final Dimension screenSize = messageComponent.getToolkit().getScreenSize(); final Dimension textSize = messageComponent.getPreferredSize(); if (myMessage.length() > 100) { final JScrollPane pane = ScrollPaneFactory.createScrollPane(messageComponent); pane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0)); pane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED); pane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); final int scrollSize = (int)new JScrollBar(Adjustable.VERTICAL).getPreferredSize().getWidth(); final Dimension preferredSize = new Dimension(Math.min(textSize.width, screenSize.width / 2) + scrollSize, Math.min(textSize.height, screenSize.height / 3) + scrollSize); pane.setPreferredSize(preferredSize); panel.add(pane, BorderLayout.CENTER); } else { panel.add(messageComponent, BorderLayout.CENTER); } } return panel; }
public static void show(final ExecutionException e, final String title, final Project project) { if (e instanceof RunCanceledByUserException) { return; } if (ApplicationManager.getApplication().isUnitTestMode()) { throw new RuntimeException(e.getLocalizedMessage()); } final String message = e.getMessage(); if (message == null || message.length() < 100) { Messages.showErrorDialog(project, message == null ? "exception was thrown" : message, title); return; } final DialogBuilder builder = new DialogBuilder(project); builder.setTitle(title); final JTextArea textArea = new JTextArea(); textArea.setEditable(false); textArea.setForeground(UIUtil.getLabelForeground()); textArea.setBackground(UIUtil.getLabelBackground()); textArea.setFont(UIUtil.getLabelFont()); textArea.setText(message); textArea.setWrapStyleWord(false); textArea.setLineWrap(true); final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(textArea); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); final JPanel panel = new JPanel(new BorderLayout(10, 0)); panel.setPreferredSize(JBUI.size(500, 200)); panel.add(scrollPane, BorderLayout.CENTER); panel.add(new JLabel(Messages.getErrorIcon()), BorderLayout.WEST); builder.setCenterPanel(panel); builder.setButtonsAlignment(SwingConstants.CENTER); builder.addOkAction(); builder.show(); }
private Component createTreeComponent(DualViewColumnInfo[] columns, TreeNode root) { myTreeView = new TreeTableView(new ListTreeTableModelOnColumns(root, createTreeColumns(columns))) { public TableCellRenderer getCellRenderer(int row, int column) { return createWrappedRenderer(super.getCellRenderer(row, column)); } }; myTreeView.getTree().getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION); JPanel result = new JPanel(new BorderLayout()); result.add(ScrollPaneFactory.createScrollPane(myTreeView), BorderLayout.CENTER); return result; }
private void createView() { myComponentManager.setData(myEngine.getCurrent()); //myList.setListData(ArrayUtil.toObjectArray(myEngine.getCurrent())); myPanel.add(ActionManager.getInstance().createActionToolbar("merge all", createListActions(), true).getComponent(), BorderLayout.NORTH); final JScrollPane scroll = ScrollPaneFactory .createScrollPane(myComponentManager.getComponent(), JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); myPanel.add(scroll, BorderLayout.CENTER); }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); Table table = new Table(new MyTableModel()); JLabel label = new JLabel(ProjectBundle.message("project.macros.prompt")); label.setBorder(IdeBorderFactory.createEmptyBorder(6, 6, 6, 6)); panel.add(label, BorderLayout.NORTH); panel.add(ScrollPaneFactory.createScrollPane(table), BorderLayout.CENTER); return panel; }
void setContent(JComponent c, ConfigurationException e, boolean scrollable) { if (c != null && mySimpleContent == c && myException == e) return; removeAll(); if (c != null) { if (scrollable) { JScrollPane scroll = ScrollPaneFactory.createScrollPane(null, true); scroll.setViewport(new GradientViewport(c, JBUI.insets(5), false)); scroll.getVerticalScrollBar().setUnitIncrement(JBUI.scale(10)); add(scroll, BorderLayout.CENTER); } else { add(c, BorderLayout.CENTER); } } if (e != null) { myErrorLabel.setText(UIUtil.toHtml(e.getMessage())); add(myErrorLabel, BorderLayout.NORTH); } mySimpleContent = c; myException = e; myMaster = null; myToolbar = null; myDetails = null; mySplitter.setFirstComponent(null); mySplitter.setSecondComponent(null); }
protected JComponent createCenterPanel() { JPanel panel = new JPanel(new BorderLayout()); myBrowser = new JEditorPane(UIUtil.HTML_MIME, ""); panel.add(ScrollPaneFactory.createScrollPane(myBrowser)); panel.setPreferredSize(new Dimension(DEFAULT_WIDTH, DEFAULT_HEIGHT)); return panel; }