Example usage for javax.swing JScrollPane setBorder

List of usage examples for javax.swing JScrollPane setBorder

Introduction

In this page you can find the example usage for javax.swing JScrollPane setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:org.isatools.isacreatorconfigurator.configui.FieldInterface.java

private void instantiateFields(String initFieldName) {
    // OVERALL CONTAINER
    JPanel container = new JPanel();
    container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS));
    container.setBackground(UIHelper.BG_COLOR);

    JLabel fieldDefinitionLab = new JLabel(fieldDefinitionHeader, JLabel.CENTER);
    container.add(fieldDefinitionLab);//w  w w  .  j av a  2 s  . c  o m

    container.add(Box.createVerticalStrut(5));

    // FIELD LABEL & INPUT BOX CONTAINER
    JPanel fieldCont = new JPanel(new GridLayout(1, 2));
    fieldCont.setBackground(UIHelper.BG_COLOR);

    fieldName = new RoundedJTextField(15);
    fieldName.setText(initFieldName);
    fieldName.setEditable(false);
    UIHelper.renderComponent(fieldName, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    JLabel fieldNameLab = UIHelper.createLabel("Field Name: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR);
    fieldCont.add(fieldNameLab);
    fieldCont.add(fieldName);
    container.add(fieldCont);

    JPanel descCont = new JPanel(new GridLayout(1, 2));
    descCont.setBackground(UIHelper.BG_COLOR);
    description = new RoundedJTextArea();
    description.setLineWrap(true);
    description.setWrapStyleWord(true);
    UIHelper.renderComponent(description, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    JScrollPane descScroll = new JScrollPane(description, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    descScroll.setBackground(UIHelper.BG_COLOR);
    descScroll.setPreferredSize(new Dimension(150, 65));
    descScroll.getViewport().setBackground(UIHelper.BG_COLOR);

    IAppWidgetFactory.makeIAppScrollPane(descScroll);

    JLabel descLab = UIHelper.createLabel("Description: ", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR);
    descLab.setVerticalAlignment(JLabel.TOP);
    descCont.add(descLab);
    descCont.add(descScroll);
    container.add(descCont);

    // add datatype information
    JPanel datatypeCont = new JPanel(new GridLayout(1, 2));
    datatypeCont.setBackground(UIHelper.BG_COLOR);

    DataTypes[] allowedDataTypes = initFieldName.equals(UNIT_STR) ? new DataTypes[] { DataTypes.ONTOLOGY_TERM }
            : DataTypes.values();

    datatype = new JComboBox(allowedDataTypes);
    datatype.addActionListener(this);
    UIHelper.renderComponent(datatype, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, UIHelper.BG_COLOR);

    JLabel dataTypeLab = UIHelper.createLabel("Datatype:", UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR);
    datatypeCont.add(dataTypeLab);
    datatypeCont.add(datatype);
    container.add(datatypeCont);

    defaultValContStd = new JPanel(new GridLayout(1, 2));
    defaultValContStd.setBackground(UIHelper.BG_COLOR);

    defaultValCont = Box.createHorizontalBox();
    defaultValCont.setPreferredSize(new Dimension(150, 25));

    defaultValStd = new RoundedFormattedTextField(null, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR,
            UIHelper.DARK_GREEN_COLOR);
    defaultValCont.setPreferredSize(new Dimension(120, 25));
    defaultValStd.setFormatterFactory(new DefaultFormatterFactory(
            new RegExFormatter(".*", defaultValStd, false, UIHelper.DARK_GREEN_COLOR, UIHelper.RED_COLOR,
                    UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR, UIHelper.TRANSPARENT_LIGHT_GREEN_COLOR)));
    defaultValStd.setForeground(UIHelper.DARK_GREEN_COLOR);
    defaultValStd.setFont(UIHelper.VER_11_PLAIN);

    defaultValCont.add(defaultValStd);

    defaultValLabStd = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR);

    defaultValContStd.add(defaultValLabStd);
    defaultValContStd.add(defaultValCont);
    container.add(defaultValContStd);

    defaultValContBool = new JPanel(new GridLayout(1, 2));
    defaultValContBool.setBackground(UIHelper.BG_COLOR);
    defaultValContBool.setVisible(false);

    listDataSourceCont = new JPanel(new GridLayout(2, 1));
    listDataSourceCont.setBackground(UIHelper.BG_COLOR);
    listDataSourceCont.setVisible(false);

    JLabel listValLab = UIHelper.createLabel("Please enter comma separated list of values:",
            UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR);
    listDataSourceCont.add(listValLab);

    listValues = new RoundedJTextArea("SampleVal1, SampleVal2, SampleVal3", 3, 5);
    listValues.setLineWrap(true);
    listValues.setWrapStyleWord(true);
    UIHelper.renderComponent(listValues, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    JScrollPane listScroll = new JScrollPane(listValues, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    listScroll.setBackground(UIHelper.BG_COLOR);
    listScroll.getViewport().setBackground(UIHelper.BG_COLOR);

    listDataSourceCont.add(listScroll);
    container.add(listDataSourceCont);

    IAppWidgetFactory.makeIAppScrollPane(listScroll);

    sourceEntryPanel = new JPanel(new BorderLayout());
    sourceEntryPanel.setSize(new Dimension(125, 190));
    sourceEntryPanel.setOpaque(false);
    sourceEntryPanel.setVisible(false);

    preferredOntologySource = new JPanel();
    preferredOntologySource.setLayout(new BoxLayout(preferredOntologySource, BoxLayout.PAGE_AXIS));
    preferredOntologySource.setVisible(false);
    recommendOntologySource = new JCheckBox("Use recommended ontology source?", false);

    UIHelper.renderComponent(recommendOntologySource, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    recommendOntologySource.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (recommendOntologySource.isSelected()) {
                sourceEntryPanel.setVisible(true);
            } else {
                sourceEntryPanel.setVisible(false);
            }
        }
    });

    JPanel useOntologySourceCont = new JPanel(new GridLayout(1, 1));
    useOntologySourceCont.add(recommendOntologySource);

    preferredOntologySource.add(useOntologySourceCont);

    JPanel infoCont = new JPanel(new GridLayout(1, 1));
    JLabel infoLab = UIHelper.createLabel(
            "<html>click on the <strong>configure ontologies</strong> button to open the ontology configurator to edit the list of ontologies and search areas within an ontology</html>",
            UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR);
    infoLab.setPreferredSize(new Dimension(100, 40));
    infoCont.add(infoLab);

    sourceEntryPanel.add(infoCont, BorderLayout.NORTH);

    JLabel preferredOntologiesLab = new JLabel(preferredOntologiesSidePanelIcon);
    preferredOntologiesLab.setVerticalAlignment(SwingConstants.TOP);

    sourceEntryPanel.add(preferredOntologiesLab, BorderLayout.WEST);

    ontologiesToUseModel = new DefaultTableModel(new String[0][2], ontologyColumnHeaders) {
        @Override
        public boolean isCellEditable(int i, int i1) {
            return false;
        }
    };
    ontologiesToUse = new JTable(ontologiesToUseModel);
    ontologiesToUse.getTableHeader().setBackground(UIHelper.BG_COLOR);

    try {
        ontologiesToUse.setDefaultRenderer(Class.forName("java.lang.Object"),
                new CustomSpreadsheetCellRenderer());
    } catch (ClassNotFoundException e) {
        // empty
    }

    renderTableHeader();

    JScrollPane ontologiesToUseScroller = new JScrollPane(ontologiesToUse,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    ontologiesToUseScroller.setBorder(new EmptyBorder(0, 0, 0, 0));
    ontologiesToUseScroller.setPreferredSize(new Dimension(100, 80));
    ontologiesToUseScroller.setBackground(UIHelper.BG_COLOR);
    ontologiesToUseScroller.getViewport().setBackground(UIHelper.BG_COLOR);

    IAppWidgetFactory.makeIAppScrollPane(ontologiesToUseScroller);

    sourceEntryPanel.add(ontologiesToUseScroller);

    JPanel buttonCont = new JPanel(new BorderLayout());
    final JLabel openConfigButton = new JLabel(ontologyConfigIcon);
    openConfigButton.setVerticalAlignment(SwingConstants.TOP);
    openConfigButton.setHorizontalAlignment(SwingConstants.RIGHT);

    MouseAdapter showOntologyConfigurator = new MouseAdapter() {

        public void mouseEntered(MouseEvent mouseEvent) {
            openConfigButton.setIcon(ontologyConfigIconOver);
        }

        public void mouseExited(MouseEvent mouseEvent) {
            openConfigButton.setIcon(ontologyConfigIcon);
        }

        public void mousePressed(MouseEvent mouseEvent) {

            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    if (openConfigButton.isEnabled()) {
                        openConfigButton.setIcon(ontologyConfigIcon);
                        ontologyConfig = new OntologyConfigUI(ontologiesToQuery, selectedOntologies);
                        ontologyConfig.addPropertyChangeListener("ontologySelected",
                                new PropertyChangeListener() {
                                    public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
                                        selectedOntologies = (ListOrderedMap<String, RecommendedOntology>) propertyChangeEvent
                                                .getNewValue();
                                        updateTable();
                                    }
                                });
                        showPopupInCenter(ontologyConfig);
                    }
                }
            });
        }

    };

    openConfigButton.addMouseListener(showOntologyConfigurator);

    buttonCont.add(openConfigButton, BorderLayout.EAST);

    sourceEntryPanel.add(buttonCont, BorderLayout.SOUTH);
    preferredOntologySource.add(sourceEntryPanel);
    container.add(preferredOntologySource);

    String[] contents = new String[] { "true", "false" };
    defaultValBool = new

    JComboBox(contents);

    UIHelper.renderComponent(defaultValBool, UIHelper.VER_12_PLAIN, UIHelper.DARK_GREEN_COLOR,
            UIHelper.BG_COLOR);

    JLabel defaultValLabBool = UIHelper.createLabel(DEFAULT_VAL_STR, UIHelper.VER_12_BOLD,
            UIHelper.DARK_GREEN_COLOR);

    defaultValContBool.add(defaultValLabBool);
    defaultValContBool.add(defaultValBool);
    container.add(defaultValContBool);

    // RegExp data entry
    isInputFormatted = new JCheckBox("Is the input formatted?", false);
    isInputFormatted.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    isInputFormatted.setHorizontalAlignment(SwingConstants.LEFT);

    UIHelper.renderComponent(isInputFormatted, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    isInputFormatted.addActionListener(this);
    container.add(UIHelper.wrapComponentInPanel(isInputFormatted));

    inputFormatCont = new JPanel();

    inputFormatCont.setLayout(new BoxLayout(inputFormatCont, BoxLayout.LINE_AXIS));
    inputFormatCont.setVisible(false);
    inputFormatCont.setBackground(UIHelper.BG_COLOR);
    inputFormat = new RoundedJTextField(10);
    inputFormat.setText(".*");
    inputFormat.setSize(new Dimension(150, 19));

    inputFormat.setPreferredSize(new Dimension(160, 25));
    inputFormat.setToolTipText("Field expects a regular expression describing the input format.");
    UIHelper.renderComponent(inputFormat, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    JLabel inputFormatLab = UIHelper.createLabel("Input format:", UIHelper.VER_11_BOLD,
            UIHelper.DARK_GREEN_COLOR);
    inputFormatLab.setVerticalAlignment(SwingConstants.TOP);

    inputFormatCont.add(inputFormatLab);
    inputFormatCont.add(inputFormat);
    JLabel checkRegExp = new JLabel(checkRegExIcon, JLabel.RIGHT);
    checkRegExp.setOpaque(false);
    checkRegExp.addMouseListener(new MouseAdapter() {

        public void mousePressed(MouseEvent event) {
            String regexToCheck = inputFormat.getText();

            final CheckRegExGUI regexChecker = new CheckRegExGUI(regexToCheck);
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    regexChecker.createGUI();
                }
            });
            regexChecker.addPropertyChangeListener("close", new PropertyChangeListener() {
                public void propertyChange(PropertyChangeEvent evt) {
                    main.getApplicationContainer().hideSheet();
                }
            });
            SwingUtilities.invokeLater(new Runnable() {
                public void run() {
                    main.getApplicationContainer().showJDialogAsSheet(regexChecker);
                }
            });
        }

    }

    );
    inputFormatCont.add(checkRegExp);
    container.add(inputFormatCont);

    usesTemplateForWizard = new JCheckBox("Requires template for wizard?", false);
    usesTemplateForWizard.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
    usesTemplateForWizard.setHorizontalAlignment(SwingConstants.LEFT);

    UIHelper.renderComponent(usesTemplateForWizard, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    usesTemplateForWizard.addActionListener(this);
    container.add(UIHelper.wrapComponentInPanel(usesTemplateForWizard));

    wizardTemplatePanel = new JPanel(new GridLayout(1, 2));
    wizardTemplatePanel.setVisible(false);
    wizardTemplatePanel.setBackground(UIHelper.BG_COLOR);

    wizardTemplate = new RoundedJTextArea();
    wizardTemplate.setToolTipText("A template for the wizard to auto-create the data...");
    wizardTemplate.setLineWrap(true);
    wizardTemplate.setWrapStyleWord(true);
    UIHelper.renderComponent(wizardTemplate, UIHelper.VER_11_PLAIN, UIHelper.DARK_GREEN_COLOR, false);

    JScrollPane wizScroll = new JScrollPane(wizardTemplate, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    wizScroll.getViewport().setBackground(UIHelper.BG_COLOR);
    wizScroll.setPreferredSize(new Dimension(70, 60));

    IAppWidgetFactory.makeIAppScrollPane(wizScroll);

    JLabel wizardTemplateLab = UIHelper.createLabel("Template definition:", UIHelper.VER_11_BOLD,
            UIHelper.DARK_GREEN_COLOR);
    wizardTemplateLab.setVerticalAlignment(JLabel.TOP);

    wizardTemplatePanel.add(wizardTemplateLab);
    wizardTemplatePanel.add(wizScroll);

    container.add(wizardTemplatePanel);

    JPanel checkCont = new JPanel(new GridLayout(3, 2));
    checkCont.setBackground(UIHelper.BG_COLOR);
    checkCont.setBorder(new TitledBorder(new RoundedBorder(UIHelper.DARK_GREEN_COLOR, 4),
            "Behavioural Attributes", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR));

    required = new JCheckBox("Required ", true);

    UIHelper.renderComponent(required, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    checkCont.add(required);

    acceptsMultipleValues = new JCheckBox("Allow multiple instances", false);

    UIHelper.renderComponent(acceptsMultipleValues, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    checkCont.add(acceptsMultipleValues);
    acceptsFileLocations = new JCheckBox("Accepts file locations", false);

    acceptsFileLocations.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent actionEvent) {
            acceptsMultipleValues.setSelected(false);
            acceptsMultipleValues.setEnabled(!acceptsFileLocations.isSelected());
        }
    });

    UIHelper.renderComponent(acceptsFileLocations, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    checkCont.add(acceptsFileLocations);

    hidden = new JCheckBox("hidden?", false);

    UIHelper.renderComponent(hidden, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);
    checkCont.add(hidden);

    forceOntologySelection = new JCheckBox("Force ontology selection", false);
    UIHelper.renderComponent(forceOntologySelection, UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR, false);

    checkCont.add(forceOntologySelection);

    container.add(checkCont);

    JScrollPane contScroll = new JScrollPane(container, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    contScroll.setBorder(null);
    contScroll.setAutoscrolls(true);

    IAppWidgetFactory.makeIAppScrollPane(contScroll);

    add(contScroll, BorderLayout.NORTH);
}

From source file:org.isatools.isacreatorconfigurator.ontologyconfigurationtool.OntologyConfigUI.java

private void createOntologySelectionPanel() {

    OntologyListRenderer listRenderer = new OntologyListRenderer();

    JPanel westPanel = new JPanel(new BorderLayout());

    JPanel selectedOntologiesContainer = new JPanel(new BorderLayout());
    selectedOntologiesContainer.setOpaque(false);

    // create List containing selected ontologies
    selectedOntologyListModel = new DefaultListModel();
    selectedOntologyList = new JList(selectedOntologyListModel);
    selectedOntologyList.setCellRenderer(new SelectedOntologyListRenderer());
    selectedOntologyList.setBackground(UIHelper.BG_COLOR);

    selectedOntologyList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent listSelectionEvent) {
            setOntologySelectionPanelPlaceholder(infoImage);

            setSelectedOntologyButtonVisibility(selectedOntologyList.isSelectionEmpty());
        }//  w  w  w .j a v  a 2 s . c om
    });

    JScrollPane selectedOntologiesScroller = new JScrollPane(selectedOntologyList,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    selectedOntologiesScroller.setPreferredSize(new Dimension(200, 255));
    selectedOntologiesScroller.setBackground(UIHelper.BG_COLOR);
    selectedOntologiesScroller.getViewport().setBackground(UIHelper.BG_COLOR);

    IAppWidgetFactory.makeIAppScrollPane(selectedOntologiesScroller);

    selectedOntologiesContainer.setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7),
            "selected ontologies", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR));

    selectedOntologiesContainer.add(selectedOntologiesScroller, BorderLayout.CENTER);

    // ADD BUTTONS
    removeOntologyButton = new JLabel(removeOntologyButtonIcon);
    removeOntologyButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent mouseEvent) {

            if (!selectedOntologyList.isSelectionEmpty()) {
                String ontologyToRemove = selectedOntologyList.getSelectedValue().toString();
                System.out.println("Removing  " + ontologyToRemove);
                selectedOntologies.remove(ontologyToRemove);
                setOntologySelectionPanelPlaceholder(infoImage);

                updateSelectedOntologies();
            }

            removeOntologyButton.setIcon(removeOntologyButtonIcon);
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            removeOntologyButton.setIcon(removeOntologyButtonIconOver);
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
            removeOntologyButton.setIcon(removeOntologyButtonIcon);
        }
    });

    removeOntologyButton.setVisible(false);

    viewOntologyButton = new JLabel(browseOntologyButtonIcon);
    viewOntologyButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent mouseEvent) {
            performTransition();
            viewOntologyButton.setIcon(browseOntologyButtonIcon);
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            viewOntologyButton.setIcon(browseOntologyButtonIconOver);
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
            viewOntologyButton.setIcon(browseOntologyButtonIcon);
        }
    });

    viewOntologyButton.setVisible(false);

    removeRestrictionButton = new JLabel(removeRestrictionButtonIcon);
    removeRestrictionButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent mouseEvent) {
            if (!selectedOntologyList.isSelectionEmpty()) {
                ((RecommendedOntology) selectedOntologyList.getSelectedValue()).setBranchToSearchUnder(null);
                removeRestrictionButton.setVisible(false);
                selectedOntologyList.repaint();
            }

            removeRestrictionButton.setIcon(removeRestrictionButtonIcon);
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            removeRestrictionButton.setIcon(removeRestrictionButtonIconOver);
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
            removeRestrictionButton.setIcon(removeRestrictionButtonIcon);
        }
    });

    removeRestrictionButton.setVisible(false);

    Box selectedOntologiesOptionContainer = Box.createHorizontalBox();
    selectedOntologiesOptionContainer.setOpaque(false);

    selectedOntologiesOptionContainer.add(removeOntologyButton);
    selectedOntologiesOptionContainer.add(viewOntologyButton);
    selectedOntologiesOptionContainer.add(removeRestrictionButton);

    selectedOntologiesContainer.add(selectedOntologiesOptionContainer, BorderLayout.SOUTH);

    // create panel populated with all available ontologies inside a filterable list!
    JPanel availableOntologiesListContainer = new JPanel(new BorderLayout());
    availableOntologiesListContainer
            .setBorder(new TitledBorder(new RoundedBorder(UIHelper.LIGHT_GREEN_COLOR, 7),
                    "available ontologies", TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                    UIHelper.VER_11_BOLD, UIHelper.DARK_GREEN_COLOR));

    final ExtendedJList availableOntologies = new ExtendedJList(listRenderer);

    final JLabel addOntologyButton = new JLabel(addOntologyButtonIcon);
    addOntologyButton.addMouseListener(new MouseAdapter() {
        @Override
        public void mousePressed(MouseEvent mouseEvent) {
            if (!availableOntologies.isSelectionEmpty()) {
                Ontology ontology = (Ontology) availableOntologies.getSelectedValue();

                selectedOntologies.put(ontology.getOntologyDisplayLabel(), new RecommendedOntology(ontology));
                updateSelectedOntologies();

                setOntologySelectionPanelPlaceholder(infoImage);
            }

            addOntologyButton.setIcon(addOntologyButtonIcon);
        }

        @Override
        public void mouseEntered(MouseEvent mouseEvent) {
            addOntologyButton.setIcon(addOntologyButtonIconOver);
        }

        @Override
        public void mouseExited(MouseEvent mouseEvent) {
            addOntologyButton.setIcon(addOntologyButtonIcon);
        }
    });

    final JLabel info = UIHelper.createLabel("", UIHelper.VER_10_PLAIN, UIHelper.DARK_GREEN_COLOR);

    availableOntologies.addPropertyChangeListener("update", new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent propertyChangeEvent) {
            info.setText("<html>viewing <b>" + availableOntologies.getFilteredItems().size()
                    + "</b> ontologies</html>");
        }
    });

    Box optionsBox = Box.createVerticalBox();

    optionsBox.add(UIHelper.wrapComponentInPanel(info));

    Box availableOntologiesOptionBox = Box.createHorizontalBox();
    availableOntologiesOptionBox.add(addOntologyButton);
    availableOntologiesOptionBox.add(Box.createHorizontalGlue());

    optionsBox.add(availableOntologiesOptionBox);

    availableOntologiesListContainer.add(optionsBox, BorderLayout.SOUTH);

    if (ontologiesToBrowseOn == null) {
        ontologiesToBrowseOn = new ArrayList<Ontology>();
        List<Ontology> bioportalQueryResult = bioportalClient.getAllOntologies();
        if (bioportalQueryResult != null) {
            ontologiesToBrowseOn.addAll(bioportalQueryResult);
        }
        ontologiesToBrowseOn.addAll(olsClient.getAllOntologies());
    }

    // precautionary check in case of having no ontologies available to search on.
    if (ontologiesToBrowseOn != null) {
        for (Ontology o : ontologiesToBrowseOn) {
            availableOntologies.addItem(o);
        }
    }

    info.setText(
            "<html>viewing <b>" + availableOntologies.getFilteredItems().size() + "</b> ontologies</html>");

    // need to get ontologies available from bioportal and add them here.
    JScrollPane availableOntologiesScroller = new JScrollPane(availableOntologies,
            JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    availableOntologiesScroller.getViewport().setBackground(UIHelper.BG_COLOR);
    availableOntologiesScroller.setPreferredSize(new Dimension(200, 125));
    availableOntologiesScroller.setBorder(new EmptyBorder(0, 0, 0, 0));

    IAppWidgetFactory.makeIAppScrollPane(availableOntologiesScroller);

    availableOntologiesListContainer.add(availableOntologiesScroller);
    availableOntologiesListContainer.add(availableOntologies.getFilterField(), BorderLayout.NORTH);

    westPanel.add(selectedOntologiesContainer, BorderLayout.CENTER);
    westPanel.add(availableOntologiesListContainer, BorderLayout.SOUTH);

    add(westPanel, BorderLayout.WEST);
}

