Example usage for javax.swing JButton getHeight

List of usage examples for javax.swing JButton getHeight

Introduction

In this page you can find the example usage for javax.swing JButton getHeight.

Prototype

@BeanProperty(bound = false)
public int getHeight() 

Source Link

Document

Returns the current height 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(/*w  ww. java 2 s .co m*/
            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.eurocarbdb.application.glycoworkbench.plugin.s3.Cockpit.java

/**
 * Initialises the application's GUI elements.
 *///from w ww .  j ava  2  s .  c o m
private void initGui() {
    initMenus();

    JPanel appContent = new JPanel(new GridBagLayout());
    this.getContentPane().add(appContent);

    // Buckets panel.
    JPanel bucketsPanel = new JPanel(new GridBagLayout());

    JButton bucketActionButton = new JButton();
    bucketActionButton.setToolTipText("Bucket actions menu");
    guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png");
    bucketActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1,
            0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    bucketTableModel = new BucketTableModel(false);
    bucketTableModelSorter = new TableSorter(bucketTableModel);
    bucketsTable = new JTable(bucketTableModelSorter);
    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());
    bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bucketsTable.getSelectionModel().addListSelectionListener(this);
    bucketsTable.setShowHorizontalLines(true);
    bucketsTable.setShowVerticalLines(false);
    bucketsTable.addMouseListener(new ContextMenuListener());
    bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = new JPanel(new GridBagLayout());
    filterObjectsPrefix = new JTextField();
    filterObjectsPrefix.setToolTipText("Only show objects with this prefix");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" });
    filterObjectsDelimiter.setEditable(true);
    filterObjectsDelimiter.setToolTipText("Object name delimiter");
    filterObjectsDelimiter.addActionListener(this);
    filterObjectsDelimiter.setActionCommand("RefreshObjects");
    filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    JPanel objectsPanel = new JPanel(new GridBagLayout());
    int row = 0;
    filterObjectsCheckBox = new JCheckBox("Filter objects");
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed");
    objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1,
            1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = new JButton();
    objectActionButton.setToolTipText("Object actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = new JTable();
    objectTableModel = new ObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 301092191828910402L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7285511556343895652L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = new JScrollPane(objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Combine sections.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    splitPane.setResizeWeight(0.30);

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsTableSP, objectsTable });
    objectsTable.getDropTarget().setActive(false);
    objectsTableSP.getDropTarget().setActive(false);
}

From source file:org.jets3t.apps.cockpitlite.CockpitLite.java

/**
 * Initialises the application's GUI elements.
 *//*from w  ww  .ja  v  a 2  s .  c o  m*/
