Example usage for javax.swing JToolBar setFloatable

List of usage examples for javax.swing JToolBar setFloatable

Introduction

In this page you can find the example usage for javax.swing JToolBar setFloatable.

Prototype

@BeanProperty(preferred = true, description = "Can the tool bar be made to float by the user?")
public void setFloatable(boolean b) 

Source Link

Document

Sets the floatable property, which must be true for the user to move the tool bar.

Usage

From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java

/** 
 * Builds the general bar./*from  ww w  .  j a v a2 s.  c  o m*/
 * 
 * @return See above.
 */
private JComponent buildGeneralBar() {
    JToolBar bar = new JToolBar();
    bar.setBackground(UIUtilities.BACKGROUND_COLOR);
    bar.setFloatable(false);
    bar.setRollover(true);
    bar.setBorder(null);
    bar.add(saveButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(refreshButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(viewButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(linkButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(saveAsButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(publishingButton);
    /*
    if (MetadataViewerAgent.isAdministrator()) {
       bar.add(Box.createHorizontalStrut(5));
        bar.add(uploadScriptButton);
    }
    bar.add(Box.createHorizontalStrut(5));
    bar.add(scriptsButton);
    */
    //bar.add(scriptsButton);
    return bar;
}

From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java

/**
 * Helper method to create the tool bar hosting the edit items.
 * //from  w  w  w.  j av  a2  s .  c  o m
 * @return See above.
 */
private JToolBar createSearchBar() {
    JToolBar bar = new JToolBar();
    bar.setFloatable(false);
    bar.setRollover(true);
    bar.setBorder(null);
    bar.add(new JSeparator(JSeparator.VERTICAL));
    bar.add(new JToggleButton(controller.getAction(TreeViewerControl.SEARCH)));
    return bar;
}

From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java

/** 
 * Invokes when the activity end. /*from w  w w. j a  v a  2s.  co  m*/
 * 
 * @param result The result of the activity.
 */
public void endActivity(Object result) {
    this.result = result;
    boolean busy = status.isBusy();
    reset();
    if (result instanceof Map) {
        Map<String, Object> m = convertResult((Map<String, Object>) result);
        int size = m.size();
        this.result = m;
        remove(resultPane);
        Color c = getBackground();
        if (size == 0) {
            JToolBar row = new JToolBar();
            row.setOpaque(false);
            row.setFloatable(false);
            row.setBorder(null);
            row.setBackground(c);
            JButton button;
            if (errorObject != null) {
                button = createButton(ActivityResultRow.ERROR_TEXT, ERROR, this);
                button.addMouseListener(new MouseAdapter() {

                    public void mouseReleased(MouseEvent e) {
                        showMenu((JComponent) e.getSource(), ERROR, e.getX(), e.getY());
                    }
                });
                row.add(button);
            }
            if (infoObject != null) {
                button = createButton(ActivityResultRow.INFO_TEXT, INFO, this);
                button.addMouseListener(new MouseAdapter() {

                    public void mouseReleased(MouseEvent e) {
                        showMenu((JComponent) e.getSource(), INFO, e.getX(), e.getY());
                    }
                });
                row.add(button);
            }
            add(row, paneIndex);
        } else {
            Entry<String, Object> entry;
            Iterator<Entry<String, Object>> i = m.entrySet().iterator();
            ActivityResultRow row = null;
            JPanel content = new JPanel();
            content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

            content.setBackground(c);
            int index = 0;
            int max = 2;
            JButton moreButton = null;
            while (i.hasNext()) {
                entry = (Entry<String, Object>) i.next();
                this.result = entry.getValue();
                row = new ActivityResultRow((String) entry.getKey(), entry.getValue(), this);
                row.setBackground(c);
                row.addPropertyChangeListener(listener);
                resultButtons.add(row);
                if (index < max)
                    content.add(row);
                else {
                    if (moreButton == null) {
                        moreButton = createButton("" + (m.size() - max) + " more", ALL_RESULT, this);
                        content.add(moreButton);
                    }
                }
                index++;
            }

            if (m.size() == 1)
                add(row, paneIndex);
            else
                add(content, paneIndex);
            resultPane = content;
        }

        repaint();
    }

    firePropertyChange(UNREGISTER_ACTIVITY_PROPERTY, null, this);
    notifyActivityEnd();
    //Post an event to 
    //if (busy) {
    EventBus bus = registry.getEventBus();
    bus.post(new ActivityProcessEvent(this, busy));
    //}
}

From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java

/**
 * Helper method to create an empty, floatable toolbar with rollover
 * effect for the icon buttons and an etched border.
 *
 * @return See above.//from w  ww .  ja  va2 s  .co m
 */
private JToolBar createToolBar() {
    JToolBar bar = new JToolBar();
    bar.setBorder(BorderFactory.createEtchedBorder());
    bar.setFloatable(false);
    bar.putClientProperty("JToolBar.isRollover", Boolean.valueOf(true));
    return bar;
}

From source file:org.pentaho.reporting.designer.core.ReportDesignerFrame.java

private JComponent createPaletteToolBar() {
    final JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setOrientation(JToolBar.VERTICAL);

    final ElementMetaData[] datas = ElementTypeRegistry.getInstance().getAllElementTypes();
    Arrays.sort(datas, new GroupedMetaDataComparator());
    Object grouping = null;//from   w w w.  j  av a 2 s.  c  o m
    boolean firstElement = true;
    for (int i = 0; i < datas.length; i++) {
        final ElementMetaData data = datas[i];
        if (data.isHidden()) {
            continue;
        }

        if (!WorkspaceSettings.getInstance().isVisible(data)) {
            continue;
        }

        final String currentGrouping = data.getGrouping(Locale.getDefault());
        if (firstElement == false) {
            if (ObjectUtilities.equal(currentGrouping, grouping) == false) {
                grouping = currentGrouping;
                toolBar.addSeparator();
            }
        } else {
            grouping = currentGrouping;
            firstElement = false;
        }
        final InsertElementAction action = new InsertElementAction(data);
        action.setReportDesignerContext(context);
        toolBar.add(new PaletteButton(data, context));
    }

    final JScrollPane paletteScrollpane = new JScrollPane(toolBar);
    paletteScrollpane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
    paletteScrollpane
            .addComponentListener(new ScrollbarSyncHandler(paletteScrollpane.getVerticalScrollBar(), toolBar));
    return paletteScrollpane;
}

From source file:org.pentaho.reporting.tools.configeditor.ConfigDescriptionEditor.java

/**
 * Creates and returns the entry list component that will hold all config description entries within a list.
 *
 * @return the created entry list.//from   ww  w . ja  v  a2s .co m
 */
private JPanel createEntryList() {
    final Action addEntryAction = new AddEntryAction();
    final Action removeEntryAction = new RemoveEntryAction();

    model = new ConfigDescriptionModel();
    entryList = new JList(model);
    entryList.addListSelectionListener(new ConfigListSelectionListener());

    final JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);
    toolbar.add(addEntryAction);
    toolbar.add(removeEntryAction);

    final JPanel panel = new JPanel();
    panel.setMinimumSize(new Dimension(200, 0));
    panel.setLayout(new BorderLayout());
    panel.add(toolbar, BorderLayout.NORTH);
    panel.add(new JScrollPane(entryList, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
    return panel;
}

From source file:org.rdv.datapanel.AbstractDataPanel.java

JToolBar createToolBar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);

    final DataPanel dataPanel = this;

    achButton = new ToolBarButton(detachIconFileName, "Detach data panel");
    achButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            toggleDetach();//from  w w w.  j a va 2 s.  com
        }
    });
    toolBar.add(achButton);
    JButton button = new ToolBarButton(closeIconFileName, "Close data panel");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            dataPanelManager.closeDataPanel(dataPanel);
        }
    });
    toolBar.add(button);

    return toolBar;
}

