Example usage for java.awt GridBagConstraints CENTER

List of usage examples for java.awt GridBagConstraints CENTER

Introduction

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

Prototype

int CENTER

To view the source code for java.awt GridBagConstraints CENTER.

Click Source Link

Document

Put the component in the center of its display area.

Usage

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

private void initComponents() {

    JPanel container = new JPanel();
    setContentPane(container);/*from  ww  w . j a  v  a  2 s . c o  m*/

    InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = container.getActionMap();

    container.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weighty = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;

    JLabel headerLabel = new JLabel("Select the time range and video channels to export.");
    headerLabel.setBackground(Color.white);
    headerLabel.setOpaque(true);
    headerLabel.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray),
                    BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(0, 0, 0, 0);
    container.add(headerLabel, c);

    JPanel timeButtonPanel = new JPanel();
    timeButtonPanel.setLayout(new BorderLayout());

    MouseListener hoverMouseListener = new MouseAdapter() {
        public void mouseEntered(MouseEvent e) {
            e.getComponent().setForeground(Color.red);
        }

        public void mouseExited(MouseEvent e) {
            e.getComponent().setForeground(Color.blue);
        }
    };

    startTimeButton = new JButton();
    startTimeButton.setBorder(null);
    startTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    startTimeButton.setForeground(Color.blue);
    startTimeButton.addMouseListener(hoverMouseListener);
    startTimeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            double startTime = DateTimeDialog.showDialog(ExportVideoDialog.this, timeSlider.getStart(),
                    timeSlider.getMinimum(), timeSlider.getEnd());
            if (startTime >= 0) {
                timeSlider.setStart(startTime);
            }
        }
    });
    timeButtonPanel.add(startTimeButton, BorderLayout.WEST);

    durationLabel = new JLabel();
    durationLabel.setHorizontalAlignment(JLabel.CENTER);
    timeButtonPanel.add(durationLabel, BorderLayout.CENTER);

    endTimeButton = new JButton();
    endTimeButton.setBorder(null);
    endTimeButton.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    endTimeButton.setForeground(Color.blue);
    endTimeButton.addMouseListener(hoverMouseListener);
    endTimeButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            double endTime = DateTimeDialog.showDialog(ExportVideoDialog.this, timeSlider.getEnd(),
                    timeSlider.getStart(), timeSlider.getMaximum());
            if (endTime >= 0) {
                timeSlider.setEnd(endTime);
            }
        }
    });
    timeButtonPanel.add(endTimeButton, BorderLayout.EAST);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(10, 10, 10, 10);
    container.add(timeButtonPanel, c);

    timeSlider = new TimeSlider();
    timeSlider.setValueChangeable(false);
    timeSlider.setValueVisible(false);
    timeSlider.addTimeAdjustmentListener(new TimeAdjustmentListener() {
        public void timeChanged(TimeEvent event) {
        }

        public void rangeChanged(TimeEvent event) {
            updateTimeRangeLabel();
        }

        public void boundsChanged(TimeEvent event) {
        }
    });
    updateTimeRangeLabel();
    updateTimeBounds();

    List<EventMarker> markers = rbnb.getMarkerManager().getMarkers();
    for (EventMarker marker : markers) {
        timeSlider.addMarker(marker);
    }

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(0, 10, 10, 10);
    container.add(timeSlider, c);

    JLabel numericHeaderLabel = new JLabel("Video Channels:");
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(0, 10, 10, 10);
    container.add(numericHeaderLabel, c);

    videoChannelList = new JList(videoChannelModel);
    videoChannelList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    videoChannelList.setCellRenderer(new CheckListRenderer());
    videoChannelList.setVisibleRowCount(10);
    videoChannelList.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            int index = videoChannelList.locationToIndex(e.getPoint());
            ExportChannel item = (ExportChannel) videoChannelList.getModel().getElementAt(index);
            item.setSelected(!item.isSelected());
            Rectangle rect = videoChannelList.getCellBounds(index, index);
            videoChannelList.repaint(rect);

            updateTimeBounds();
        }
    });
    JScrollPane scrollPane = new JScrollPane(videoChannelList);
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0;
    c.weighty = 1;
    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(0, 10, 10, 10);
    container.add(scrollPane, c);

    c.fill = GridBagConstraints.NONE;
    c.weightx = 0;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new java.awt.Insets(0, 10, 10, 5);
    container.add(new JLabel("Choose Directory: "), c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 1;
    c.gridy = 5;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.NORTHWEST;
    directoryTextField = new JTextField(20);
    c.insets = new java.awt.Insets(0, 0, 10, 5);
    container.add(directoryTextField, c);

    directoryTextField.setText(UIUtilities.getCurrentDirectory().getAbsolutePath());
    directoryButton = new JButton("Browse");
    directoryButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            File selectedDirectory = UIUtilities.getDirectory("Select export directory");
            if (selectedDirectory != null) {
                directoryTextField.setText(selectedDirectory.getAbsolutePath());
            }
        }
    });
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0;
    c.gridx = 2;
    c.gridy = 5;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new java.awt.Insets(0, 0, 10, 10);
    container.add(directoryButton, c);

    exportProgressBar = new JProgressBar(0, 100000);
    exportProgressBar.setStringPainted(true);
    exportProgressBar.setValue(0);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = GridBagConstraints.REMAINDER;
    ;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new java.awt.Insets(0, 10, 10, 10);
    container.add(exportProgressBar, c);

    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout());

    Action exportAction = new AbstractAction() {
        /** serialization version identifier */
        private static final long serialVersionUID = 1547500154252213911L;

        public void actionPerformed(ActionEvent e) {
            exportVideo();
        }
    };
    exportAction.putValue(Action.NAME, "Export");
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "export");
    actionMap.put("export", exportAction);
    exportButton = new JButton(exportAction);
    panel.add(exportButton);

    Action cancelAction = new AbstractAction() {
        /** serialization version identifier */
        private static final long serialVersionUID = -7440298547807878651L;

        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    };
    cancelAction.putValue(Action.NAME, "Cancel");
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel");
    actionMap.put("cancel", cancelAction);
    cancelButton = new JButton(cancelAction);
    panel.add(cancelButton);

    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 7;
    c.gridwidth = GridBagConstraints.REMAINDER;
    ;
    c.anchor = GridBagConstraints.LINE_END;
    c.insets = new java.awt.Insets(0, 0, 10, 5);
    container.add(panel, c);

    pack();
    if (getWidth() < 600) {
        setSize(600, getHeight());
    }

    directoryTextField.requestFocusInWindow();

    setLocationByPlatform(true);
    setVisible(true);
}