private void initGui() {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(cockpitLiteProperties.getProperties());

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    // Primary panel that contains all other items.
    JPanel primaryPanel = skinsFactory.createSkinnedJPanel("PrimaryPanel");
    primaryPanel.setLayout(new GridBagLayout());
    this.getContentPane().add(primaryPanel);

    // Setup the stack panel, which contains all other panels as a stack.
    stackPanel = skinsFactory.createSkinnedJPanel("StackPanel");
    stackPanelCardLayout = new CardLayout();
    stackPanel.setLayout(stackPanelCardLayout);
    primaryPanel.add(stackPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));

    // Progress notification panel
    progressNotificationPanel = skinsFactory.createSkinnedJPanel("ProgressNotificationPanel");
    progressNotificationPanel.setLayout(new GridBagLayout());
    primaryPanel.add(progressNotificationPanel, new GridBagConstraints(0, 1, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0, 5, 0), 0, 0));

    int row = 0;

    // Login panel.
    row = 0;
    loginPanel = skinsFactory.createSkinnedJPanel("LoginPanel");
    loginPanel.setLayout(new GridBagLayout());

    userInputFields = new UserInputFields(insetsDefault, null, skinsFactory);
    userInputFields.buildFieldsPanel(loginPanel, cockpitLiteProperties);

    loginButton = skinsFactory.createSkinnedJButton("LoginButton");
    loginButton.setText("Log me in");
    loginButton.addActionListener(this);
    loginPanel.add(loginButton, new GridBagConstraints(0, loginPanel.getComponentCount(), 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = skinsFactory.createSkinnedJPanel("FilterPanel");
    filterObjectsPanel.setLayout(new GridBagLayout());
    filterObjectsPrefix = skinsFactory.createSkinnedJTextField("FilterPrefix");
    filterObjectsPrefix.setToolTipText("Only show files starting with this string");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    JLabel filterPrefixLabel = skinsFactory.createSkinnedJHtmlLabel("FilterPrefixLable", this);
    filterPrefixLabel.setText("File name starts with: ");
    filterObjectsPanel.add(filterPrefixLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    row = 0;
    JPanel objectsPanel = skinsFactory.createSkinnedJPanel("ObjectsPanel");
    objectsPanel.setLayout(new GridBagLayout());
    filterObjectsCheckBox = skinsFactory.createSkinnedJCheckBox("FilterCheckbox");
    filterObjectsCheckBox.setText("Search files");
    filterObjectsCheckBox.setEnabled(true);
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to search your files");
    objectsHeadingLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectsHeadingLabel", this);
    objectsHeadingLabel.setText("Not logged in");
    objectsPanel.add(objectsHeadingLabel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = skinsFactory.createSkinnedJButton("ObjectMenuButton");
    objectActionButton.setToolTipText("File actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = skinsFactory.createSkinnedJTable("ObjectsTable");
    objectTableModel = new CLObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7229656175879985698L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = -4983176028291916397L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = skinsFactory.createSkinnedJScrollPane("ObjectsTableSP", objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectsSummary", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Object action menu.
    objectActionMenu = skinsFactory.createSkinnedJPopupMenu("ObjectPopupMenu");

    refreshObjectMenuItem = skinsFactory.createSkinnedJMenuItem("RefreshMenuItem");
    refreshObjectMenuItem.setText("Refresh file listing");
    refreshObjectMenuItem.setActionCommand("RefreshObjects");
    refreshObjectMenuItem.addActionListener(this);
    guiUtils.applyIcon(refreshObjectMenuItem, "/images/nuvola/16x16/actions/reload.png");
    objectActionMenu.add(refreshObjectMenuItem);

    viewObjectPropertiesMenuItem = skinsFactory.createSkinnedJMenuItem("PropertiesMenuItem");
    viewObjectPropertiesMenuItem.setText("View file properties...");
    viewObjectPropertiesMenuItem.setActionCommand("ViewObjectProperties");
    viewObjectPropertiesMenuItem.addActionListener(this);
    guiUtils.applyIcon(viewObjectPropertiesMenuItem, "/images/nuvola/16x16/actions/viewmag.png");
    objectActionMenu.add(viewObjectPropertiesMenuItem);

    downloadObjectMenuItem = skinsFactory.createSkinnedJMenuItem("DownloadMenuItem");
    downloadObjectMenuItem.setText("Download file(s)...");
    downloadObjectMenuItem.setActionCommand("DownloadObjects");
    downloadObjectMenuItem.addActionListener(this);
    guiUtils.applyIcon(downloadObjectMenuItem, "/images/nuvola/16x16/actions/1downarrow.png");
    objectActionMenu.add(downloadObjectMenuItem);

    uploadFilesMenuItem = skinsFactory.createSkinnedJMenuItem("UploadMenuItem");
    uploadFilesMenuItem.setText("Upload file(s)...");
    uploadFilesMenuItem.setActionCommand("UploadFiles");
    uploadFilesMenuItem.addActionListener(this);
    guiUtils.applyIcon(uploadFilesMenuItem, "/images/nuvola/16x16/actions/1uparrow.png");
    objectActionMenu.add(uploadFilesMenuItem);

    objectActionMenu.add(new JSeparator());

    togglePublicMenuItem = skinsFactory.createSkinnedJMenuItem("AclToggleMenuItem");
    togglePublicMenuItem.setText("Change privacy setting...");
    togglePublicMenuItem.setActionCommand("TogglePublicPrivate");
    togglePublicMenuItem.addActionListener(this);
    guiUtils.applyIcon(togglePublicMenuItem, "/images/nuvola/16x16/actions/encrypted.png");
    objectActionMenu.add(togglePublicMenuItem);

    generatePublicGetUrl = skinsFactory.createSkinnedJMenuItem("PublicUrlMenuItem");
    generatePublicGetUrl.setText("Public web link...");
    generatePublicGetUrl.setActionCommand("GeneratePublicGetURL");
    generatePublicGetUrl.addActionListener(this);
    guiUtils.applyIcon(generatePublicGetUrl, "/images/nuvola/16x16/actions/wizard.png");
    objectActionMenu.add(generatePublicGetUrl);

    objectActionMenu.add(new JSeparator());

    deleteObjectMenuItem = skinsFactory.createSkinnedJMenuItem("DeleteMenuItem");
    deleteObjectMenuItem.setText("Delete file(s)...");
    deleteObjectMenuItem.setActionCommand("DeleteObjects");
    deleteObjectMenuItem.addActionListener(this);
    guiUtils.applyIcon(deleteObjectMenuItem, "/images/nuvola/16x16/actions/cancel.png");
    objectActionMenu.add(deleteObjectMenuItem);

    viewObjectPropertiesMenuItem.setEnabled(false);
    refreshObjectMenuItem.setEnabled(false);
    togglePublicMenuItem.setEnabled(false);
    downloadObjectMenuItem.setEnabled(false);
    generatePublicGetUrl.setEnabled(false);
    deleteObjectMenuItem.setEnabled(false);

    // Card layout in stack panel
    stackPanel.add(loginPanel, "LoginPanel");
    stackPanel.add(objectsPanel, "ObjectsPanel");

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsPanel });
    objectsPanel.getDropTarget().setActive(true);
}

From source file:org.rdv.viz.image.ImageViz.java

private void initTiltControls() {
    tiltControls = new JPanel();
    tiltControls.setLayout(new BorderLayout());

    JButton tiltUpButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-up.gif"));
    tiltUpButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            tiltUp();//from   w ww .j a va  2 s  .c o  m
        }
    });
    tiltUpButton.setBorder(null);
    tiltControls.add(tiltUpButton, BorderLayout.NORTH);

    JButton tiltControlButton = new StrechIconButton(
            DataViewer.getIcon("icons/ptz/robotic_control-tiltbar-medium.gif"));
    tiltControlButton.setBorder(null);
    tiltControlButton.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JButton button = (JButton) e.getComponent();
            int tilt = Math.round(100f * e.getPoint().y / button.getHeight());
            tilt(tilt);
        }
    });
    tiltControls.add(tiltControlButton, BorderLayout.CENTER);

    JButton tiltDownButton = new JButton(DataViewer.getIcon("icons/ptz/robotic_control-down.gif"));
    tiltDownButton.setBorder(null);
    tiltDownButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ae) {
            tiltDown();
        }
    });
    tiltControls.add(tiltDownButton, BorderLayout.SOUTH);
}