From source file:org.rdv.ui.ChannelListPanel.java

/**
 * Create the tool bar./*  w ww.j  av  a  2  s .c  o m*/
 * 
 * @return  the tool bar for the channel list panel
 */
private JToolBar createToolBar() {
    JToolBar channelToolBar = new JToolBar();
    channelToolBar.setFloatable(false);

    JButton button = new ToolBarButton("icons/expandall.gif", "Expand channel list");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            expandTree();
        }
    });
    channelToolBar.add(button);

    button = new ToolBarButton("icons/collapseall.gif", "Collapse channel list");
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            collapseTree();
        }
    });
    channelToolBar.add(button);

    metadataUpdateButton = new ToolBarButton("icons/refresh.gif", "Update channel list");
    metadataUpdateButton.setEnabled(false);
    metadataUpdateButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            rbnb.updateMetadata();
        }
    });
    channelToolBar.add(metadataUpdateButton);

    return channelToolBar;
}

From source file:org.richie.codeGen.ui.GenAndPreviewUI.java

public JSplitPane getCenterPanel() {
    JToolBar logToolBar = new JToolBar();
    logToolBar.setFloatable(false);
    clearLogBtn = new JButton("");
    clearLogBtn.setIcon(new ImageIcon(ClassLoader.getSystemResource("resources/images/clear.gif")));
    clearLogBtn.addActionListener(this);
    clearLogBtn.addActionListener(this);
    logToolBar.add(clearLogBtn);//from   w  ww  .ja va2  s. c o  m
    logToolBar.addSeparator();
    JPanel logPanel = new JPanel();
    logPanel.setLayout(new BorderLayout());
    JScrollPane textPanel = new JScrollPane();
    logTextArea = new JTextArea();
    logTextArea.setMinimumSize(new Dimension(1, 1));
    textPanel.setViewportView(logTextArea);
    logPanel.add(logToolBar, BorderLayout.NORTH);
    logPanel.add(textPanel, BorderLayout.CENTER);
    split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, getTemplatePanel(), logPanel);
    split.setContinuousLayout(false);
    split.setOneTouchExpandable(true);
    split.setDividerLocation(400);
    return split;
}

