Example usage for javax.swing JToolBar JToolBar

List of usage examples for javax.swing JToolBar JToolBar

Introduction

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

Prototype

public JToolBar() 

Source Link

Document

Creates a new tool bar; orientation defaults to HORIZONTAL.

Usage

From source file:ar.edu.uns.cs.vyglab.arq.rockar.gui.JFrameControlPanel.java

private void initGUI() {
    try {//from   www .  ja va2 s.co m
        setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setIconImage(new ImageIcon(getClass().getClassLoader()
                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/splash/purple-monkey32.png"))
                        .getImage());
        this.setTitle("Rock.AR v2.0");
        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent evt) {
                thisComponentResized(evt);
            }
        });
        this.addWindowListener(new WindowAdapter() {
            public void windowClosed(WindowEvent evt) {
                thisWindowClosed(evt);
            }
        });
        {
            jPanelSouth = new JPanel();
            BorderLayout jPanelSouthLayout = new BorderLayout();
            getContentPane().add(jPanelSouth, BorderLayout.SOUTH);
            jPanelSouth.setLayout(jPanelSouthLayout);
            {
                jLabelInformation = new JLabel();
                jPanelSouth.add(jLabelInformation, BorderLayout.CENTER);
                jLabelInformation.setText(DataCenter.langResource.getString("control_information_label"));
                jLabelInformation.setOpaque(true);
                jLabelInformation.setBackground(new java.awt.Color(241, 191, 101));
            }
        }
        {
            jPanelCenter = new JPanel();
            GridLayout jPanelCenterLayout = new GridLayout(1, 1);
            jPanelCenterLayout.setHgap(5);
            jPanelCenterLayout.setVgap(5);
            jPanelCenterLayout.setColumns(1);
            getContentPane().add(jPanelCenter, BorderLayout.CENTER);
            jPanelCenter.setLayout(jPanelCenterLayout);
            {
                jPanelWest = new JPanel();
                BorderLayout jPanelWestLayout = new BorderLayout();
                jPanelCenter.add(jPanelWest);
                jPanelWest.setLayout(jPanelWestLayout);
                jPanelWest.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                {
                    jToolBarMineralTable = new JToolBar();
                    jToolBarMineralTable.setLayout(new FlowLayout(FlowLayout.LEFT));
                    jPanelWest.add(jToolBarMineralTable, BorderLayout.NORTH);
                    jToolBarMineralTable.setFloatable(false);
                    jToolBarMineralTable.setFocusable(false);
                    {
                        jButtonNew = new JButton();
                        jToolBarMineralTable.add(jButtonNew);
                        jButtonNew.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Actions-tab-new-icon.png")));
                        jButtonNew.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonNewActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonOpen = new JButton();
                        jToolBarMineralTable.add(jButtonOpen);
                        jButtonOpen.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/open.png")));
                        jButtonOpen.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonOpenActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonSave = new JButton();
                        jToolBarMineralTable.add(jButtonSave);
                        jButtonSave.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/save.png")));
                        jButtonSave.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonSaveActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jSeparator1 = new JSeparator();
                        jToolBarMineralTable.add(jSeparator1);
                        jSeparator1.setOrientation(SwingConstants.VERTICAL);
                        jSeparator1.setSize(5, 44);
                        jSeparator1.setPreferredSize(new java.awt.Dimension(5, 44));
                    }
                    {
                        jButtonAdd = new JButton();
                        jToolBarMineralTable.add(jButtonAdd);
                        jButtonAdd.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/add.png")));
                        jButtonAdd.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonAddActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonEdit = new JButton();
                        jToolBarMineralTable.add(jButtonEdit);
                        jButtonEdit.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/modify.png")));
                        jButtonEdit.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonEditActionPerformed(evt);
                            }
                        });
                    }
                    {
                        jButtonRemove = new JButton();
                        jToolBarMineralTable.add(jButtonRemove);
                        jButtonRemove.setIcon(new ImageIcon(getClass().getClassLoader()
                                .getResource("ar/edu/uns/cs/vyglab/arq/rockar/resources/images/remove.png")));
                        jButtonRemove.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                jButtonRemoveActionPerformed(evt);
                            }
                        });
                    }
                }
                {
                    jLabelMineralTableInformation = new JLabel();
                    jPanelWest.add(jLabelMineralTableInformation, BorderLayout.SOUTH);
                    jLabelMineralTableInformation
                            .setText(DataCenter.langResource.getString("total_counted_table"));
                    jLabelMineralTableInformation.setHorizontalAlignment(SwingConstants.LEFT);
                    jLabelMineralTableInformation.setBackground(new java.awt.Color(255, 212, 133));
                    jLabelMineralTableInformation.setOpaque(true);
                }
                {
                    jScrollPaneMineralTable = new JScrollPane();
                    jPanelWest.add(jScrollPaneMineralTable, BorderLayout.CENTER);
                    {
                        jTableMineralsModel = new RockTableModel(
                                new String[] { DataCenter.langResource.getString("keyvalue_table"),
                                        DataCenter.langResource.getString("name_table"),
                                        DataCenter.langResource.getString("color_table"),
                                        DataCenter.langResource.getString("counted_table"),
                                        DataCenter.langResource.getString("area_table") },
                                0);
                        //                     jTableMineralsModel.addRow(new Object[] {
                        //                           0, "x?", Color.gray, 0,
                        //                           "0.00" });
                        jTableMinerals = new JReadOnlyTable();
                        jScrollPaneMineralTable.setViewportView(jTableMinerals);
                        jTableMinerals.setModel(jTableMineralsModel);
                        jTableMinerals.setDefaultRenderer(Color.class, new ColorRenderer(true));
                        TableCellRenderer centerRenderer = new CenterRenderer();
                        TableColumn column = jTableMinerals.getColumnModel().getColumn(0);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(1);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(3);
                        column.setCellRenderer(centerRenderer);
                        column = jTableMinerals.getColumnModel().getColumn(4);
                        column.setCellRenderer(centerRenderer);

                    }
                }
            }
            {
                jPanelEast = new JPanel();
                jPanelCenter.add(jPanelEast);
                GridLayout jPanelEastLayout = new GridLayout(2, 1);
                jPanelEastLayout.setHgap(5);
                jPanelEastLayout.setVgap(5);
                jPanelEastLayout.setColumns(1);
                jPanelEast.setLayout(jPanelEastLayout);
                {
                    jPanelTop = new JPanel();
                    BorderLayout jPanelTopLayout = new BorderLayout();
                    jPanelEast.add(jPanelTop);
                    jPanelTop.setLayout(jPanelTopLayout);
                    jPanelTop.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                    {
                        jToolBarStats = new JToolBar();
                        jPanelTop.add(jToolBarStats, BorderLayout.NORTH);
                        jToolBarStats.setFloatable(false);
                        jToolBarStats.setFocusable(false);
                        {
                            jButtonExportStats = new JButton();
                            jButtonExportStats.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    saveChartAsImage();
                                }
                            });
                            //jToolBarStats.add(jButtonExportStats);
                            jButtonExportStats.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png")));
                        }
                        {
                            jButtonExportExcel = new JButton();
                            //jToolBarStats.add(jButtonExportExcel);
                            //jToolBarMineralTable.add(jButtonExportExcel);
                            jButtonExportExcel.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/excel-icon.png")));
                            jButtonExportExcel.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    exportToExcel();
                                }
                            });
                        }
                        {
                            jButtonExportAll = new JButton();
                            //jToolBarStats.add(jButtonExportAll);
                            jButtonExportAll.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/Mimetypes-application-vnd-ms-excel-icon.png")));
                        }
                    }
                    {

                    }
                }
                {
                    jPanelBottom = new JPanel();
                    BorderLayout jPanelBottomLayout = new BorderLayout();
                    jPanelEast.add(jPanelBottom);
                    jPanelBottom.setLayout(jPanelBottomLayout);
                    jPanelBottom.setBorder(new LineBorder(new java.awt.Color(0, 0, 0), 1, false));
                    {
                        jToolBarOverview = new JToolBar();
                        jPanelBottom.add(jToolBarOverview, BorderLayout.NORTH);
                        jToolBarOverview.setFloatable(false);
                        jToolBarOverview.setFocusable(false);
                        {
                            jButtonExportOverview = new JButton();
                            jToolBarOverview.add(jButtonExportOverview);
                            jButtonExportOverview.setIcon(new ImageIcon(getClass().getClassLoader().getResource(
                                    "ar/edu/uns/cs/vyglab/arq/rockar/resources/images/export-graph.png")));
                            jButtonExportOverview.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent arg0) {
                                    exportOverview();
                                }
                            });
                        }
                    }
                    {
                        jPanelOverviewContent = new JPanel();
                        jPanelBottom.add(jPanelOverviewContent, BorderLayout.CENTER);
                        jPanelOverviewContent.setLayout(new GridBagLayout());
                        this.jLabelOverview = new JLabel();
                        jPanelOverviewContent.add(this.jLabelOverview);
                    }
                }
            }
        }
        pack();
        this.setSize(800, 600);
    } catch (Exception e) {
        //add your error handling code here
        e.printStackTrace();
    }
}

