Search in sources :

Example 46 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class StudyNewProjectPanel method layoutPanel.

private void layoutPanel() {
    myCoursesComboBox = new ComboBox<>();
    final LabeledComponent<ComboBox> coursesCombo = LabeledComponent.create(myCoursesComboBox, "Courses:", BorderLayout.WEST);
    myRefreshButton = new FixedSizeButton(coursesCombo);
    if (SystemInfo.isMac && !UIUtil.isUnderDarcula())
        myRefreshButton.putClientProperty("JButton.buttonType", null);
    myRefreshButton.setIcon(AllIcons.Actions.Refresh);
    myBrowseButton = new FixedSizeButton(coursesCombo);
    final JPanel comboPanel = new JPanel(new BorderLayout());
    comboPanel.add(coursesCombo, BorderLayout.CENTER);
    comboPanel.add(myRefreshButton, BorderLayout.EAST);
    final JPanel coursesPanel = new JPanel(new BorderLayout());
    coursesPanel.add(comboPanel, BorderLayout.CENTER);
    coursesPanel.add(myBrowseButton, BorderLayout.EAST);
    add(coursesPanel);
    myAnchor = coursesCombo;
    final JPanel panel = new JPanel(new BorderLayout());
    final JLabel invisibleLabel = new JLabel();
    invisibleLabel.setPreferredSize(new JLabel("Location: ").getPreferredSize());
    panel.add(invisibleLabel, BorderLayout.WEST);
    myInfoPanel = new JPanel(new VerticalFlowLayout());
    myAuthorLabel = new JLabel();
    myDescriptionPane = new JTextPane();
    myDescriptionPane.setEditable(true);
    myDescriptionPane.setEnabled(true);
    myAuthorLabel.setEnabled(true);
    myDescriptionPane.setPreferredSize(new Dimension(150, 200));
    myDescriptionPane.setFont(coursesCombo.getFont());
    myInfoPanel.add(myAuthorLabel);
    myInfoPanel.add(new JBScrollPane(myDescriptionPane));
    panel.add(myInfoPanel, BorderLayout.CENTER);
    add(panel);
}
Also used : ComboBox(com.intellij.openapi.ui.ComboBox) FixedSizeButton(com.intellij.openapi.ui.FixedSizeButton) JBScrollPane(com.intellij.ui.components.JBScrollPane) VerticalFlowLayout(com.intellij.openapi.ui.VerticalFlowLayout)

Example 47 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class StudySwingToolWindow method createTaskInfoPanel.

@Override
public JComponent createTaskInfoPanel(Project project) {
    myTaskTextPane = new JTextPane();
    final JBScrollPane scrollPane = new JBScrollPane(myTaskTextPane);
    myTaskTextPane.setContentType(new HTMLEditorKit().getContentType());
    final EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
    int fontSize = editorColorsScheme.getEditorFontSize();
    final String fontName = editorColorsScheme.getEditorFontName();
    final Font font = new Font(fontName, Font.PLAIN, fontSize);
    String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }" + "pre {font-family: Courier; display: inline; ine-height: 50px; padding-top: 5px; padding-bottom: 5px; padding-left: 5px; background-color:" + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}" + "code {font-family: Courier; display: flex; float: left; background-color:" + ColorUtil.toHex(ColorUtil.dimmer(UIUtil.getPanelBackground())) + ";}";
    ((HTMLDocument) myTaskTextPane.getDocument()).getStyleSheet().addRule(bodyRule);
    myTaskTextPane.setEditable(false);
    if (!UIUtil.isUnderDarcula()) {
        myTaskTextPane.setBackground(EditorColorsManager.getInstance().getGlobalScheme().getDefaultBackground());
    }
    myTaskTextPane.setBorder(new EmptyBorder(20, 20, 0, 10));
    myTaskTextPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
    return scrollPane;
}
Also used : HTMLEditorKit(javax.swing.text.html.HTMLEditorKit) EditorColorsScheme(com.intellij.openapi.editor.colors.EditorColorsScheme) EmptyBorder(javax.swing.border.EmptyBorder) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 48 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class CodeStyleHtmlPanel method createUIComponents.

