Example usage for java.awt GridBagLayout GridBagLayout

List of usage examples for java.awt GridBagLayout GridBagLayout

Introduction

In this page you can find the example usage for java.awt GridBagLayout GridBagLayout.

Prototype

public GridBagLayout() 

Source Link

Document

Creates a grid bag layout manager.

Usage

From source file:burp.BurpExtender.java

private JPanel createMainPanel() {
    JPanel main = new JPanel();
    main.setLayout(new GridBagLayout());

    // Create Settings Panel
    JPanel settings = new JPanel(new GridBagLayout());

    createTitle("Settings", settings);
    KeyListener projectEnter = new KeyAdapter() {
        @Override//from ww  w.j a va  2  s  . c  om
        public void keyPressed(KeyEvent k) {
            if (k.getKeyCode() == KeyEvent.VK_ENTER)
                updateProjects();
        }
    };

    serverUrl = labelTextField("Server URL: ", settings,
            callbacks.loadExtensionSetting(BurpExtender.SERVER_KEY));
    serverUrl.addKeyListener(projectEnter);
    serverUrl.addFocusListener(new JTextFieldSettingFocusListener(BurpExtender.SERVER_KEY, callbacks));

    apiKey = labelTextField("API Key: ", settings, callbacks.loadExtensionSetting(BurpExtender.API_KEY));
    apiKey.addKeyListener(projectEnter);
    apiKey.addFocusListener(new JTextFieldSettingFocusListener(BurpExtender.API_KEY, callbacks));

    JButton targetRefresh = new JButton();
    targetRefresh.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            updateTargets();
        }
    });
    targetUrl = createComboBox("Target URL: ", settings, 3, targetRefresh);

    projectRefresh = new JButton();
    projectRefresh.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            Thread updateThread = new Thread() {
                public void run() {
                    NameValuePair selected = getProject();
                    if (selected != null)
                        callbacks.saveExtensionSetting(BurpExtender.PROJECT_KEY, selected.getValue());
                    updateProjects();
                }
            };
            updateThread.start();
        }
    });
    projectBox = createComboBox("Projects: ", settings, 4, projectRefresh);

    GridBagConstraints setGBC = new GridBagConstraints();
    setGBC.gridy = 3;
    setGBC.anchor = GridBagConstraints.NORTHWEST;
    main.add(settings, setGBC);

    // Separator
    Insets ins = new Insets(10, 10, 2, 10);

    JSeparator sep = new JSeparator(JSeparator.HORIZONTAL);
    callbacks.customizeUiComponent(sep);
    GridBagConstraints sepGBC = new GridBagConstraints();
    sepGBC.gridwidth = 3;
    sepGBC.gridx = 0;
    sepGBC.fill = GridBagConstraints.HORIZONTAL;
    sepGBC.insets = ins;
    main.add(sep, sepGBC);

    // Create Export Button
    JButton exportBtn = new JButton();
    exportBtn.setText("Send to Code Dx");
    exportBtn.addActionListener(new ExportActionListener(this, callbacks));
    callbacks.customizeUiComponent(exportBtn);
    GridBagConstraints btnGBC = new GridBagConstraints();
    btnGBC.gridx = 0;
    btnGBC.weightx = 1.0;
    btnGBC.weighty = 1.0;
    btnGBC.insets = ins;
    btnGBC.anchor = GridBagConstraints.NORTHWEST;
    main.add(exportBtn, btnGBC);

    updateTargets();
    return main;
}

From source file:edu.harvard.mcz.imagecapture.encoder.UnitTrayLabelBrowser.java

/**
 * This method initializes jPanel   /*from  w  w  w.j  a  v a 2  s .co  m*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 2;
        gridBagConstraints1.gridy = 0;
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 1;
        gridBagConstraints.gridy = 0;
        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.add(getJButton(), new GridBagConstraints());
        jPanel.add(getJButton1(), gridBagConstraints);
        jPanel.add(getJButton2(), gridBagConstraints1);
    }
    return jPanel;
}

From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyMain.java

private void initialize() {
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;//  ww w  . j av a 2s . c  o m
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 5;
    gridBagConstraints.weightx = 0.7;
    gridBagConstraints.insets = new Insets(10, 300, 0, 0); //(int top, int left, int bottom, int right)
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
    gridBagConstraints7.gridx = 5;
    gridBagConstraints7.gridy = 0;
    gridBagConstraints7.weightx = 0.3;
    gridBagConstraints7.insets = new Insets(10, 0, 0, 90);
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
    gridBagConstraints3.gridx = 0;
    gridBagConstraints3.gridy = 1;
    gridBagConstraints3.weightx = 1.0;
    gridBagConstraints3.gridwidth = 6;
    GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
    gridBagConstraints5.fill = GridBagConstraints.BOTH;
    gridBagConstraints5.gridx = 0;
    gridBagConstraints5.gridy = 2;
    gridBagConstraints5.weightx = 1.0;
    gridBagConstraints5.weighty = 1.0;
    gridBagConstraints5.gridwidth = 6;
    this.setSize(920, 700);
    this.setLayout(new GridBagLayout());
    this.add(getJPanelProjectCombo(), gridBagConstraints);
    this.add(getJPanelAutoIdentify(), gridBagConstraints7);
    this.add(JPanPendingTypeSelection(), gridBagConstraints3);
    this.add(getJSplitPaneMain(), gridBagConstraints5);
}

From source file:com.intel.stl.ui.monitor.view.PSNodesDetailsPanel.java

/**
 * Description://www .ja va  2  s  .c  om
 * 
 * @param name
 */
