Example usage for javax.swing JPopupMenu setBorder

List of usage examples for javax.swing JPopupMenu setBorder

Introduction

In this page you can find the example usage for javax.swing JPopupMenu 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.eobjects.datacleaner.panels.WelcomePanel.java

private DCPanel createNewDatastorePanel() {
    final DCPanel panel = new DCPanel();
    panel.setBorder(WidgetUtils.BORDER_LIST_ITEM);
    panel.setLayout(new FlowLayout(FlowLayout.LEFT, 10, 10));
    panel.add(createNewDatastoreButton("CSV file",
            "Comma-separated values (CSV) file (or file with other separators)", IconUtils.CSV_IMAGEPATH,
            CsvDatastore.class, CsvDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Excel spreadsheet",
            "Microsoft Excel spreadsheet. Either .xls (97-2003) or .xlsx (2007+) format.",
            IconUtils.EXCEL_IMAGEPATH, ExcelDatastore.class, ExcelDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Access database", "Microsoft Access database file (.mdb).",
            IconUtils.ACCESS_IMAGEPATH, AccessDatastore.class, AccessDatastoreDialog.class));
    panel.add(createNewDatastoreButton("SAS library", "A directory of SAS library files (.sas7bdat).",
            IconUtils.SAS_IMAGEPATH, SasDatastore.class, SasDatastoreDialog.class));
    panel.add(createNewDatastoreButton("DBase database", "DBase database file (.dbf)",
            IconUtils.DBASE_IMAGEPATH, DbaseDatastore.class, DbaseDatastoreDialog.class));
    panel.add(createNewDatastoreButton("Fixed width file",
            "Text file with fixed width values. Each value spans a fixed amount of text characters.",
            IconUtils.FIXEDWIDTH_IMAGEPATH, FixedWidthDatastore.class, FixedWidthDatastoreDialog.class));
    panel.add(createNewDatastoreButton("XML file", "Extensible Markup Language file (.xml)",
            IconUtils.XML_IMAGEPATH, XmlDatastore.class, XmlDatastoreDialog.class));
    panel.add(createNewDatastoreButton("JSON file", "JavaScript Object NOtation file (.json).",
            IconUtils.JSON_IMAGEPATH, JsonDatastore.class, JsonDatastoreDialog.class));
    panel.add(/*  www. j  a  v  a2s  . com*/
            createNewDatastoreButton("OpenOffice.org Base database", "OpenOffice.org Base database file (.odb)",
                    IconUtils.ODB_IMAGEPATH, OdbDatastore.class, OdbDatastoreDialog.class));

    panel.add(Box.createHorizontalStrut(10));

    panel.add(createNewDatastoreButton("Salesforce.com", "Connect to a Salesforce.com account",
            IconUtils.SALESFORCE_IMAGEPATH, SalesforceDatastore.class, SalesforceDatastoreDialog.class));
    panel.add(createNewDatastoreButton("SugarCRM", "Connect to a SugarCRM system",
            IconUtils.SUGAR_CRM_IMAGEPATH, SugarCrmDatastore.class, SugarCrmDatastoreDialog.class));

    panel.add(Box.createHorizontalStrut(10));

    panel.add(createNewDatastoreButton("MongoDB database", "Connect to a MongoDB database",
            IconUtils.MONGODB_IMAGEPATH, MongoDbDatastore.class, MongoDbDatastoreDialog.class));

    panel.add(createNewDatastoreButton("CouchDB database", "Connect to an Apache CouchDB database",
            IconUtils.COUCHDB_IMAGEPATH, CouchDbDatastore.class, CouchDbDatastoreDialog.class));

    panel.add(createNewDatastoreButton("HBase database", "Connect to an Apache HBase database",
            IconUtils.HBASE_IMAGEPATH, HBaseDatastore.class, HBaseDatastoreDialog.class));

    // set of databases that are displayed directly on panel
    final Set<String> databaseNames = new HashSet<String>();

    createDefaultDatabaseButtons(panel, databaseNames);

    final JButton moreDatastoreTypesButton = new JButton("More",
            imageManager.getImageIcon(IconUtils.FILE_FOLDER, IconUtils.ICON_SIZE_SMALL));
    moreDatastoreTypesButton.setMargin(new Insets(1, 1, 1, 4));
    moreDatastoreTypesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final JPopupMenu popup = new JPopupMenu();

            // installed databases
            final List<DatabaseDriverDescriptor> databaseDrivers = _databaseDriverCatalog
                    .getInstalledWorkingDatabaseDrivers();
            for (DatabaseDriverDescriptor databaseDriver : databaseDrivers) {
                final String databaseName = databaseDriver.getDisplayName();
                if (!databaseNames.contains(databaseName)) {
                    final String imagePath = databaseDriver.getIconImagePath();
                    final ImageIcon icon = imageManager.getImageIcon(imagePath, IconUtils.ICON_SIZE_SMALL);
                    final JMenuItem menuItem = WidgetFactory.createMenuItem(databaseName, icon);
                    menuItem.addActionListener(createJdbcActionListener(databaseName));
                    popup.add(menuItem);
                }
            }

            // custom/other jdbc connection
            {
                final ImageIcon icon = imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH,
                        IconUtils.ICON_SIZE_SMALL);
                final JMenuItem menuItem = WidgetFactory.createMenuItem("Other database", icon);
                menuItem.addActionListener(createJdbcActionListener(null));
                popup.add(menuItem);
            }

            // composite datastore
            final JMenuItem compositeMenuItem = WidgetFactory.createMenuItem("Composite datastore",
                    imageManager.getImageIcon(IconUtils.COMPOSITE_IMAGEPATH, IconUtils.ICON_SIZE_SMALL));
            compositeMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    new CompositeDatastoreDialog(_datastoreCatalog,
                            _analysisJobBuilderWindow.getWindowContext()).setVisible(true);
                }
            });

            final JMenuItem databaseDriversMenuItem = WidgetFactory.createMenuItem("Manage database drivers...",
                    imageManager.getImageIcon(IconUtils.MENU_OPTIONS, IconUtils.ICON_SIZE_SMALL));
            databaseDriversMenuItem.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    OptionsDialog dialog = _optionsDialogProvider.get();
                    dialog.selectDatabaseDriversTab();
                    dialog.setVisible(true);
                }
            });

            popup.add(databaseDriversMenuItem);
            popup.add(new JSeparator(JSeparator.HORIZONTAL));
            popup.add(compositeMenuItem);
            popup.setBorder(WidgetUtils.BORDER_THIN);

            popup.show(moreDatastoreTypesButton, 0, moreDatastoreTypesButton.getHeight());
        }
    });

    panel.add(Box.createHorizontalStrut(10));
    panel.add(moreDatastoreTypesButton);

    return panel;
}