From source file:org.jax.bham.test.HaplotypeAssociationTestGraphPanel.java

/**
 * a function to initialize the components for this panel
 *///from   w  ww  . ja  va  2s  .c  o  m
private void initialize() {
    this.chromosomeComboBox.addItem("All Chromosomes");
    List<Integer> chromoList = SequenceUtilities
            .toIntegerList(this.testToPlot.getHaplotypeDataSource().getAvailableChromosomes());
    Collections.sort(chromoList);
    for (Integer chromoNum : chromoList) {
        this.chromosomeComboBox.addItem(chromoNum);
    }
    if (!chromoList.isEmpty()) {
        this.chromosomeComboBox.setSelectedIndex(1);
    }
    this.chromosomeComboBox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                HaplotypeAssociationTestGraphPanel.this.chromosomeSelectionChanged();
            }
        }
    });

    JToolBar toolBar = new JToolBar();
    toolBar.add(new JLabel("Chromosome:"));

    // limit the size or the toolbar will try to make the drop-down huge
    this.chromosomeComboBox.setMaximumSize(this.chromosomeComboBox.getPreferredSize());
    toolBar.add(this.chromosomeComboBox);

    this.add(toolBar, BorderLayout.PAGE_START);

    this.add(this.chartPanel, BorderLayout.CENTER);

    this.chromosomeSelectionChanged();
}