From source file:org.jajuk.ui.views.ArtistView.java

@Override
public void shortCall(Object in) {
    removeAll();//from  w  w w .  j a  v a2s  .c o m
    jspAlbums = getLastFMSuggestionsPanel(SuggestionType.OTHERS_ALBUMS, true);
    // Artist unknown from last.fm, leave
    if (artistInfo == null
            // If image url is void, last.fm doesn't provide enough data about this
            // artist, we reset the view
            || StringUtils.isBlank(artistInfo.getImageUrl())) {
        reset();
        return;
    }
    artistThumb = new LastFmArtistThumbnail(artistInfo);
    // No known icon next to artist thumb
    artistThumb.setArtistView(true);
    artistThumb.populate();
    jtaArtistDesc = new JTextArea(bio) {
        private static final long serialVersionUID = 9217998016482118852L;

        // We set the margin this way, setMargin() doesn't work due to
        // existing border
        @Override
        public Insets getInsets() {
            return new Insets(2, 4, 0, 4);
        }
    };
    jtaArtistDesc.setBorder(null);
    jtaArtistDesc.setEditable(false);
    jtaArtistDesc.setLineWrap(true);
    jtaArtistDesc.setWrapStyleWord(true);
    jtaArtistDesc.setOpaque(false);
    JScrollPane jspWiki = new JScrollPane(jtaArtistDesc);
    jspWiki.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jspWiki.setBorder(null);
    jspWiki.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
    // Add items, layout is different according wiki text availability
    if (StringUtils.isNotBlank(jtaArtistDesc.getText())) {
        setLayout(new MigLayout("ins 5,gapy 5", "[grow]", "[grow][20%!][grow]"));
        add(artistThumb, "center,wrap");
        // don't add the textarea if no wiki text available
        add(jspWiki, "growx,wrap");
        add(jspAlbums, "grow,wrap");
    } else {
        setLayout(new MigLayout("ins 5,gapy 5", "[grow]"));
        add(artistThumb, "center,wrap");
        // don't add the textarea if no wiki text available
        add(jspAlbums, "grow,wrap");
    }
    revalidate();
    repaint();
}