From source file:com.sec.ose.osi.ui.frm.login.JPanLogin.java

/**
 * This method initializes jPanel1   /*from ww w  .  ja  va 2  s . c om*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelForUserInfo() {
    if (jPanelForUserInfo == null) {
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints5.gridx = -1;
        gridBagConstraints5.gridy = -1;
        gridBagConstraints5.gridwidth = 1;
        gridBagConstraints5.anchor = GridBagConstraints.CENTER;
        gridBagConstraints5.weightx = 1.0;
        gridBagConstraints5.weighty = 0.0;
        //gridBagConstraints5.insets = new Insets(10, 10, 0, 20);
        jPanelForUserInfo = new JPanel();
        jPanelForUserInfo.setLayout(new GridBagLayout());
        jPanelForUserInfo.setBorder(BorderFactory.createTitledBorder(null, "User Info",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelForUserInfo.add(getJPanelUserInfo(), gridBagConstraints5);
    }
    return jPanelForUserInfo;
}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java

private JPanel createInstantDataPanel() {
    I18nLabel timeLabel = new I18nLabel("dive.time");
    instantDepthLabel = new JLabel();
    setDephtLabelText();/* w w w .j a  v  a  2s.c o  m*/

    instantTimeTf = new JTextField(6);
    instantTimeTf.setText(null);
    instantTimeTf.setEditable(false);
    instantTimeTf.setFocusable(false);

    instantDepthTf = new JTextField(6);
    instantDepthTf.setText(null);
    instantDepthTf.setEditable(false);
    instantDepthTf.setFocusable(false);

    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(3, 3, 3, 3);

    JPanel instantDataPanel = new DetailPanel();
    instantDataPanel.setLayout(new GridBagLayout());
    instantDataPanel.setOpaque(false);

    GridBagLayoutManager.addComponent(instantDataPanel, timeLabel, c, 0, 0, 1, 1, 0, 0, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    GridBagLayoutManager.addComponent(instantDataPanel, instantTimeTf, c, 1, 0, 1, 1, 1, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(instantDataPanel, instantDepthLabel, c, 0, 1, 1, 1, 0, 0,
            GridBagConstraints.NONE, GridBagConstraints.WEST);
    GridBagLayoutManager.addComponent(instantDataPanel, instantDepthTf, c, 1, 1, 1, 1, 1, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    return instantDataPanel;
}

From source file:com.sshtools.common.ui.SshToolsApplication.java

public void openChangelog(Component parent) {

    JPanel p = new JPanel(new GridBagLayout());
    p.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    GridBagConstraints gBC = new GridBagConstraints();
    gBC.anchor = GridBagConstraints.CENTER;
    gBC.fill = GridBagConstraints.HORIZONTAL;
    gBC.insets = new Insets(1, 1, 1, 1);

    JLabel a = new JLabel(getApplicationName());
    a.setFont(a.getFont().deriveFont(24f));
    UIUtil.jGridBagAdd(p, a, gBC, GridBagConstraints.REMAINDER);

    String changelog = "";
    try {/*  w w w  .ja v  a 2 s . com*/
        BufferedReader br = new BufferedReader(
                new InputStreamReader(getClass().getResourceAsStream("/changelog")));
        String line = br.readLine();
        while (line != null) {
            changelog += line + "\n";
            line = br.readLine();
        }
        br.close();
    } catch (Exception e) {
        changelog = "<Error opening changelog>\n";
    }

    javax.swing.JTextArea message = new javax.swing.JTextArea(changelog);
    message.setEditable(false);
    message.setBorder(javax.swing.BorderFactory.createEmptyBorder(4, 4, 4, 4));
    javax.swing.JLabel jl = new javax.swing.JLabel();
    message.setFont(jl.getFont());
    message.setBackground(jl.getBackground());

    //   MultilineLabel x = new MultilineLabel(changelog);
    //   x.setBorder(BorderFactory.createEmptyBorder(8, 0, 8, 0));
    //   x.setFont(x.getFont().deriveFont(12f));   
    javax.swing.JScrollPane scrollPane = new javax.swing.JScrollPane();
    scrollPane.getViewport().add(message);
    scrollPane.setSize(400, 200);
    scrollPane.setPreferredSize(new java.awt.Dimension(400, 200));
    UIUtil.jGridBagAdd(p, scrollPane, gBC, GridBagConstraints.REMAINDER);

    JOptionPane.showMessageDialog(parent, p, "Change log", JOptionPane.PLAIN_MESSAGE,
            getApplicationLargeIcon());
}

From source file:org.eobjects.datacleaner.windows.OpenAnalysisJobAsTemplateDialog.java

@Override
protected JComponent getDialogContent() {
    final DCPanel panel = new DCPanel();

    int row = 0;//from  ww  w  .  j av a  2  s  . c  o  m
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>Original value:</b></html>"), panel, 1, row);
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>New/mapped value:</b></html>"), panel, 2, row);

    row++;
    WidgetUtils.addToGridBag(new JLabel(imageManager.getImageIcon("images/model/datastore.png")), panel, 0,
            row);
    WidgetUtils.addToGridBag(DCLabel.bright(_metadata.getDatastoreName()), panel, 1, row,
            GridBagConstraints.WEST);

    DCPanel datastoreButtonPanel = new DCPanel();
    datastoreButtonPanel.setLayout(new HorizontalLayout(0));
    datastoreButtonPanel.add(_datastoreCombobox);
    datastoreButtonPanel.add(Box.createHorizontalStrut(4));
    datastoreButtonPanel.add(_autoMapButton);

    WidgetUtils.addToGridBag(datastoreButtonPanel, panel, 2, row, GridBagConstraints.WEST);

    Set<String> tableNames = _sourceColumnComboBoxes.keySet();
    for (final String tableName : tableNames) {
        row++;
        final JLabel tableLabel = DCLabel.bright("<html><b>" + tableName + "</b></html>");
        tableLabel.setIcon(imageManager.getImageIcon("images/model/table.png", IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        final JButton clearButton = new JButton("Clear");
        clearButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
                for (SourceColumnComboBox comboBox : comboBoxes) {
                    comboBox.setModel(_datastore, false);
                }
            }
        });
        final DCPanel clearButtonPanel = new DCPanel();
        clearButtonPanel.add(clearButton);
        WidgetUtils.addToGridBag(clearButtonPanel, panel, 2, row, GridBagConstraints.CENTER);

        final List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
        for (SourceColumnComboBox comboBox : comboBoxes) {
            row++;
            WidgetUtils.addToGridBag(
                    new JLabel(imageManager.getImageIcon("images/model/column.png", IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(comboBox.getName()), panel, 1, row,
                    GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(comboBox, panel, 2, row, GridBagConstraints.WEST);
        }
    }
    row++;

    if (!_variableTextFields.isEmpty()) {
        final JLabel tableLabel = DCLabel.bright("<html><b>Job-level variables</b></html>");
        tableLabel.setIcon(
                imageManager.getImageIcon("images/filetypes/analysis_job.png", IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        for (Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
            row++;
            String variableId = entry.getKey();
            JXTextField textField = entry.getValue();

            WidgetUtils.addToGridBag(
                    new JLabel(
                            imageManager.getImageIcon("images/model/variable.png", IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(variableId), panel, 1, row, GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(textField, panel, 2, row, GridBagConstraints.WEST);
        }
        row++;
    }

    final DCPanel openButtonPanel = new DCPanel();
    openButtonPanel.add(_openButton);
    WidgetUtils.addToGridBag(openButtonPanel, panel, 2, row, GridBagConstraints.EAST);

    return WidgetUtils.scrolleable(panel);
}

From source file:cool.pandora.modeller.ui.jpanel.base.BagView.java

/**
 * This populates the default view descriptor declared as the startingPageId
 * property in the richclient-application-context.xml file.
 *
 * @return bagViewPanel/*from ww  w.j  ava2  s. c om*/
 */
@Override
protected JComponent createControl() {
    bag = new DefaultBag();

    final String userHomeDir = System.getProperty("user.home");
    display("createControl - User Home Path: " + userHomeDir);

    initializeCommands();

    final ApplicationServices services = this.getApplicationServices();

    final Color bgColor = new Color(20, 20, 100);
    topButtonPanel = createTopButtonPanel();
    topButtonPanel.setBackground(bgColor);

    infoInputPane = new InfoFormsPane(this);
    infoInputPane.bagInfoInputPane.enableForms(false);
    final JSplitPane bagPanel = createBagPanel();

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = LayoutUtil.buildGridBagConstraints(0, 0, 1, 1, 50, 100,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    layout.setConstraints(bagPanel, glbc);

    final JPanel mainPanel = new JPanel(layout);
    mainPanel.add(bagPanel);

    final JPanel bagViewPanel = new JPanel(new BorderLayout(2, 2));
    bagViewPanel.setBackground(bgColor);
    bagViewPanel.add(mainPanel, BorderLayout.CENTER);
    return bagViewPanel;
}

From source file:org.datacleaner.windows.OpenAnalysisJobAsTemplateDialog.java

@Override
protected JComponent getDialogContent() {
    final DCPanel panel = new DCPanel();

    int row = 0;/*from  ww w .  jav a  2 s  .  c  o m*/
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>Original value:</b></html>"), panel, 1, row);
    WidgetUtils.addToGridBag(DCLabel.bright("<html><b>New/mapped value:</b></html>"), panel, 2, row);

    row++;
    WidgetUtils.addToGridBag(new JLabel(imageManager.getImageIcon(IconUtils.GENERIC_DATASTORE_IMAGEPATH)),
            panel, 0, row);
    WidgetUtils.addToGridBag(DCLabel.bright(_metadata.getDatastoreName()), panel, 1, row,
            GridBagConstraints.WEST);

    DCPanel datastoreButtonPanel = new DCPanel();
    datastoreButtonPanel.setLayout(new HorizontalLayout(0));
    datastoreButtonPanel.add(_datastoreCombobox);
    datastoreButtonPanel.add(Box.createHorizontalStrut(4));
    datastoreButtonPanel.add(_autoMapButton);

    WidgetUtils.addToGridBag(datastoreButtonPanel, panel, 2, row, GridBagConstraints.WEST);

    Set<String> tableNames = _sourceColumnComboBoxes.keySet();
    for (final String tableName : tableNames) {
        row++;
        final JLabel tableLabel = DCLabel.bright("<html><b>" + tableName + "</b></html>");
        tableLabel.setIcon(imageManager.getImageIcon(IconUtils.MODEL_TABLE, IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        final JButton clearButton = WidgetFactory.createDefaultButton("Clear");
        clearButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
                for (SourceColumnComboBox comboBox : comboBoxes) {
                    comboBox.setModel(_datastore, false);
                }
            }
        });
        final DCPanel clearButtonPanel = new DCPanel();
        clearButtonPanel.add(clearButton);
        WidgetUtils.addToGridBag(clearButtonPanel, panel, 2, row, GridBagConstraints.CENTER);

        final List<SourceColumnComboBox> comboBoxes = _sourceColumnComboBoxes.get(tableName);
        for (SourceColumnComboBox comboBox : comboBoxes) {
            row++;
            WidgetUtils.addToGridBag(
                    new JLabel(imageManager.getImageIcon(IconUtils.MODEL_COLUMN, IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(comboBox.getName()), panel, 1, row,
                    GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(comboBox, panel, 2, row, GridBagConstraints.WEST);
        }
    }
    row++;

    if (!_variableTextFields.isEmpty()) {
        final JLabel tableLabel = DCLabel.bright("<html><b>Job-level variables</b></html>");
        tableLabel.setIcon(imageManager.getImageIcon(IconUtils.MODEL_JOB, IconUtils.ICON_SIZE_SMALL));
        WidgetUtils.addToGridBag(tableLabel, panel, 0, row, 2, 1, GridBagConstraints.WEST);

        for (Entry<String, JXTextField> entry : _variableTextFields.entrySet()) {
            row++;
            String variableId = entry.getKey();
            JXTextField textField = entry.getValue();

            WidgetUtils.addToGridBag(
                    new JLabel(
                            imageManager.getImageIcon("images/model/variable.png", IconUtils.ICON_SIZE_SMALL)),
                    panel, 0, row);
            WidgetUtils.addToGridBag(DCLabel.bright(variableId), panel, 1, row, GridBagConstraints.WEST);
            WidgetUtils.addToGridBag(textField, panel, 2, row, GridBagConstraints.WEST);
        }
        row++;
    }

    final DCPanel openButtonPanel = new DCPanel();
    openButtonPanel.add(_openButton);
    WidgetUtils.addToGridBag(openButtonPanel, panel, 2, row, GridBagConstraints.EAST);

    return WidgetUtils.scrolleable(panel);
}

From source file:junk.gui.HazardDataSetCalcCondorApp.java

private void jbInit() throws Exception {
    border1 = new EtchedBorder(EtchedBorder.RAISED, new Color(248, 254, 255), new Color(121, 124, 136));
    this.setSize(new Dimension(564, 834));
    this.getContentPane().setLayout(borderLayout1);
    mainPanel.setBorder(border1);/*from   w  w w  . ja v  a  2 s  .  co  m*/
    mainPanel.setLayout(gridBagLayout);
    mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    buttonPanel.setLayout(borderLayout3);
    eqkRupPanel.setLayout(gridBagLayout);
    imr_IMTSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
    imrPanel.setLayout(borderLayout2);
    imtPanel.setLayout(gridBagLayout);
    buttonPanel.setMinimumSize(new Dimension(391, 50));
    gridRegionSitePanel.setLayout(gridBagLayout);
    imrSelectionPanel.setLayout(gridBagLayout);
    //controlComboBox.setBackground(Color.white);
    dataPanel.setLayout(gridBagLayout4);
    imgPanel.setLayout(gridBagLayout7);
    addButton.setBorder(null);
    addButton.setText("Start Calc");
    addButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addButton_actionPerformed(e);
        }
    });
    controlComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(ActionEvent e) {
            controlComboBox_actionPerformed(e);
        }
    });
    emailLabel.setText("Email:");
    datasetLabel.setText("Dataset Id:");
    emailText.setText("");
    dataPanel.setMinimumSize(new Dimension(548, 150));
    dataPanel.setPreferredSize(new Dimension(549, 150));
    this.getContentPane().add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(mainSplitPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(1, 1, 2, 3), 0, 431));
    mainSplitPane.add(buttonPanel, JSplitPane.BOTTOM);
    buttonPanel.add(dataPanel, BorderLayout.CENTER);
    dataPanel.add(datasetIdText, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(34, 19, 81, 0), 162, 7));
    dataPanel.add(datasetLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(34, 7, 81, 0), 28, 10));
    dataPanel.add(emailText, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(43, 19, 0, 0), 162, 7));
    dataPanel.add(controlComboBox, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(43, 48, 0, 24), 35, 2));
    dataPanel.add(emailLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(43, 7, 0, 15), 43, 12));
    dataPanel.add(addButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(27, 51, 81, 24), 79, 12));
    buttonPanel.add(imgPanel, BorderLayout.SOUTH);
    imgPanel.add(imgLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(15, 235, 3, 246), 57, 28));
    mainSplitPane.add(parameterTabbedPanel, JSplitPane.TOP);
    imr_IMTSplit.add(imtPanel, JSplitPane.BOTTOM);
    imr_IMTSplit.add(imrSelectionPanel, JSplitPane.TOP);
    imrPanel.add(imr_IMTSplit, BorderLayout.CENTER);
    parameterTabbedPanel.addTab("Intensity-Measure Relationship", imrPanel);
    parameterTabbedPanel.addTab("Region & Site Params", gridRegionSitePanel);
    parameterTabbedPanel.addTab("Earthquake Rupture Forecast", eqkRupPanel);
    mainSplitPane.setDividerLocation(550);
    imr_IMTSplit.setDividerLocation(300);
    imgLabel.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            imgLabel_mouseClicked(e);
        }
    });

}