From source file:org.swiftexplorer.gui.AboutDlg.java

public static void show(Component parent, HasLocalizedStrings stringsBundle) {
    URI uri = null;//from   w  ww  . j  ava 2 s  .  c o  m
    try {
        uri = new URI("http://www.swiftexplorer.org");
    } catch (URISyntaxException e) {
        logger.error("URL seems to be ill-formed", e);
    }
    final String buttontext = "www.swiftexplorer.org";

    Box mainBox = Box.createVerticalBox();
    mainBox.setBorder(BorderFactory.createEmptyBorder(0, 4, 0, 0));

    StringBuilder sb = loadResource("/about.html");
    JLabel label = new JLabel(sb.toString());
    label.getAccessibleContext().setAccessibleDescription(getTitle(stringsBundle));
    mainBox.add(label);

    if (uri != null) {
        JButton button = new JButton();
        button.setText(buttontext);
        button.setToolTipText(uri.toString());
        button.addActionListener(new OpenUrlAction(uri));
        FontMetrics metrics = button.getFontMetrics(button.getFont());
        if (metrics != null)
            button.setSize(metrics.stringWidth(buttontext), button.getHeight());
        button.getAccessibleContext().setAccessibleDescription(buttontext);
        mainBox.add(button);
    }

    mainBox.add(Box.createVerticalStrut(10));

    JPanel panel = new JPanel();
    panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    panel.add(mainBox);

    JOptionPane.showMessageDialog(parent, panel, getTitle(stringsBundle), JOptionPane.INFORMATION_MESSAGE,
            getIcon());
}

From source file:org.ut.biolab.medsavant.client.view.genetics.variantinfo.GeneManiaSubInspector.java

protected JButton[] getRowButtons(final Gene finalGene, final String kvpKey) {
    JButton geneInspectorButton = ViewUtil
            .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.INSPECTOR));
    geneInspectorButton.setToolTipText("Inspect this gene");
    geneInspectorButton.addActionListener(new ActionListener() {
        @Override//ww w  . jav  a 2  s  .c o  m
        public void actionPerformed(ActionEvent ae) {
            if (geneListener != null) {
                geneListener.handleEvent(finalGene);
            }
        }
    });

    final JButton addToRegionListButton = ViewUtil
            .getTexturedButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.ADDKVP));
    addToRegionListButton.setToolTipText("Add to Region List");
    addToRegionListButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            getRegionSetsMenu(finalGene).show(addToRegionListButton, 0, addToRegionListButton.getHeight());
        }
    });

    EntrezButton geneLinkButton = new EntrezButton(finalGene.getName());

    return new JButton[] { geneInspectorButton, addToRegionListButton, geneLinkButton };
}