From source file:org.rimudb.editor.RimuDBEditor.java

/**
 * Create and return a toolbar.//from   w w w .  j  ava 2  s . co m
 */
protected JToolBar createToolbar() {
    log.debug("createToolbar()");
    JToolBar toolbar = new JToolBar();

    // Open
    openBtn = new ToolbarButton(new OpenDescriptorAction(this, loadIcon("/images/famfamfam/folder.png")),
            "Open Table Descriptor");
    openBtn.setText("Open");
    openBtn.setName("openBtn");
    toolbar.add(openBtn);

    // Save
    saveBtn = new ToolbarButton(new SaveDescriptorAction(this, loadIcon("/images/famfamfam/disk.png")),
            "Save Table Descriptor");
    saveBtn.setText("Save");
    saveBtn.setName("saveBtn");
    toolbar.add(saveBtn);

    // A space
    //      toolbar.add(Box.createHorizontalStrut(5));

    // Clear
    clearBtn = new ToolbarButton(new ClearTableAction(this, loadIcon("/images/famfamfam/bin_closed.png")),
            "Clear");
    clearBtn.setText("Clear");
    clearBtn.setName("clearBtn");
    toolbar.add(clearBtn);

    // Save as
    //      saveAsBtn = new ToolbarButton(new SaveAsDescriptorAction(this, loadIcon("/images/sun/SaveAs24.gif")), "Save Table Descriptor as");
    //      saveAsBtn.setName("saveAsBtn");
    //      toolbar.add(saveAsBtn);

    // A space
    toolbar.addSeparator();

    // Import from a database
    importBtn = new ToolbarButton(new ImportAction(this, loadIcon("/images/famfamfam/database_go.png")),
            "Import from database");
    importBtn.setText("Import");
    importBtn.setName("importBtn");
    importBtn.setEnabled(false);
    toolbar.add(importBtn);

    // A space
    toolbar.add(Box.createHorizontalStrut(5));

    // Create classes
    createBtn = new ToolbarButton(
            new GenerateJavaAction(this, loadIcon("/images/famfamfam/page_white_cup.png")), "Create classes");
    createBtn.setText("Create");
    createBtn.setName("createBtn");
    toolbar.add(createBtn);

    // Finish up the tool bar
    toolbar.add(Box.createHorizontalGlue());
    toolbar.setFloatable(false);

    return toolbar;
}