From source file:org.jajuk.ui.views.SuggestionView.java

/**
 * Return the result panel for local albums.
 *
 * @param type /*from  w ww .j a va2  s .  c  o m*/
 *
 * @return the local suggestions panel
 */
JScrollPane getLocalSuggestionsPanel(SuggestionType type) {
    FlowScrollPanel out = new FlowScrollPanel();
    out.setLayout(new FlowLayout(FlowLayout.LEFT));
    JScrollPane jsp = new JScrollPane(out, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBorder(null);
    out.setScroller(jsp);
    List<Album> albums = null;
    if (type == SuggestionType.BEST_OF) {
        albums = albumsPrefered;
    } else if (type == SuggestionType.NEWEST) {
        albums = albumsNewest;
    } else if (type == SuggestionType.RARE) {
        albums = albumsRare;
    }
    if (albums != null && albums.size() > 0) {
        for (Album album : albums) {
            LocalAlbumThumbnail thumb = new LocalAlbumThumbnail(album, 100, false);
            thumb.populate();
            thumb.getIcon().addMouseListener(new ThumbMouseListener());
            out.add(thumb);
        }
    } else {
        out.add(UtilGUI.getCentredPanel(new JLabel(Messages.getString("WikipediaView.3"))));
    }
    return jsp;
}

From source file:org.jajuk.ui.views.SuggestionView.java

/**
 * Return the result panel for lastFM information.
 *
 * @param type /*from   ww w.  j ava 2s  . com*/
 * @param artistView 
 *
 * @return the last fm suggestions panel
 */
JScrollPane getLastFMSuggestionsPanel(SuggestionType type, boolean artistView) {
    FlowScrollPanel flowPanel = new FlowScrollPanel();
    JScrollPane jsp = new JScrollPane(flowPanel, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
    jsp.setBorder(null);
    flowPanel.setScroller(jsp);
    flowPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
    if (type == SuggestionType.OTHERS_ALBUMS) {
        if (albums != null && albums.getAlbums().size() > 0) {
            for (AlbumInfo album : albums.getAlbums()) {
                AbstractThumbnail thumb = new LastFmAlbumThumbnail(album);
                thumb.setArtistView(artistView);
                thumb.populate();
                if (thumb.getIcon() != null) {
                    thumb.getIcon().addMouseListener(new ThumbMouseListener());
                    flowPanel.add(thumb);
                }
            }
        }
        // No result found
        else {
            return new JScrollPane(getNothingFoundPanel());
        }
    } else if (type == SuggestionType.SIMILAR_ARTISTS) {
        if (similar != null) {
            List<ArtistInfo> artists = similar.getArtists();
            for (ArtistInfo similarArtist : artists) {
                AbstractThumbnail thumb = new LastFmArtistThumbnail(similarArtist);
                thumb.setArtistView(artistView);
                thumb.populate();
                if (thumb.getIcon() != null) {
                    thumb.getIcon().addMouseListener(new ThumbMouseListener());
                    flowPanel.add(thumb);
                }
            }
        }
        // No result found
        else {
            return new JScrollPane(getNothingFoundPanel());
        }
    }
    return jsp;
}

From source file:org.jimcat.gui.perspective.detail.DetailSideBar.java

/**
 * creates image Detail - Section/*from  w w w . ja  v a2 s .co m*/
 * 
 * @return the Component used to show details
 */
private JComponent createImageDetail() {
    JLabel tmp = null;

    // Task Panel
    JXTaskPaneContainer container = new JXTaskPaneContainer();
    container.setOpaque(false);

    // General Infos
    JXTaskPane general = new JXTaskPane();
    general.setOpaque(true);
    general.setTitle("General Info");
    general.setExpanded(true);

    // General info list
    JPanel info = new JPanel();
    GridLayout infoLayout = new GridLayout(0, 2);
    infoLayout.setHgap(5);
    info.setLayout(infoLayout);
    info.setOpaque(false);

    tmp = new JLabel("Title");
    tmp.setFont(labelFont);
    info.add(tmp);
    info.add(title);

    tmp = new JLabel("Rating");
    tmp.setFont(labelFont);
    info.add(tmp);
    rating = new RatingEditor();
    info.add(rating);

    tmp = new JLabel("Dimension");
    tmp.setFont(labelFont);
    info.add(tmp);
    dimension = new JLabel("");
    info.add(dimension);

    tmp = new JLabel("Size");
    tmp.setFont(labelFont);
    info.add(tmp);
    size = new JLabel("");
    info.add(size);

    tmp = new JLabel("Location");
    tmp.setFont(labelFont);
    info.add(tmp);
    path = new JLabel("");
    path.setToolTipText("");
    info.add(path);

    general.add(info);
    container.add(general);

    // Exif data
    JXTaskPane exifs = new JXTaskPane();
    exifs.setOpaque(true);
    exifs.setTitle("Exif Infos");
    exifs.setExpanded(true);
    exifList = new ExifList();
    exifs.add(exifList);
    container.add(exifs);

    // Tags
    JXTaskPane tags = new JXTaskPane();
    tags.setOpaque(true);
    tags.setTitle("Associated Tags");
    tags.setExpanded(true);

    // associated tags-list
    detailTagList = new DetailTagList();
    tags.add(detailTagList);
    container.add(tags);

    // Modify Tags
    JXTaskPane filter = new JXTaskPane();
    filter.setTitle("Modify Tags");
    filter.setExpanded(false);
    filter.setOpaque(true);

    tagTree = new TagTree();
    tagTree.addTagTreeListener(this);

    filter.setLayout(new BorderLayout());
    filter.addMouseListener(new TagPanelPopupHandler(filter));
    filter.add(tagTree, BorderLayout.CENTER);
    container.add(filter);

    JScrollPane pane = new JScrollPane();
    pane.setOpaque(true);
    pane.setBorder(null);
    pane.setViewportView(container);
    pane.putClientProperty(SubstanceLookAndFeel.WATERMARK_TO_BLEED, Boolean.TRUE);
    return pane;
}

From source file:org.languagetool.gui.Tools.java

static void showRuleInfoDialog(Component parent, String title, String message, Rule rule, URL matchUrl,
        ResourceBundle messages, String lang) {
    int dialogWidth = 320;
    JTextPane textPane = new JTextPane();
    textPane.setEditable(false);// w  w  w  .j ava2 s .c  o m
    textPane.setContentType("text/html");
    textPane.setBorder(BorderFactory.createEmptyBorder());
    textPane.setOpaque(false);
    textPane.setBackground(new Color(0, 0, 0, 0));
    Tools.addHyperlinkListener(textPane);
    textPane.setSize(dialogWidth, Short.MAX_VALUE);
    String messageWithBold = message.replaceAll("<suggestion>", "<b>").replaceAll("</suggestion>", "</b>");
    String exampleSentences = getExampleSentences(rule, messages);
    String url = "http://community.languagetool.org/rule/show/" + encodeUrl(rule) + "?lang=" + lang
            + "&amp;ref=standalone-gui";
    boolean isExternal = rule.getCategory().getLocation() == Category.Location.EXTERNAL;
    String ruleDetailLink = rule instanceof FalseFriendPatternRule || isExternal ? ""
            : "<a href='" + url + "'>" + messages.getString("ruleDetailsLink") + "</a>";
    textPane.setText("<html>" + messageWithBold + exampleSentences + formatURL(matchUrl) + "<br><br>"
            + ruleDetailLink + "</html>");
    JScrollPane scrollPane = new JScrollPane(textPane);
    scrollPane.setPreferredSize(new Dimension(dialogWidth, textPane.getPreferredSize().height));
    scrollPane.setBorder(BorderFactory.createEmptyBorder());

    String cleanTitle = title.replace("<suggestion>", "'").replace("</suggestion>", "'");
    JOptionPane.showMessageDialog(parent, scrollPane, cleanTitle, JOptionPane.INFORMATION_MESSAGE);
}

From source file:org.lnicholls.galleon.gui.MainFrame.java

public static JScrollPane createScrollPane(Component component) {

    JScrollPane scrollPane = new JScrollPane(component);

    scrollPane.setBorder(BorderFactory.createEmptyBorder());

    return scrollPane;

}

From source file:org.monkeys.gui.matcher.MatcherPanel.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*w w  w  .j  av a 2 s.  c  om*/
 */
@SuppressWarnings("unchecked")

// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    javax.swing.JSplitPane splitPane = new javax.swing.JSplitPane();
    textPanel = new javax.swing.JPanel();
    textHeader = new org.monkeys.gui.HeaderLabel();
    javax.swing.JScrollPane textScroll = new javax.swing.JScrollPane();
    textArea = new javax.swing.JTextArea();
    editPanel = new javax.swing.JPanel();
    clearButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator2 = new javax.swing.JSeparator();
    editButton = new javax.swing.JToggleButton();
    matchingPanel = new javax.swing.JPanel();
    org.monkeys.gui.HeaderLabel matchingHeader = new org.monkeys.gui.HeaderLabel();
    matchingScroll = new javax.swing.JScrollPane();
    matchingList = new org.monkeys.gui.matcher.MatcherTable();
    org.monkeys.gui.HeaderLabel categoryLabel = new org.monkeys.gui.HeaderLabel();
    categoryDropdown = new org.monkeys.gui.CategoryDropdown();
    clipboardButton = new javax.swing.JToggleButton();
    selectButton = new javax.swing.JToggleButton();
    removeDuplicateButton = new javax.swing.JButton();
    removeRowButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator3 = new javax.swing.JSeparator();
    javax.swing.JSeparator jSeparator4 = new javax.swing.JSeparator();
    javax.swing.JSeparator jSeparator5 = new javax.swing.JSeparator();
    modifyButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator6 = new javax.swing.JSeparator();
    undoButton = new javax.swing.JButton();
    javax.swing.JSeparator jSeparator7 = new javax.swing.JSeparator();
    clipboardDropdown = new javax.swing.JComboBox();

    splitPane.setBorder(null);
    splitPane.setDividerSize(8);
    splitPane.setResizeWeight(0.6);

    textHeader.setText("Text");

    textScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));
    textScroll.setMinimumSize(new java.awt.Dimension(200, 50));
    textScroll.setPreferredSize(new java.awt.Dimension(300, 150));

    textArea.setTabSize(4);
    textArea.setAutoscrolls(false);
    textScroll.setViewportView(textArea);

    clearButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/clear-20.png"))); // NOI18N
    clearButton.setText("Clear");
    clearButton.setToolTipText("Clear All Fields");
    clearButton.setBorderPainted(false);
    clearButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clearButtonActionPerformed(evt);
        }
    });

    jSeparator2.setOrientation(javax.swing.SwingConstants.VERTICAL);

    editButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/lock-18.png"))); // NOI18N
    editButton.setSelected(true);
    editButton.setText("Edit");
    editButton.setToolTipText("Edit Text");
    editButton.setBorderPainted(false);
    editButton.setDisabledIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/lock-18.png"))); // NOI18N
    editButton.setIconTextGap(3);
    editButton.setSelectedIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/unlock-18.png"))); // NOI18N
    editButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            editButtonActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout editPanelLayout = new javax.swing.GroupLayout(editPanel);
    editPanel.setLayout(editPanelLayout);
    editPanelLayout.setHorizontalGroup(editPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editPanelLayout.createSequentialGroup().addComponent(editButton).addGap(0, 0, 0)
                    .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0).addComponent(clearButton).addGap(0, 89, Short.MAX_VALUE)));

    editPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { clearButton, editButton });

    editPanelLayout.setVerticalGroup(editPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(editPanelLayout.createSequentialGroup().addGap(0, 0, 0)
                    .addGroup(editPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator2)
                            .addComponent(editButton, javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clearButton, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGap(0, 0, 0)));

    editPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clearButton, editButton });

    javax.swing.GroupLayout textPanelLayout = new javax.swing.GroupLayout(textPanel);
    textPanel.setLayout(textPanelLayout);
    textPanelLayout.setHorizontalGroup(textPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(textPanelLayout.createSequentialGroup()
                    .addComponent(editPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, Short.MAX_VALUE))
            .addGroup(textPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(textPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(textScroll, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(textHeader, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));
    textPanelLayout.setVerticalGroup(textPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(textPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(textHeader, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(editPanel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(textScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
                    .addContainerGap()));

    splitPane.setLeftComponent(textPanel);

    matchingHeader.setText("Matches");

    matchingScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray));
    matchingScroll.setMinimumSize(new java.awt.Dimension(200, 120));
    matchingScroll.setPreferredSize(new java.awt.Dimension(480, 300));
    matchingScroll.setViewportView(matchingList);

    categoryLabel.setText("Category");

    clipboardButton.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/clipboard-16.png"))); // NOI18N
    clipboardButton.setToolTipText("Copy Selected To Clipboard");
    clipboardButton.setBorderPainted(false);
    clipboardButton.setEnabled(false);
    clipboardButton.setIconTextGap(2);
    clipboardButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            clipboardButtonActionPerformed(evt);
        }
    });

    selectButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/list-16.png"))); // NOI18N
    selectButton.setToolTipText("Select / Unselect All");
    selectButton.setBorderPainted(false);
    selectButton.setEnabled(false);
    selectButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            selectButtonActionPerformed(evt);
        }
    });

    removeDuplicateButton.setIcon(new javax.swing.ImageIcon(
            getClass().getResource("/org/monkeys/gui/icons/remove-duplicates-16.png"))); // NOI18N
    removeDuplicateButton.setToolTipText("Remove Duplicates");
    removeDuplicateButton.setBorderPainted(false);
    removeDuplicateButton.setEnabled(false);
    removeDuplicateButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeDuplicateButtonActionPerformed(evt);
        }
    });

    removeRowButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/remove-16.png"))); // NOI18N
    removeRowButton.setToolTipText("Remove Selected");
    removeRowButton.setBorderPainted(false);
    removeRowButton.setEnabled(false);
    removeRowButton.setIconTextGap(2);
    removeRowButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            removeRowButtonActionPerformed(evt);
        }
    });

    jSeparator3.setOrientation(javax.swing.SwingConstants.VERTICAL);

    jSeparator4.setOrientation(javax.swing.SwingConstants.VERTICAL);

    jSeparator5.setOrientation(javax.swing.SwingConstants.VERTICAL);

    modifyButton
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/edit-16.png"))); // NOI18N
    modifyButton.setToolTipText("Edit Selected");
    modifyButton.setBorderPainted(false);
    modifyButton.setEnabled(false);
    modifyButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            modifyButtonActionPerformed(evt);
        }
    });

    jSeparator6.setOrientation(javax.swing.SwingConstants.VERTICAL);

    undoButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/monkeys/gui/icons/undo-16.png"))); // NOI18N
    undoButton.setBorderPainted(false);
    undoButton.setEnabled(false);
    undoButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            undoButtonActionPerformed(evt);
        }
    });

    jSeparator7.setOrientation(javax.swing.SwingConstants.VERTICAL);

    clipboardDropdown.setEditable(true);
    clipboardDropdown.setModel(
            new javax.swing.DefaultComboBoxModel(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
    clipboardDropdown.setEnabled(false);

    javax.swing.GroupLayout matchingPanelLayout = new javax.swing.GroupLayout(matchingPanel);
    matchingPanel.setLayout(matchingPanelLayout);
    matchingPanelLayout.setHorizontalGroup(matchingPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(matchingPanelLayout.createSequentialGroup().addContainerGap()
                    .addGroup(matchingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(matchingPanelLayout.createSequentialGroup().addComponent(selectButton)
                                    .addGap(0, 0, 0)
                                    .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(removeDuplicateButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator3, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(removeRowButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator4, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(modifyButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator6, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(undoButton).addGap(0, 0, 0)
                                    .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 12,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0)
                                    .addComponent(clipboardDropdown, javax.swing.GroupLayout.PREFERRED_SIZE,
                                            javax.swing.GroupLayout.DEFAULT_SIZE,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, 0).addComponent(clipboardButton)
                                    .addGap(0, 0, Short.MAX_VALUE))
                            .addComponent(matchingScroll, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                            .addComponent(categoryLabel, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(categoryDropdown, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addComponent(matchingHeader, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap()));

    matchingPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
            new java.awt.Component[] { clipboardButton, modifyButton, removeRowButton });

    matchingPanelLayout.setVerticalGroup(matchingPanelLayout
            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(matchingPanelLayout.createSequentialGroup().addContainerGap()
                    .addComponent(categoryLabel, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(0, 0, 0)
                    .addComponent(categoryDropdown, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(matchingHeader, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(matchingPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(matchingPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(removeDuplicateButton).addComponent(jSeparator4,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
                                                    false)
                                            .addComponent(selectButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
                                            .addComponent(jSeparator3,
                                                    javax.swing.GroupLayout.Alignment.LEADING)
                                            .addComponent(removeRowButton,
                                                    javax.swing.GroupLayout.Alignment.LEADING,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                            .addComponent(jSeparator5, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    28, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(modifyButton)
                            .addGroup(matchingPanelLayout
                                    .createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(clipboardButton, javax.swing.GroupLayout.Alignment.TRAILING,
                                            javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                            javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGroup(matchingPanelLayout
                                            .createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(undoButton).addComponent(jSeparator6,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE, 28,
                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(clipboardDropdown, javax.swing.GroupLayout.Alignment.TRAILING,
                                    javax.swing.GroupLayout.PREFERRED_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(matchingScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 275, Short.MAX_VALUE)
                    .addContainerGap()));

    matchingPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL,
            new java.awt.Component[] { clipboardButton, clipboardDropdown });

    splitPane.setRightComponent(matchingPanel);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addComponent(splitPane, javax.swing.GroupLayout.DEFAULT_SIZE, 664, Short.MAX_VALUE)
                    .addGap(0, 0, 0)));
    layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addComponent(splitPane));
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private void initUI() {
    setMinimumSize(new Dimension(550, 160));
    setLayout(new BorderLayout());
    setOpaque(true);/*from w  w w  . j  ava2  s. c om*/
    setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);

    JPanel mainPanel = new JPanel();
    mainPanel.setOpaque(false);

    String[] keys = new String[] { "fontChooser.fontName", "fontChooser.fontStyle", "fontChooser.fontSize",
            "showPreferencesPanel.ticker.exchange", "showPreferencesPanel.ticker.currency",
            "showPreferencesPanel.lookAndFeel", "showPreferencesPanel.oerLabel.text" };
    int stentWidth = MultiBitTitledPanel.calculateStentWidthForKeys(controller.getLocaliser(), keys, this)
            + STENT_DELTA;

    GridBagConstraints constraints = new GridBagConstraints();
    mainPanel.setLayout(new GridBagLayout());

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    // Disable language selection, uncomment to enable
    //        mainPanel.add(createLanguagePanel(stentWidth), constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createAppearancePanel(stentWidth), constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createMessagingServerPanel(stentWidth), constraints);

    /*
         constraints.fill = GridBagConstraints.HORIZONTAL;
         constraints.gridx = 0;
         constraints.gridy = 3;
         constraints.gridwidth = 2;
         constraints.weightx = 1;
         constraints.weighty = 1.6;
         constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
         mainPanel.add(createTickerPanel(stentWidth), constraints);
    */
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 4;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createBrowserIntegrationPanel(stentWidth), constraints);

    JLabel filler1 = new JLabel();
    filler1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;
    constraints.gridy = 5;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 100;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(filler1, constraints);

    JScrollPane mainScrollPane = new JScrollPane(mainPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    mainScrollPane.setBorder(BorderFactory.createEmptyBorder());
    mainScrollPane.getViewport().setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);
    mainScrollPane.getViewport().setOpaque(true);
    mainScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);
    mainScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);

    add(mainScrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = createButtonPanel();
    buttonPanel.setMinimumSize(new Dimension(60, 60));
    add(buttonPanel, BorderLayout.SOUTH);
}