From source file:gov.loc.repository.bagger.ui.SaveBagFrame.java

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

    TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from  w w w  .  j av  a 2 s .co  m*/
    JPanel pageControl = new JPanel(new BorderLayout());
    JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("SaveBagFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Define the Bag settings")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    JPanel contentPane = new JPanel();

    // TODO: Add bag name field
    // TODO: Add save name file selection button
    JLabel location = new JLabel("Save in:");
    browseButton = new JButton(getMessage("bag.button.browse"));
    browseButton.addActionListener(new SaveBagAsHandler());
    browseButton.setEnabled(true);
    browseButton.setToolTipText(getMessage("bag.button.browse.help"));
    String fileName = "";
    DefaultBag bag = bagView.getBag();
    if (bag != null) {
        fileName = bag.getName();
    }
    bagNameField = new JTextField(fileName);
    bagNameField.setCaretPosition(fileName.length());
    bagNameField.setEditable(false);
    bagNameField.setEnabled(false);

    // Holey bag control
    JLabel holeyLabel = new JLabel(bagView.getPropertyMessage("bag.label.isholey"));
    holeyLabel.setToolTipText(bagView.getPropertyMessage("bag.isholey.help"));
    holeyCheckbox = new JCheckBox(bagView.getPropertyMessage("bag.checkbox.isholey"));
    holeyCheckbox.setBorder(border);
    holeyCheckbox.setSelected(bag.isHoley());
    holeyCheckbox.addActionListener(new HoleyBagHandler());
    holeyCheckbox.setToolTipText(bagView.getPropertyMessage("bag.isholey.help"));

    urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    urlLabel.setEnabled(bag.isHoley());
    urlField = new JTextField("");
    try {
        urlField.setText(bag.getFetch().getBaseURL());
    } catch (Exception e) {
        log.error("fetch baseURL: " + e.getMessage());
    }
    urlField.setEnabled(false);

    // TODO: Add format label
    JLabel serializeLabel;
    serializeLabel = new JLabel(getMessage("bag.label.ispackage"));
    serializeLabel.setToolTipText(getMessage("bag.serializetype.help"));

    // TODO: Add format selection panel
    noneButton = new JRadioButton(getMessage("bag.serializetype.none"));
    noneButton.setEnabled(true);
    AbstractAction serializeListener = new SerializeBagHandler();
    noneButton.addActionListener(serializeListener);
    noneButton.setToolTipText(getMessage("bag.serializetype.none.help"));

    zipButton = new JRadioButton(getMessage("bag.serializetype.zip"));
    zipButton.setEnabled(true);
    zipButton.addActionListener(serializeListener);
    zipButton.setToolTipText(getMessage("bag.serializetype.zip.help"));

    /*
    tarButton = new JRadioButton(getMessage("bag.serializetype.tar"));
    tarButton.setEnabled(true);
    tarButton.addActionListener(serializeListener);
    tarButton.setToolTipText(getMessage("bag.serializetype.tar.help"));
            
    tarGzButton = new JRadioButton(getMessage("bag.serializetype.targz"));
    tarGzButton.setEnabled(true);
    tarGzButton.addActionListener(serializeListener);
    tarGzButton.setToolTipText(getMessage("bag.serializetype.targz.help"));
            
    tarBz2Button = new JRadioButton(getMessage("bag.serializetype.tarbz2"));
    tarBz2Button.setEnabled(true);
    tarBz2Button.addActionListener(serializeListener);
    tarBz2Button.setToolTipText(getMessage("bag.serializetype.tarbz2.help"));
    */

    short mode = bag.getSerialMode();
    if (mode == DefaultBag.NO_MODE) {
        this.noneButton.setEnabled(true);
    } else if (mode == DefaultBag.ZIP_MODE) {
        this.zipButton.setEnabled(true);
    } /*else if (mode == DefaultBag.TAR_MODE) {
       this.tarButton.setEnabled(true);
      } else if (mode == DefaultBag.TAR_GZ_MODE) {
       this.tarGzButton.setEnabled(true);
      } else if (mode == DefaultBag.TAR_BZ2_MODE) {
       this.tarBz2Button.setEnabled(true);
      } */else {
        this.noneButton.setEnabled(true);
    }

    ButtonGroup serializeGroup = new ButtonGroup();
    serializeGroup.add(noneButton);
    serializeGroup.add(zipButton);
    //serializeGroup.add(tarButton);
    //serializeGroup.add(tarGzButton);
    //serializeGroup.add(tarBz2Button);
    serializeGroupPanel = new JPanel(new FlowLayout());
    serializeGroupPanel.add(serializeLabel);
    serializeGroupPanel.add(noneButton);
    serializeGroupPanel.add(zipButton);
    //serializeGroupPanel.add(tarButton);
    //serializeGroupPanel.add(tarGzButton);
    //serializeGroupPanel.add(tarBz2Button);
    serializeGroupPanel.setBorder(border);
    serializeGroupPanel.setEnabled(true);
    serializeGroupPanel.setToolTipText(bagView.getPropertyMessage("bag.serializetype.help"));

    JLabel tagLabel = new JLabel(getMessage("bag.label.istag"));
    tagLabel.setToolTipText(getMessage("bag.label.istag.help"));
    isTagCheckbox = new JCheckBox();
    isTagCheckbox.setBorder(border);
    isTagCheckbox.setSelected(bag.isBuildTagManifest());
    isTagCheckbox.addActionListener(new TagManifestHandler());
    isTagCheckbox.setToolTipText(getMessage("bag.checkbox.istag.help"));

    JLabel tagAlgorithmLabel = new JLabel(getMessage("bag.label.tagalgorithm"));
    tagAlgorithmLabel.setToolTipText(getMessage("bag.label.tagalgorithm.help"));
    ArrayList<String> listModel = new ArrayList<String>();
    for (Algorithm algorithm : Algorithm.values()) {
        listModel.add(algorithm.bagItAlgorithm);
    }
    tagAlgorithmList = new JComboBox(listModel.toArray());
    tagAlgorithmList.setName(getMessage("bag.tagalgorithmlist"));
    tagAlgorithmList.setSelectedItem(bag.getTagManifestAlgorithm());
    tagAlgorithmList.addActionListener(new TagAlgorithmListHandler());
    tagAlgorithmList.setToolTipText(getMessage("bag.tagalgorithmlist.help"));

    JLabel payloadLabel = new JLabel(getMessage("bag.label.ispayload"));
    payloadLabel.setToolTipText(getMessage("bag.ispayload.help"));
    isPayloadCheckbox = new JCheckBox();
    isPayloadCheckbox.setBorder(border);
    isPayloadCheckbox.setSelected(bag.isBuildPayloadManifest());
    isPayloadCheckbox.addActionListener(new PayloadManifestHandler());
    isPayloadCheckbox.setToolTipText(getMessage("bag.ispayload.help"));

    JLabel payAlgorithmLabel = new JLabel(bagView.getPropertyMessage("bag.label.payalgorithm"));
    payAlgorithmLabel.setToolTipText(getMessage("bag.payalgorithm.help"));
    payAlgorithmList = new JComboBox(listModel.toArray());
    payAlgorithmList.setName(getMessage("bag.payalgorithmlist"));
    payAlgorithmList.setSelectedItem(bag.getPayloadManifestAlgorithm());
    payAlgorithmList.addActionListener(new PayAlgorithmListHandler());
    payAlgorithmList.setToolTipText(getMessage("bag.payalgorithmlist.help"));

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

    int row = 0;

    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(location, glbc);
    panel.add(location);

    buildConstraints(glbc, 2, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.EAST);
    glbc.ipadx = 5;
    layout.setConstraints(browseButton, glbc);
    glbc.ipadx = 0;
    panel.add(browseButton);

    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    glbc.ipadx = 5;
    layout.setConstraints(bagNameField, glbc);
    glbc.ipadx = 0;
    panel.add(bagNameField);

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(holeyLabel, glbc);
    panel.add(holeyLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.WEST, GridBagConstraints.WEST);
    layout.setConstraints(holeyCheckbox, glbc);
    panel.add(holeyCheckbox);
    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);
    layout.setConstraints(serializeLabel, glbc);
    panel.add(serializeLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    layout.setConstraints(serializeGroupPanel, glbc);
    panel.add(serializeGroupPanel);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagLabel, glbc);
    panel.add(tagLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(isTagCheckbox, glbc);
    panel.add(isTagCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagAlgorithmLabel, glbc);
    panel.add(tagAlgorithmLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(tagAlgorithmList, glbc);
    panel.add(tagAlgorithmList);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(payloadLabel, glbc);
    panel.add(payloadLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(isPayloadCheckbox, glbc);
    panel.add(isPayloadCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(payAlgorithmLabel, glbc);
    panel.add(payAlgorithmLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(payAlgorithmList, glbc);
    panel.add(payAlgorithmList);
    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);
    JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:course_generator.param.frmEditCurve.java

/**
 * This method is called to initialize the form.
 *///w w  w  .  j  av a 2  s .  co  m
private void initComponents() {
    int line = 0;

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
    setTitle(bundle.getString("frmEditCurve.title"));
    setPreferredSize(new Dimension(1200, 600));
    setAlwaysOnTop(true);
    setResizable(false);
    setType(java.awt.Window.Type.UTILITY);
    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            formWindowClosing(evt);
        }
    });

    // -- Layout
    // ------------------------------------------------------------
    Container paneGlobal = getContentPane();
    paneGlobal.setLayout(new GridBagLayout());

    //-- Curves list
    ListCurves = new javax.swing.JList<>();
    model = new ParamListModel();
    ListCurves.setModel(model);
    ListCurves.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
    ListCurves.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            SelectCurve();
        }
    });
    jScrollPaneCurves = new javax.swing.JScrollPane();
    jScrollPaneCurves.setViewportView(ListCurves);

    Utils.addComponent(paneGlobal, jScrollPaneCurves, 0, 0, 1, 4, 0.5, 1, 10, 10, 0, 0,
            GridBagConstraints.PAGE_START, GridBagConstraints.BOTH);

    //-- Curve management toolbar
    CreateCurvesToolbar();
    Utils.addComponent(paneGlobal, ToolBarAction, 1, 0, 1, 4, 0, 0, 10, 0, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    lbSelectedCurve = new javax.swing.JLabel();
    lbSelectedCurve.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lbSelectedCurve.setText("Selected");
    lbSelectedCurve.setHorizontalAlignment(JLabel.LEFT);
    Utils.addComponent(paneGlobal, lbSelectedCurve, 2, 0, GridBagConstraints.REMAINDER, 1, 1, 0, 10, 0, 5, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);

    //-- Curve name
    lbName = new javax.swing.JLabel();
    lbName.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lbName.setText(" " + bundle.getString("frmEditCurve.lbName.text") + " ");
    Utils.addComponent(paneGlobal, lbName, 2, 1, 1, 1, 0, 0, 0, 0, 5, 0, GridBagConstraints.BASELINE_LEADING,
            GridBagConstraints.HORIZONTAL);

    lbNameVal = new javax.swing.JLabel();
    lbNameVal.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    Utils.addComponent(paneGlobal, lbNameVal, 3, 1, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 5, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    //-- Curve comment
    lbComment = new javax.swing.JLabel();
    lbComment.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    lbComment.setText(" " + bundle.getString("frmEditCurve.lbComment.text") + " ");
    Utils.addComponent(paneGlobal, lbComment, 2, 2, 1, 1, 0, 0, 0, 0, 5, 0, GridBagConstraints.BASELINE_LEADING,
            GridBagConstraints.HORIZONTAL);

    tfComment = new JTextField();
    tfComment.setBorder(javax.swing.BorderFactory.createEtchedBorder());
    Utils.addComponent(paneGlobal, tfComment, 3, 2, GridBagConstraints.REMAINDER, 1, 1, 0, 0, 5, 5, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.HORIZONTAL);

    //-- Point list
    TablePoints = new javax.swing.JTable();
    TablePoints.setModel(tablemodel);//new ParamPointsModel(param));
    TablePoints.getTableHeader().setReorderingAllowed(false);
    TablePoints.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(java.awt.event.MouseEvent evt) {
            //            TableMainMouseClicked(evt);
        }
    });
    TablePoints.addKeyListener(new java.awt.event.KeyAdapter() {
        public void keyReleased(java.awt.event.KeyEvent evt) {
            //            TableMainKeyReleased(evt);
        }
    });

    jScrollPanePoint = new javax.swing.JScrollPane();
    jScrollPanePoint.setViewportView(TablePoints);
    Utils.addComponent(paneGlobal, jScrollPanePoint, 2, 3, 2, 1, 0.5, 0, 0, 0, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    //-- Edit toolbar
    CreateEditToolbar();
    Utils.addComponent(paneGlobal, ToolBarEdit, 4, 3, 1, 1, 0, 0, 0, 0, 0, 0,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);

    jPanelProfilChart = new ChartPanel(chart);
    Utils.addComponent(paneGlobal, jPanelProfilChart, 5, 3, 1, 1, 1, 0, 0, 0, 0, 10,
            GridBagConstraints.BASELINE_LEADING, GridBagConstraints.BOTH);
    CrosshairOverlay crosshairOverlay = new CrosshairOverlay();
    xCrosshair = new Crosshair(Double.NaN, Color.DARK_GRAY, new BasicStroke(0f));
    xCrosshair.setLabelVisible(true);
    xCrosshair.setLabelBackgroundPaint(Color.WHITE);

    yCrosshair = new Crosshair(Double.NaN, Color.DARK_GRAY, new BasicStroke(0f));
    yCrosshair.setLabelVisible(true);
    yCrosshair.setLabelBackgroundPaint(Color.WHITE);

    crosshairOverlay.addDomainCrosshair(xCrosshair);
    crosshairOverlay.addRangeCrosshair(yCrosshair);

    jPanelProfilChart.addOverlay(crosshairOverlay);
    jPanelProfilChart.setBackground(new java.awt.Color(255, 0, 51));
    jPanelProfilChart.addChartMouseListener(new ChartMouseListener() {
        @Override
        public void chartMouseClicked(ChartMouseEvent event) {

            ChartEntity chartentity = event.getEntity();
            if (chartentity instanceof XYItemEntity) {
                XYItemEntity e = (XYItemEntity) chartentity;
                XYDataset d = e.getDataset();
                int s = e.getSeriesIndex();
                int i = e.getItem();
                double x = d.getXValue(s, i);
                double y = d.getYValue(s, i);
                xCrosshair.setValue(x);
                yCrosshair.setValue(y);
            }
        }

        @Override
        public void chartMouseMoved(ChartMouseEvent event) {
        }
    });

    // == Bottom button
    // ===========================================================
    btOk = new javax.swing.JButton();
    btOk.setText(bundle.getString("frmEditCurve.btOk.text"));
    btOk.setIcon(new javax.swing.ImageIcon(getClass().getResource("/course_generator/images/valid.png")));
    btOk.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            RequestToClose();
        }
    });
    Utils.addComponent(paneGlobal, btOk, 0, 5, GridBagConstraints.REMAINDER, 1, 0, 0, 10, 0, 10, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE);

    // --
    pack();

    //-- Refresh the curve list
    RefreshCurveList();

    //-- Center the windows
    setLocationRelativeTo(null);
}