protected void initComponent() {
    setLayout(new BorderLayout(0, 0));
    setOpaque(false);
    setBorder(BorderFactory.createTitledBorder((Border) null));

    JPanel titlePanel = new JPanel(new BorderLayout(5, 1));
    titlePanel.setOpaque(false);
    numberLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN);
    numberLabel.setHorizontalAlignment(JLabel.RIGHT);
    titlePanel.add(numberLabel, BorderLayout.CENTER);
    nameLabel = ComponentFactory.getH3Label("", Font.PLAIN);
    nameLabel.setHorizontalAlignment(JLabel.LEFT);
    nameLabel.setVerticalAlignment(JLabel.BOTTOM);
    titlePanel.add(nameLabel, BorderLayout.EAST);
    add(titlePanel, BorderLayout.NORTH);

    JPanel mainPanel = new JPanel();
    mainPanel.setOpaque(false);
    mainPanel.setBorder(BorderFactory.createEmptyBorder(0, 2, 0, 2));
    GridBagLayout gridBag = new GridBagLayout();
    mainPanel.setLayout(gridBag);
    GridBagConstraints gc = new GridBagConstraints();

    gc.weighty = 0;
    gc.insets = new Insets(8, 2, 2, 2);
    gc.weightx = 1;
    gc.gridwidth = 1;
    gc.gridheight = 2;
    // gc.gridheight = 3; // Should change to 3 if we add Route
    typeChartPanel = new ChartPanel(null);
    typeChartPanel.setPreferredSize(new Dimension(80, 60));
    mainPanel.add(typeChartPanel, gc);

    gc.fill = GridBagConstraints.BOTH;
    gc.insets = new Insets(12, 2, 2, 2);
    gc.weightx = 0;
    gc.gridheight = 1;
    swNumberLabel = createNumberLabel();
    mainPanel.add(swNumberLabel, gc);

    gc.gridwidth = GridBagConstraints.REMAINDER;
    swNameLabel = createNameLabel(STLConstants.K0048_SWITCHES.getValue());
    mainPanel.add(swNameLabel, gc);

    gc.insets = new Insets(2, 2, 6, 2);
    gc.gridwidth = 1;
    fiNumberLabel = createNumberLabel();
    mainPanel.add(fiNumberLabel, gc);

    gc.gridwidth = GridBagConstraints.REMAINDER;
    fiNameLabel = createNameLabel(STLConstants.K0052_HOSTS.getValue());
    mainPanel.add(fiNameLabel, gc);

    // gc.gridwidth = 1;
    // rtNumberLabel = ComponentFactory.getH4Label(
    // STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN);
    // rtNumberLabel.setHorizontalAlignment(JLabel.CENTER);
    // mainPanel.add(rtNumberLabel, gc);
    //
    // gc.gridwidth = GridBagConstraints.REMAINDER;
    // rtNameLabel = ComponentFactory.getH5Label(
    // STLConstants.K0050_ROUTERS.getValue(), Font.PLAIN);
    // rtNameLabel.setVerticalAlignment(JLabel.BOTTOM);
    // mainPanel.add(rtNameLabel, gc);

    add(mainPanel, BorderLayout.CENTER);

    JPanel bottomPanel = new JPanel(new GridBagLayout());
    bottomPanel.setOpaque(false);
    bottomPanel.setBorder(BorderFactory.createMatteBorder(1, 0, 0, 0, UIConstants.INTEL_BORDER_GRAY));
    gc = new GridBagConstraints();
    gc.insets = new Insets(0, 5, 1, 5);
    gc.fill = GridBagConstraints.BOTH;
    gc.weightx = 1;
    gc.gridheight = 2;
    otherPortsLabel = ComponentFactory.getH1Label(STLConstants.K0039_NOT_AVAILABLE.getValue(), Font.PLAIN);
    otherPortsLabel.setForeground(UIConstants.INTEL_GRAY);
    otherPortsLabel.setHorizontalAlignment(JLabel.RIGHT);
    bottomPanel.add(otherPortsLabel, gc);

    gc.gridwidth = GridBagConstraints.REMAINDER;
    gc.gridheight = 1;
    gc.weightx = 0;
    gc.weighty = 1;
    JLabel label = ComponentFactory.getH4Label(STLConstants.K1026_PORT_RESOURCE.getValue(), Font.PLAIN);
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setVerticalAlignment(JLabel.BOTTOM);
    bottomPanel.add(label, gc);

    gc.weighty = 0;
    label = ComponentFactory.getH4Label(STLConstants.K2077_NOT_IN_FABRIC.getValue(), Font.PLAIN);
    label.setHorizontalAlignment(JLabel.LEFT);
    label.setVerticalAlignment(JLabel.BOTTOM);
    bottomPanel.add(label, gc);
    add(bottomPanel, BorderLayout.SOUTH);
}