From source file:org.jax.bham.test.PhylogenyAssociationTestGraphPanel.java

/**
 * a function to initialize the components for this panel
 *//*from   w  w w .  j  av a 2s.  c  o  m*/
private void initialize() {
    this.chromosomeComboBox.addItem("All Chromosomes");
    List<Integer> chromoList = SequenceUtilities
            .toIntegerList(this.testToPlot.getPhylogenyDataSource().getAvailableChromosomes());
    Collections.sort(chromoList);
    for (Integer chromoNum : chromoList) {
        this.chromosomeComboBox.addItem(chromoNum);
    }
    if (!chromoList.isEmpty()) {
        this.chromosomeComboBox.setSelectedIndex(1);
    }
    this.chromosomeComboBox.addItemListener(new ItemListener() {
        /**
         * {@inheritDoc}
         */
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                PhylogenyAssociationTestGraphPanel.this.chromosomeSelectionChanged();
            }
        }
    });

    JToolBar toolBar = new JToolBar();
    toolBar.add(new JLabel("Chromosome:"));

    // limit the size or the toolbar will try to make the drop-down huge
    this.chromosomeComboBox.setMaximumSize(this.chromosomeComboBox.getPreferredSize());
    toolBar.add(this.chromosomeComboBox);

    this.add(toolBar, BorderLayout.PAGE_START);

    this.add(this.chartPanel, BorderLayout.CENTER);

    this.chromosomeSelectionChanged();
}