From source file:org.esa.nest.dat.views.polarview.PolarView.java

@Override
public JPopupMenu createPopupMenu(MouseEvent event) {
    final JPopupMenu popup = new JPopupMenu();

    final JMenuItem itemNext = createMenuItem("Next");
    popup.add(itemNext);/*w  ww. j a  v  a2  s  . c  o m*/
    itemNext.setEnabled(currentRecord < numRecords);

    final JMenuItem itemPrev = createMenuItem("Previous");
    popup.add(itemPrev);
    itemPrev.setEnabled(currentRecord > 0);

    final JMenuItem itemColourScale = createMenuItem("Colour Scale");
    popup.add(itemColourScale);

    final JMenu unitMenu = new JMenu("Unit");
    popup.add(unitMenu);

    if (waveProductType == WaveProductType.WAVE_SPECTRA) {
        createCheckedMenuItem(unitTypes[Unit.AMPLITUDE.ordinal()], unitMenu, graphUnit == Unit.AMPLITUDE);
        createCheckedMenuItem(unitTypes[Unit.INTENSITY.ordinal()], unitMenu, graphUnit == Unit.INTENSITY);
    } else {
        createCheckedMenuItem(unitTypes[Unit.REAL.ordinal()], unitMenu, graphUnit == Unit.REAL);
        createCheckedMenuItem(unitTypes[Unit.IMAGINARY.ordinal()], unitMenu, graphUnit == Unit.IMAGINARY);
        createCheckedMenuItem(unitTypes[Unit.AMPLITUDE.ordinal()], unitMenu, graphUnit == Unit.AMPLITUDE);
        createCheckedMenuItem(unitTypes[Unit.INTENSITY.ordinal()], unitMenu, graphUnit == Unit.INTENSITY);
    }

    final JMenuItem itemExportReadout = createMenuItem("Export Readouts");
    popup.add(itemExportReadout);

    popup.setLabel("Justification");
    popup.setBorder(new BevelBorder(BevelBorder.RAISED));
    popup.addPopupMenuListener(this);
    popup.show(this, event.getX(), event.getY());

    return popup;
}

From source file:org.esa.snap.graphbuilder.rcp.dialogs.support.GraphPanel.java

private void checkPopup(MouseEvent e) {
    if (e.isPopupTrigger()) {

        final JPopupMenu popup = new JPopupMenu();
        popup.add(addMenu);/*from ww w  .j  a va 2  s  .c  om*/

        if (selectedNode != null) {
            final JMenuItem item = new JMenuItem("Delete");
            popup.add(item);
            item.setHorizontalTextPosition(JMenuItem.RIGHT);
            item.addActionListener(this);

            final NodeSource[] sources = selectedNode.getNode().getSources();
            if (sources.length > 0) {
                final JMenu removeSourcedMenu = new JMenu("Remove Source");
                for (NodeSource ns : sources) {
                    final JMenuItem nsItem = new JMenuItem(ns.getSourceNodeId());
                    removeSourcedMenu.add(nsItem);
                    nsItem.setHorizontalTextPosition(JMenuItem.RIGHT);
                    nsItem.addActionListener(removeSourceListener);
                }
                popup.add(removeSourcedMenu);
            }
        }

        if (!graphEx.getGraphNodeList().isGraphComplete()) {
            final JMenuItem connectItem = new JMenuItem("Connect Graph", null);
            connectItem.setHorizontalTextPosition(JMenuItem.RIGHT);
            connectItem.addActionListener(connectListener);
            popup.add(connectItem);
        }

        popup.setLabel("Justification");
        popup.setBorder(new BevelBorder(BevelBorder.RAISED));
        popup.addPopupMenuListener(this);
        popup.show(this, e.getX(), e.getY());
        showRightClickHelp = false;
    }
}