private void createUIComponents() {
    myRightMarginForm = new RightMarginForm(StdFileTypes.HTML.getLanguage(), getSettings());
    myRightMarginPanel = myRightMarginForm.getTopPanel();
    myJBScrollPane = new JBScrollPane() {

        @Override
        public Dimension getPreferredSize() {
            Dimension prefSize = super.getPreferredSize();
            return new Dimension(prefSize.width + 15, prefSize.height);
        }
    };
}
Also used : RightMarginForm(com.intellij.application.options.codeStyle.RightMarginForm) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 49 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project intellij-community by JetBrains.

the class CodeStyleXmlPanel method createUIComponents.

private void createUIComponents() {
    myJBScrollPane = new JBScrollPane() {

        @Override
        public Dimension getPreferredSize() {
            Dimension prefSize = super.getPreferredSize();
            return new Dimension(prefSize.width + 15, prefSize.height);
        }
    };
    myRightMarginForm = new RightMarginForm(StdFileTypes.XML.getLanguage(), getSettings());
    myRightMarginPanel = myRightMarginForm.getTopPanel();
}
Also used : RightMarginForm(com.intellij.application.options.codeStyle.RightMarginForm) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Example 50 with JBScrollPane

use of com.intellij.ui.components.JBScrollPane in project azure-tools-for-java by Microsoft.

the class ServerExplorerToolWindowFactory method createToolWindowContent.

@Override
public void createToolWindowContent(@NotNull final Project project, @NotNull final ToolWindow toolWindow) {
    // initialize azure service module
    AzureModule azureModule = new AzureModuleImpl(project);
    HDInsightUtil.setHDInsightRootModule(azureModule);
    // initialize with all the service modules
    DefaultTreeModel treeModel = new DefaultTreeModel(initRoot(project, azureModule));
    treeModelMap.put(project, treeModel);
    // initialize tree
    final JTree tree = new Tree(treeModel);
    tree.setRootVisible(false);
    tree.setCellRenderer(new NodeTreeCellRenderer());
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    // add a click handler for the tree
    tree.addMouseListener(new MouseAdapter() {

        @Override
        public void mousePressed(MouseEvent e) {
            treeMousePressed(e, tree);
        }
    });
    // add the tree to the window
    toolWindow.getComponent().add(new JBScrollPane(tree));
    // setup toolbar icons
    addToolbarItems(toolWindow, azureModule);
//        try {
//            azureModule.registerSubscriptionsChanged();
//        } catch (AzureCmdException ignored) {
//        }
}
Also used : MouseEvent(java.awt.event.MouseEvent) AzureModuleImpl(com.microsoft.intellij.serviceexplorer.azure.AzureModuleImpl) AzureModule(com.microsoft.tooling.msservices.serviceexplorer.azure.AzureModule) MouseAdapter(java.awt.event.MouseAdapter) Tree(com.intellij.ui.treeStructure.Tree) JBScrollPane(com.intellij.ui.components.JBScrollPane)

Aggregations

JBScrollPane (com.intellij.ui.components.JBScrollPane)51 ActionEvent (java.awt.event.ActionEvent)7 Nullable (org.jetbrains.annotations.Nullable)7 DialogWrapper (com.intellij.openapi.ui.DialogWrapper)6 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 JBList (com.intellij.ui.components.JBList)6 ListSelectionEvent (javax.swing.event.ListSelectionEvent)6 ListSelectionListener (javax.swing.event.ListSelectionListener)5 JBTable (com.intellij.ui.table.JBTable)4 Tree (com.intellij.ui.treeStructure.Tree)4 java.awt (java.awt)4 MouseEvent (java.awt.event.MouseEvent)4 List (java.util.List)4 javax.swing (javax.swing)4 TreePath (javax.swing.tree.TreePath)4 NotNull (org.jetbrains.annotations.NotNull)4 Module (com.intellij.openapi.module.Module)3 Project (com.intellij.openapi.project.Project)3 VerticalFlowLayout (com.intellij.openapi.ui.VerticalFlowLayout)3 StringUtil (com.intellij.openapi.util.text.StringUtil)3