From source file:com.polivoto.vistas.Charts.java

public void getBotonesPreguntas(JPanel botones) {
    GridBagConstraints gridBagConstraints;
    boolean first = false;
    botones.removeAll();/*from   w w w  .ja  v  a2 s. c o  m*/
    JPanel panelRelleno = new JPanel(new BorderLayout(20, 20));
    panelRelleno.setBackground(Color.white);
    JPanel panelContainer = new JPanel(new GridLayout(0, 1, 30, 30));
    panelContainer.setBackground(Color.white);
    botones.setPreferredSize(new Dimension(250, 0));
    botones.setLayout(new GridBagLayout());
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.1;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    botones.add(panelContainer, gridBagConstraints);
    gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 1;
    gridBagConstraints.fill = GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 0.1;
    gridBagConstraints.weighty = 0.9;
    gridBagConstraints.insets = new java.awt.Insets(5, 5, 5, 5);
    botones.add(panelRelleno, gridBagConstraints);
    JLabel labelPreguntas = new JLabel("PREGUNTAS");
    labelPreguntas.setFont(new Font("Roboto", 1, 24));
    labelPreguntas.setHorizontalAlignment(0);
    labelPreguntas.setForeground(new Color(137, 36, 31));
    panelContainer.add(labelPreguntas);

    for (Pregunta pregunta : votacion.getPreguntas()) {
        Boton boton = new Boton("<html><div align=center>" + pregunta.getTitulo() + "</html>") {

            @Override
            public void botonClicked(Boton e) {
                crearGrafica(pregunta);
                botonActual = e;
            }
        };
        boton.setPreferredSize(new Dimension(200, 0));

        panelContainer.add(boton);
        if (!first) {
            botonActual = boton;
            first = true;
        }
    }

    botones.repaint();
    botones.revalidate();

}

From source file:de.unidue.inf.is.ezdl.gframedl.components.AboutDialog.java

private JPanel getContent() {
    JPanel panel = new JPanel(new GridBagLayout());

    JLabel iconLabel = new JLabel(new ImageIcon(Images.LOGO_EZDL_LARGE_SINGLE.getImage()));

    JTextArea licenseTextArea = new JTextArea(licenseText);
    licenseTextArea.setEditable(false);//from  w  w  w  .java 2  s . c o m
    licenseTextArea.setLineWrap(true);
    licenseTextArea.setWrapStyleWord(true);
    licenseTextArea.setOpaque(false);
    licenseTextArea.setBorder(BorderFactory.createEmptyBorder());
    JScrollPane licenseScrollPane = new JScrollPane(licenseTextArea);

    JTable propertiesTable = new JTable(tableModel);
    propertiesTable.setBackground(Color.WHITE);
    propertiesTable.setShowGrid(false);
    JScrollPane propertiesScrollPane = new JScrollPane(propertiesTable);
    propertiesScrollPane.setBackground(Color.WHITE);
    propertiesScrollPane.getViewport().setBackground(Color.WHITE);

    JButton closeButton = new JButton(I18nSupport.getInstance().getLocString("ezdl.controls.close"));
    closeButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            dispose();
        }
    });

    JTabbedPane tabbedPane = new JTabbedPane();
    tabbedPane.addTab(I18nSupport.getInstance().getLocString("ezdl.licence"), licenseScrollPane);
    tabbedPane.addTab(I18nSupport.getInstance().getLocString("ezdl.properties"), propertiesScrollPane);
    tabbedPane.setBackground(Color.WHITE);

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(0, 0, 0, 0);
    c.anchor = GridBagConstraints.CENTER;
    panel.add(iconLabel, c);

    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.fill = GridBagConstraints.BOTH;
    c.insets = new Insets(10, 20, 10, 20);
    panel.add(tabbedPane, c);

    c.gridy = 2;
    c.fill = GridBagConstraints.NONE;
    c.weighty = 0;
    c.insets = new Insets(0, 20, 10, 20);
    panel.add(closeButton, c);

    panel.setBackground(Color.WHITE);

    return panel;
}