From source file:edu.ku.brc.specify.BackupAndRestoreApp.java

/**
 *
 * @return the toolbar for the app/*from  ww  w  .j  a va  2s  .c  o  m*/
 */
public JToolBar createToolBar() {
    JToolBar toolBar = new JToolBar();
    toolBar.setLayout(new ToolbarLayoutManager(2, 2));

    appIcon = new JLabel("  "); //$NON-NLS-1$

    return toolBar;
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.PeakAnnotationCalibrationPanel.java

private JToolBar createToolBarEdit() {
    JToolBar toolbar = new JToolBar();
    toolbar.setFloatable(false);/* ww w. j a va 2  s.c  o  m*/

    toolbar.addSeparator();

    toolbar.add(theActionManager.get("arrow"));
    toolbar.add(theActionManager.get("hand"));

    toolbar.addSeparator();

    toolbar.add(theActionManager.get("zoomnone"));
    toolbar.add(theActionManager.get("zoomin"));
    toolbar.add(theActionManager.get("zoomout"));

    return toolbar;
}

From source file:org.fhaes.jsea.JSEAFrame.java

/**
 * Setup toolbar.//w w w  .  j a  v a 2  s. c om
 */
private void setupToolbar() {

    JToolBar toolBar = new JToolBar();
    toolBar.setFloatable(false);
    toolBar.setRollover(true);
    getContentPane().add(toolBar, "cell 0 0");
    {
        JToolBarButton btnNew = new JToolBarButton(actionReset);
        btnNew.setToolTipText("Start new analysis");
        toolBar.add(btnNew);

        JToolBarButton btnSaveAll = new JToolBarButton(actionSaveAll);
        btnSaveAll.setToolTipText("Save all results");
        toolBar.add(btnSaveAll);

        toolBar.addSeparator();

        JToolBarButton btnCopy = new JToolBarButton(actionCopy);
        btnSaveAll.setToolTipText("Copy");
        toolBar.add(btnCopy);

        JToolBarButton btnChartProperties = new JToolBarButton(actionChartProperties);
        btnChartProperties.setToolTipText("Chart properties");
        toolBar.add(btnChartProperties);

        toolBar.addSeparator();

        JToolBarButton btnRun = new JToolBarButton(actionRun);
        btnRun.setToolTipText("Run analysis");
        toolBar.add(btnRun);

        toolBar.addSeparator();

        JToolBarButton btnLagMap = new JToolBarButton(actionLagMap);
        btnLagMap.setToolTipText("Launch LagMap");
        toolBar.add(btnLagMap);
    }
}

From source file:edu.ucla.stat.SOCR.analyses.gui.NormalPower.java

/**Initialize the Analysis*/
public void init() {
    mapIndep = false;/*from w ww  .  jav a 2 s.  c  o m*/
    showInput = false;
    super.init();
    analysisType = AnalysisType.NORMAL_POWER;
    analysisName = "Normal Distribution Power Computation";
    useInputExample = false;
    useLocalExample = false;
    useRandomExample = true;
    useServerExample = false;
    useStaticExample = new boolean[10];

    depMax = 1; // max number of dependent var
    indMax = 1; // max number of independent var

    resultPanelTextArea.setFont(new Font(outputFontFace, Font.BOLD, outputFontSize));
    frame = getFrame(this);
    setName(analysisName);
    // Create the toolBar
    ////////////////////////System.out.println("NormalPower init done variable");
    toolBar = new JToolBar();
    createActionComponents(toolBar);
    ////////////////////////System.out.println("NormalPower init this.getContentPane() = " + this.getContentPane());
    this.getContentPane().add(toolBar, BorderLayout.NORTH);
    ////////////////////////System.out.println("NormalPower init start add listener");

    checkSampleSizeBox.addActionListener(this);
    checkPowerBox.addActionListener(this);
    criticalValueBox.addActionListener(this);

    checkNE.addActionListener(this);
    checkLT.addActionListener(this);
    checkGT.addActionListener(this);
    sampleSizeText.addActionListener(this);
    sigmaText.addActionListener(this);
    sigmaText.addKeyListener(this);

    mu0Text.addActionListener(this);
    muAText.addActionListener(this);
    powerText.addActionListener(this);
    alphaCombo.addActionListener(this);
    sampleSizeBar.addAdjustmentListener(this);
    powerBar.addAdjustmentListener(this);

    checkSampleSizeBox.addMouseListener(this);
    checkPowerBox.addMouseListener(this);
    criticalValueBox.addMouseListener(this);

    checkNE.addMouseListener(this);
    checkLT.addMouseListener(this);
    checkGT.addMouseListener(this);
    sampleSizeText.addMouseListener(this);
    sigmaText.addMouseListener(this);
    mu0Text.addMouseListener(this);
    muAText.addMouseListener(this);
    powerText.addMouseListener(this);
    alphaCombo.addMouseListener(this);
    /********** alphaCombo is not editable because I can't get the critical point for ANY x values. **********/
    alphaCombo.setEditable(false);

    alphaCombo.setSelectedIndex(1);

    tools2.remove(addButton2);
    tools2.remove(removeButton2);
    depLabel.setText(VARIABLE);
    indLabel.setText("");
    listIndepRemoved.setBackground(Color.LIGHT_GRAY);
    mappingInnerPanel.remove(listIndepRemoved);
    addButton1.addActionListener(this);
    chartFactory = new Chart();
    validate();
}

From source file:TopLevelTransferHandlerDemo.java

private JToolBar createDummyToolBar() {
    JToolBar tb = new JToolBar();
    JButton b;//from  w  ww.  ja  va  2s. c  om
    b = new JButton("New");
    b.setRequestFocusEnabled(false);
    tb.add(b);
    b = new JButton("Open");
    b.setRequestFocusEnabled(false);
    tb.add(b);
    b = new JButton("Save");
    b.setRequestFocusEnabled(false);
    tb.add(b);
    b = new JButton("Print");
    b.setRequestFocusEnabled(false);
    tb.add(b);
    b = new JButton("Preview");
    b.setRequestFocusEnabled(false);
    tb.add(b);
    tb.setFloatable(false);
    return tb;
}

From source file:apidemo.PanScrollZoomDemo.java

/**
 * Creates the toolbar./* www .  j a  va2  s.  c  o m*/
 * 
 * @return the toolbar.
 */
private JToolBar createToolbar() {
    final JToolBar toolbar = new JToolBar();

    final ButtonGroup groupedButtons = new ButtonGroup();

    // ACTION_CMD_PAN
    this.panButton = new JToggleButton();
    prepareButton(this.panButton, ACTION_CMD_PAN, " Pan ", "Pan mode");
    groupedButtons.add(this.panButton);
    toolbar.add(this.panButton);

    // ACTION_CMD_ZOOM_BOX
    this.zoomButton = new JToggleButton();
    prepareButton(this.zoomButton, ACTION_CMD_ZOOM_BOX, " Zoom ", "Zoom mode");
    groupedButtons.add(this.zoomButton);
    this.zoomButton.setSelected(true); // no other makes sense after startup
    toolbar.add(this.zoomButton);

    // end of toggle-button group for select/pan/zoom-box
    toolbar.addSeparator();

    // ACTION_CMD_ZOOM_IN
    this.zoomInButton = new JButton();
    prepareButton(this.zoomInButton, ACTION_CMD_ZOOM_IN, " + ", "Zoom in");
    toolbar.add(this.zoomInButton);

    // ACTION_CMD_ZOOM_OUT
    this.zoomOutButton = new JButton();
    prepareButton(this.zoomOutButton, ACTION_CMD_ZOOM_OUT, " - ", "Zoom out");
    toolbar.add(this.zoomOutButton);

    // ACTION_CMD_ZOOM_TO_FIT
    this.fitButton = new JButton();
    prepareButton(this.fitButton, ACTION_CMD_ZOOM_TO_FIT, " Fit ", "Fit all");
    toolbar.add(this.fitButton);

    toolbar.addSeparator();

    this.scrollBar = new JScrollBar(JScrollBar.HORIZONTAL);
    //   int ht = (int) zoomButton.getPreferredSize().getHeight();
    //   scrollBar.setPreferredSize(new Dimension(0, ht));
    this.scrollBar.setModel(new DefaultBoundedRangeModel());

    toolbar.add(this.scrollBar);

    this.zoomOutButton.setEnabled(false);
    this.fitButton.setEnabled(false);
    this.scrollBar.setEnabled(false);

    toolbar.setFloatable(false);
    return toolbar;
}

From source file:org.geopublishing.atlasViewer.swing.AtlasChartJPanel.java

/**
 * Creates a {@link JToolBar} that has buttons to interact with the Chart
 * and it's SelectionModel./*from   www.  ja  va 2  s .c om*/
 * 
 * @return
 */
public JToolBar getToolBar() {
    if (toolBar == null) {

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

        ButtonGroup bg = new ButtonGroup();

        /**
         * Add an Action to ZOOM/MOVE in the chart
         */
        JToggleButton zoomToolButton = new SmallToggleButton(new AbstractAction("", ICON_ZOOM) {

            @Override
            public void actionPerformed(ActionEvent e) {
                getSelectableChartPanel().setWindowSelectionMode(WindowSelectionMode.ZOOM_IN_CHART);
            }

        }, GpCoreUtil.R("AtlasChartJPanel.zoom.tt"));
        toolBar.add(zoomToolButton);
        bg.add(zoomToolButton);

        toolBar.addSeparator();

        /**
         * Add an Action not change the selection but just move through the
         * chart
         */
        JToggleButton setSelectionButton = new SmallToggleButton(new AbstractAction("", ICON_SELECTION_SET) {

            @Override
            public void actionPerformed(ActionEvent e) {
                getSelectableChartPanel().setWindowSelectionMode(WindowSelectionMode.SELECT_SET);
            }

        });
        setSelectionButton.setToolTipText(MapPaneToolBar.R("MapPaneButtons.Selection.SetSelection.TT"));
        toolBar.add(setSelectionButton);
        bg.add(setSelectionButton);

        /**
         * Add an Action to ADD the selection.
         */
        JToggleButton addSelectionButton = new SmallToggleButton(new AbstractAction("", ICON_SELECTION_ADD) {

            @Override
            public void actionPerformed(ActionEvent e) {
                getSelectableChartPanel().setWindowSelectionMode(WindowSelectionMode.SELECT_ADD);
            }

        });
        addSelectionButton.setToolTipText(MapPaneToolBar.R("MapPaneButtons.Selection.AddSelection.TT"));
        toolBar.add(addSelectionButton);
        bg.add(addSelectionButton);

        /**
         * Add an Action to REMOVE the selection.
         */
        JToggleButton removeSelectionButton = new SmallToggleButton(
                new AbstractAction("", ICON_SELECTION_REMOVE) {

                    @Override
                    public void actionPerformed(ActionEvent e) {
                        getSelectableChartPanel().setWindowSelectionMode(WindowSelectionMode.SELECT_REMOVE);
                    }

                });
        removeSelectionButton.setToolTipText(MapPaneToolBar.R("MapPaneButtons.Selection.RemoveSelection.TT"));
        toolBar.add(removeSelectionButton);
        bg.add(removeSelectionButton);

        toolBar.addSeparator();

        /**
         * Add a normal Button to clear the selection. The Chart's selection
         * models are cleared. If a relation to a JMapPane exists, they will
         * be synchronized.
         */
        final SmallButton clearSelectionButton = new SmallButton(new AbstractAction("", ICON_SELECTION_CLEAR) {

            @Override
            public void actionPerformed(ActionEvent e) {
                // getSelectionModel().clearSelection();

                // get the selectionmodel(s) of the chart
                List<FeatureDatasetSelectionModel<?, ?, ?>> datasetSelectionModelFor = FeatureChartUtil
                        .getFeatureDatasetSelectionModelFor(getSelectableChartPanel().getChart());

                for (FeatureDatasetSelectionModel dsm : datasetSelectionModelFor) {
                    dsm.clearSelection();
                }

            }

        }, MapPaneToolBar.R("MapPaneButtons.Selection.ClearSelection.TT"));

        {
            // Add listeners to the selection model, so we knwo when to
            // disable/enable the button

            // get the selectionmodel(s) of the chart
            List<FeatureDatasetSelectionModel<?, ?, ?>> datasetSelectionModelFor = FeatureChartUtil
                    .getFeatureDatasetSelectionModelFor(getSelectableChartPanel().getChart());
            for (final FeatureDatasetSelectionModel selModel : datasetSelectionModelFor) {
                DatasetSelectionListener listener_ClearSelectionButtonEnbled = new DatasetSelectionListener() {

                    @Override
                    public void selectionChanged(DatasetSelectionChangeEvent e) {
                        if (!e.getSource().getValueIsAdjusting()) {

                            // Update the clearSelectionButton
                            clearSelectionButton.setEnabled(selModel.getSelectedFeatures().size() > 0);
                        }
                    }
                };
                insertedListeners.add(listener_ClearSelectionButtonEnbled);
                selModel.addSelectionListener(listener_ClearSelectionButtonEnbled);

                clearSelectionButton.setEnabled(selModel.getSelectedFeatures().size() > 0);
            }
        }

        toolBar.add(clearSelectionButton);

        toolBar.addSeparator();

        /**
         * Add a normal Button which opens the Chart'S print dialog
         */
        SmallButton printChartButton = new SmallButton(new AbstractAction("", Icons.ICON_PRINT_24) {

            @Override
            public void actionPerformed(ActionEvent e) {

                getSelectableChartPanel().createChartPrintJob();

            }

        });
        printChartButton.setToolTipText(GpCoreUtil.R("AtlasChartJPanel.PrintChartButton.TT"));
        toolBar.add(printChartButton);

        /**
         * Add a normal Button which opens the Chart's export/save dialog
         */
        SmallButton saveChartAction = new SmallButton(new AbstractAction("", Icons.ICON_SAVEAS_24) {

            @Override
            public void actionPerformed(ActionEvent e) {

                try {
                    getSelectableChartPanel().doSaveAs();
                } catch (IOException e1) {
                    LOGGER.info("Saving a chart to file failed", e1);
                    ExceptionDialog.show(AtlasChartJPanel.this, e1);
                }

            }

        });
        saveChartAction.setToolTipText(GpCoreUtil.R("AtlasChartJPanel.SaveChartButton.TT"));
        toolBar.add(saveChartAction);

        //
        // A JButton to open the attribute table
        //
        {
            final JButton openTable = new JButton();
            openTable.setAction(new AbstractAction(GpCoreUtil.R("LayerToolMenu.table"), Icons.ICON_TABLE) {

                @Override
                public void actionPerformed(final ActionEvent e) {
                    AVDialogManager.dm_AttributeTable.getInstanceFor(styledLayer, AtlasChartJPanel.this,
                            styledLayer, mapLegend);
                }
            });
            toolBar.addSeparator();
            toolBar.add(openTable);
        }

        /*
         * Select/set data points button is activated by default
         */
        getSelectableChartPanel().setWindowSelectionMode(WindowSelectionMode.SELECT_SET);
        setSelectionButton.setSelected(true);

    }
    return toolBar;
}