From source file:be.ac.ua.comp.scarletnebula.gui.ServerCellRenderer.java

private JPanel createServerPanel(final Server server, final JList list, final int index,
        final boolean isSelected) {
    final JXPanel p = new JXPanel();
    p.setLayout(new GridBagLayout());
    final Color background = Colors.alpha(getBackgroundColor(list, index, isSelected), 0.4f);

    p.setBackground(background);//from   ww w. jav a  2s.co  m

    Color color1 = Colors.White.color(0.5f);
    Color color2 = Colors.Gray.color(0.95f);

    final Point2D start = new Point2D.Float(0, 0);
    Point2D stop = new Point2D.Float(150, 500);

    if (server != null && !server.sshWillFail() && server.getServerStatistics() != null) {
        final ServerStatisticsManager manager = server.getServerStatistics();
        final Datastream.WarnLevel warnlevel = manager.getHighestWarnLevel();

        if (warnlevel == Datastream.WarnLevel.HIGH) {
            color1 = Colors.Red.alpha(0.2f);
            color2 = Colors.Red.alpha(0.8f);
            stop = new Point2D.Float(500, 2);
        } else if (warnlevel == Datastream.WarnLevel.MEDIUM) {
            color1 = Colors.Orange.alpha(0.3f);
            color2 = Colors.Orange.alpha(0.8f);
            stop = new Point2D.Float(500, 2);
        } else if (warnlevel == Datastream.WarnLevel.LOW) {
            color1 = Colors.Orange.alpha(0.2f);
            color2 = Colors.Orange.alpha(0.4f);
            stop = new Point2D.Float(500, 2);
        }
    }

    final LinearGradientPaint gradientPaint = new LinearGradientPaint(start, stop, new float[] { 0.0f, 1.0f },
            new Color[] { color1, color2 });
    final MattePainter mattePainter = new MattePainter(gradientPaint, true);
    p.setBackgroundPainter(mattePainter);

    if (isSelected) {
        p.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(UIManager.getColor("List.background"), 2),
                BorderFactory.createBevelBorder(BevelBorder.LOWERED)));
    } else {
        p.setBorder(BorderFactory.createCompoundBorder(
                BorderFactory.createLineBorder(UIManager.getColor("List.background"), 2),
                BorderFactory.createEtchedBorder()));

    }

    return p;
}

From source file:cool.pandora.modeller.ui.jpanel.iiif.PatchCanvasFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from ww  w  .j  a  va  2 s. c  o m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchCanvasFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Canvases")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = IIIFObjectURI.getCanvasContainerURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (final Exception e) {
        log.error("Failed to set url label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.iiif.CreateListsFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from w  w  w.j a  v a 2  s  .c o  m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateListsFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create List in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = IIIFObjectURI.getListContainerURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (final Exception e) {
        log.error("Failed to set url label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:de.codesourcery.eve.skills.ui.components.impl.PriceHistoryComponent.java

@Override
protected JPanel createPanel() {

    dateRangeChooser.setModel(new DefaultComboBoxModel<DisplayRange>(Arrays.asList(DisplayRange.values())));

    dateRangeChooser.setSelectedItem(DisplayRange.WEEK);

    final JPanel controlPanel = new JPanel();
    controlPanel.setBackground(Color.WHITE);
    //      controlPanel.setLayout( new GridBagLayout() );
    //      controlPanel.add( dateRangeChooser , constraints().noResizing().end() );
    controlPanel.add(dateRangeChooser);/*from   ww w . j  ava  2  s  .  co  m*/

    dateRangeChooser.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            changeDateRange((DisplayRange) dateRangeChooser.getSelectedItem());
        }
    });

    // moving avg. chooser
    this.movingAverageChooser
            .setModel(new DefaultComboBoxModel<MovingAverage>(Arrays.asList(MovingAverage.values())));

    this.movingAverageChooser.setSelectedItem(MovingAverage.FIVE_DAYS);
    this.movingAverageChooser.addActionListener(actionListener);
    controlPanel.add(movingAverageChooser);

    final JPanel result = new JPanel();
    result.setBackground(Color.WHITE);
    result.setLayout(new GridBagLayout());

    final JPanel freeChartPanel = createFreeChartPanel(); // attention: chart must always be
    // populated AFTER date range chooser is set up because
    // this calculates earliest/latest dates from dataset

    //      panel.setPreferredSize( new Dimension(500,200 ) );

    result.add(controlPanel, constraints(0, 0).resizeBoth().weightX(0.2).weightY(0.2).end());
    result.add(freeChartPanel, constraints(0, 1).resizeBoth().end());

    return result;
}