Example usage for java.awt GridBagConstraints BOTH

List of usage examples for java.awt GridBagConstraints BOTH

Introduction

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

Prototype

int BOTH

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

Click Source Link

Document

Resize the component both horizontally and vertically.

Usage

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/*  w  ww.  ja  v  a  2 s.  co  m*/
 */
@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:net.sourceforge.squirrel_sql.client.gui.ProgressAbortDialog.java

private void createGUI() {
    JPanel dialogPanel = new JPanel(new GridBagLayout());
    dialogPanel.setBorder(BorderFactory.createEmptyBorder(0, 10, 0, 10));
    GridBagConstraints c;//ww w. jav  a2 s  .  co  m

    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 0.5;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(4, 0, 4, 0);
    taskDescriptionComponent = createTaskDescripion();
    dialogPanel.add(taskDescriptionComponent, c);

    c.gridy++;
    JPanel progressPanel = new JPanel(new GridBagLayout());
    progressPanel.setMinimumSize(new Dimension(400, 200));
    progressPanel.setPreferredSize(new Dimension(400, 200));
    progressPanel.setBorder(BorderFactory.createTitledBorder("Progress"));
    dialogPanel.add(progressPanel, c);

    c.gridy = 0;
    c.gridx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.insets = new Insets(4, 10, 4, 10);
    statusLabel = new JLabel(i18n.INITIAL_LOADING_PREFIX);
    progressPanel.add(statusLabel, c);

    c.gridy++;
    c.insets = new Insets(4, 10, 4, 10);
    additionalStatusLabel = new JLabel(" "); // Must be a space :-)
    progressPanel.add(additionalStatusLabel, c);

    c.gridy++;
    c.weightx = 1.0;
    progressBar = new JProgressBar(0, itemCount);
    progressBar.setIndeterminate(indeterminate);
    progressPanel.add(progressBar, c);

    c.gridy++;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    historyArea = new JTextArea();
    historyArea.setEditable(false);
    JScrollPane jScrollPane = new JScrollPane(historyArea);
    progressPanel.add(jScrollPane, c);

    if (abortHandler != null) {
        cancelButton = new JButton(new CancelAction());

        c.gridy++;
        c.anchor = GridBagConstraints.WEST;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 0.0;
        c.weighty = 0.0;
        dialogPanel.add(cancelButton, c);
    }

    super.getContentPane().add(dialogPanel);
    super.pack();
    super.setSize(new Dimension(450, 450));
    super.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    super.addWindowListener(new WindowCloseListener());
}

From source file:it.ventuland.ytd.ui.GUIClient.java

private void addComponentsToPane(final Container pane) {
    this.panel = new JPanel();
    this.panel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.WEST;

    ActionManager lActionManager = new ActionManager();

    dlm = new DefaultListModel<String>();
    this.urllist = new JList<String>(dlm);
    // TODO maybe we add a button to remove added URLs from list?
    //this.userlist.setSelectionMode( ListSelectionModel.MULTIPLE_INTERVAL_SELECTION );
    this.urllist.setFocusable(false);
    textarea = new JTextArea(2, 2);
    textarea.setEditable(true);/*from www  .j a  v  a 2s  .c o  m*/
    textarea.setFocusable(false);

    JScrollPane leftscrollpane = new JScrollPane(this.urllist);
    JScrollPane rightscrollpane = new JScrollPane(textarea);
    this.middlepane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftscrollpane, rightscrollpane);
    this.middlepane.setOneTouchExpandable(true);
    this.middlepane.setDividerLocation(150);

    Dimension minimumSize = new Dimension(25, 25);
    leftscrollpane.setMinimumSize(minimumSize);
    rightscrollpane.setMinimumSize(minimumSize);

    this.directorybutton = new JButton("", createImageIcon("images/open.png", ""));
    gbc.gridx = 0;
    gbc.gridy = 0;
    this.directorybutton.addActionListener(lActionManager);
    this.panel.add(this.directorybutton, gbc);

    this.saveconfigcheckbox = new JCheckBox("Save config");
    this.saveconfigcheckbox.setSelected(false);

    this.panel.add(this.saveconfigcheckbox);

    this.saveconfigcheckbox.setEnabled(false);

    // TODO check if initial download directory exists
    // assume that at least the users homedir exists
    String shomedir = System.getProperty("user.home").concat(File.separator);

    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    this.directorytextfield = new JTextField(shomedir, 20 + (mIsDebug ? 48 : 0));
    this.directorytextfield.setEnabled(false);
    this.directorytextfield.setFocusable(true);
    this.directorytextfield.addActionListener(lActionManager);
    this.panel.add(this.directorytextfield, gbc);

    JLabel dirhint = new JLabel("Download to folder:");

    gbc.gridx = 0;
    gbc.gridy = 1;
    this.panel.add(dirhint, gbc);

    this.middlepane.setPreferredSize(new Dimension(Toolkit.getDefaultToolkit().getScreenSize().width / 3,
            Toolkit.getDefaultToolkit().getScreenSize().height / 4 + (mIsDebug ? 200 : 0)));

    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 2;
    gbc.weightx = 2;
    gbc.gridwidth = 2;
    this.panel.add(this.middlepane, gbc);

    // radio buttons for resolution to download
    mVideoResolutionBtnGrp = new ButtonGroup();
    JPanel lRadioPanel = new JPanel(new GridLayout(1, 0));
    List<Object> lVidQ = mAppContext.getList("youtube-downloader.video-quality");
    JRadioButton lRadioButton = null;
    for (Object obj : lVidQ) {
        String lQuality = (String) obj;
        String lToolTip = mAppContext.getString("youtube-downloader.video-quality." + lQuality + ".tooltip");
        boolean lSelected = mAppContext
                .getBoolean("youtube-downloader.video-quality." + lQuality + ".selected");
        boolean lEnabled = mAppContext.getBoolean("youtube-downloader.video-quality." + lQuality + ".enabled");
        lRadioButton = new JRadioButton(lQuality);
        lRadioButton.setName(lQuality);
        lRadioButton.setActionCommand(lQuality.toLowerCase());
        lRadioButton.addActionListener(lActionManager);
        lRadioButton.setToolTipText(lToolTip);
        lRadioButton.setSelected(lSelected);
        lRadioButton.setEnabled(lEnabled);
        mVideoResolutionBtnGrp.add(lRadioButton);
        lRadioPanel.add(lRadioButton);
    }

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.gridheight = 0;
    gbc.gridwidth = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    this.panel.add(lRadioPanel, gbc);

    // radio buttons for video format to download
    mVideoQualityBtnGrp = new ButtonGroup();
    lRadioPanel = new JPanel(new GridLayout(1, 0));
    save3dcheckbox = new JCheckBox("3D");
    save3dcheckbox.setToolTipText("stereoscopic video");
    save3dcheckbox.setSelected(false);
    save3dcheckbox.setEnabled(true);
    lRadioPanel.add(save3dcheckbox);
    List<Object> lVidR = mAppContext.getList("youtube-downloader.video-resolution");
    lRadioButton = null;
    for (Object obj : lVidR) {
        String lResolution = (String) obj;
        String lToolTip = mAppContext
                .getString("youtube-downloader.video-resolution." + lResolution + ".tooltip");
        boolean lSelected = mAppContext
                .getBoolean("youtube-downloader.video-resolution." + lResolution + ".selected");
        boolean lEnabled = mAppContext
                .getBoolean("youtube-downloader.video-resolution." + lResolution + ".enabled");
        lRadioButton = new JRadioButton(lResolution);
        lRadioButton.setName(lResolution);
        lRadioButton.setActionCommand(lResolution.toLowerCase());
        lRadioButton.addActionListener(lActionManager);
        lRadioButton.setToolTipText(lToolTip);
        lRadioButton.setSelected(lSelected);
        lRadioButton.setEnabled(lEnabled);
        mVideoQualityBtnGrp.add(lRadioButton);
        lRadioPanel.add(lRadioButton);
    }

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.gridheight = 0;
    gbc.gridwidth = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    this.panel.add(lRadioPanel, gbc);

    JLabel hint = new JLabel("Type, paste or drag'n drop a YouTube video address:");

    gbc.fill = 0;
    gbc.gridwidth = 0;
    gbc.gridheight = 1;
    gbc.weightx = 0;
    gbc.weighty = 0;
    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.anchor = GridBagConstraints.WEST;
    this.panel.add(hint, gbc);

    textinputfield = new JTextField(20);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 2;
    textinputfield.setEnabled(true);
    textinputfield.setFocusable(true);
    textinputfield.addActionListener(lActionManager);
    textinputfield.getDocument().addDocumentListener(new UrlInsertListener());
    this.panel.add(textinputfield, gbc);

    this.quitbutton = new JButton("", createImageIcon("images/exit.png", ""));
    gbc.gridx = 2;
    gbc.gridy = 5;
    gbc.gridwidth = 0;
    this.quitbutton.addActionListener(lActionManager);
    this.quitbutton.setActionCommand("quit");
    this.quitbutton.setToolTipText("Exit.");

    this.panel.add(this.quitbutton, gbc);

    pane.add(this.panel);
    addWindowListener(new GUIWindowAdapter());

    this.setDropTarget(new DropTarget(this, new DragDropListener()));
    textarea.setTransferHandler(null); // otherwise the dropped text would be inserted

}

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);/*w ww  .j  a v  a 2s.  c  om*/
    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:TalkServerThread.java

public void init() {
        //Get the address of the host we came from.
        host = getCodeBase().getHost();//  ww w.j a  v  a 2 s . c  o  m

        //Set up the UI.
        GridBagLayout gridBag = new GridBagLayout();
        GridBagConstraints c = new GridBagConstraints();
        setLayout(gridBag);

        message = new TextField("");
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridwidth = GridBagConstraints.REMAINDER;
        gridBag.setConstraints(message, c);
        message.addActionListener(this);
        add(message);

        display = new TextArea(10, 40);
        display.setEditable(false);
        c.weightx = 1.0;
        c.weighty = 1.0;
        c.fill = GridBagConstraints.BOTH;
        gridBag.setConstraints(display, c);
        add(display);

        Label l = new Label("Enter the port (on host " + host + ") to send the request to:", Label.RIGHT);
        c.fill = GridBagConstraints.HORIZONTAL;
        c.gridwidth = 1;
        c.weightx = 0.0;
        c.weighty = 0.0;
        gridBag.setConstraints(l, c);
        add(l);

        portField = new TextField(6);
        c.fill = GridBagConstraints.NONE;
        gridBag.setConstraints(portField, c);
        portField.addActionListener(this);
        add(portField);

        button = new Button("Connect");
        gridBag.setConstraints(button, c);
        button.addActionListener(this);
        add(button);

        newline = System.getProperty("line.separator");
    }

From source file:org.pentaho.reporting.libraries.designtime.swing.table.ArrayCellEditorDialog.java

private void configurePanelWithSelection() {
    final ListSelectionModel selectionModel = table.getSelectionModel();
    final JLabel columnsLabel = new JLabel(
            Messages.getInstance().getString("ArrayCellEditorDialog.SelectedItems"));

    final Action addGroupAction = new AddEntryAction(tableModel);
    final Action removeGroupAction = new RemoveEntryAction(tableModel, selectionModel);
    final Action sortUpAction = new SortBulkUpAction(tableModel, selectionModel, table);
    final Action sortDownAction = new SortBulkDownAction(tableModel, selectionModel, table);

    final JPanel tablesPane = new JPanel();
    tablesPane.setLayout(new GridBagLayout());

    final JLabel tablesColumnsLabel = new JLabel(
            Messages.getInstance().getString("ArrayCellEditorDialog.AvailableSelection"));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;//from  w  ww  . j  a v  a  2 s.c o m
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.WEST;
    tablesPane.add(tablesColumnsLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.weighty = 5;
    gbc.gridheight = 1;
    gbc.weightx = 2;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(0, 5, 5, 5);
    final JScrollPane comp = new JScrollPane(paletteList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tablesPane.add(comp, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(columnsLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 3;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(sortUpAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 4;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(sortDownAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 5;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(addGroupAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 6;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(removeGroupAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 3;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = 5;
    gbc.insets = new Insets(0, 5, 5, 0);
    tablesPane.add(new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.insets = new Insets(5, 5, 5, 0);
    tablesPane.add(new BorderlessButton(new AddSelectionAction(paletteList.getSelectionModel())), gbc);

    contentPane.removeAll();
    contentPane.add(tablesPane);
    contentPane.invalidate();
    contentPane.revalidate();
    contentPane.repaint();
}

From source file:com.vgi.mafscaling.Rescale.java

private void createGraghPanel(JPanel dataPanel) {
    JFreeChart chart = ChartFactory.createScatterPlot(null, null, null, null, PlotOrientation.VERTICAL, false,
            true, false);// w  ww.j av  a2s  .co m
    chart.setBorderVisible(true);
    mafChartPanel = new MafChartPanel(chart, this);

    GridBagConstraints gbl_chartPanel = new GridBagConstraints();
    gbl_chartPanel.anchor = GridBagConstraints.PAGE_START;
    gbl_chartPanel.insets = insets0;
    gbl_chartPanel.fill = GridBagConstraints.BOTH;
    gbl_chartPanel.weightx = 1.0;
    gbl_chartPanel.weighty = 1.0;
    gbl_chartPanel.gridx = 0;
    gbl_chartPanel.gridy = 2;
    dataPanel.add(mafChartPanel.getChartPanel(), gbl_chartPanel);

    XYSplineRenderer lineRenderer = new XYSplineRenderer(3);
    lineRenderer.setUseFillPaint(true);
    lineRenderer.setBaseToolTipGenerator(
            new StandardXYToolTipGenerator(StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
                    new DecimalFormat("0.00"), new DecimalFormat("0.00")));

    Stroke stroke = new BasicStroke(2.0f, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 1.0f, null, 0.0f);
    lineRenderer.setSeriesStroke(0, stroke);
    lineRenderer.setSeriesStroke(1, stroke);
    lineRenderer.setSeriesPaint(0, new Color(201, 0, 0));
    lineRenderer.setSeriesPaint(1, new Color(0, 0, 255));
    lineRenderer.setSeriesShape(0, ShapeUtilities.createDiamond((float) 2.5));
    lineRenderer.setSeriesShape(1, ShapeUtilities.createUpTriangle((float) 2.5));

    ValueAxis mafvDomain = new NumberAxis(XAxisName);
    ValueAxis mafgsRange = new NumberAxis(YAxisName);

    XYSeriesCollection lineDataset = new XYSeriesCollection();

    lineDataset.addSeries(currMafData);
    lineDataset.addSeries(corrMafData);

    XYPlot plot = chart.getXYPlot();
    plot.setRangePannable(true);
    plot.setDomainPannable(true);
    plot.setDomainGridlinePaint(Color.DARK_GRAY);
    plot.setRangeGridlinePaint(Color.DARK_GRAY);
    plot.setBackgroundPaint(new Color(224, 224, 224));
    plot.setSeriesRenderingOrder(SeriesRenderingOrder.FORWARD);

    plot.setDataset(0, lineDataset);
    plot.setRenderer(0, lineRenderer);
    plot.setDomainAxis(0, mafvDomain);
    plot.setRangeAxis(0, mafgsRange);
    plot.mapDatasetToDomainAxis(0, 0);
    plot.mapDatasetToRangeAxis(0, 0);

    LegendTitle legend = new LegendTitle(plot.getRenderer());
    legend.setItemFont(new Font("Arial", 0, 10));
    legend.setPosition(RectangleEdge.TOP);
    chart.addLegend(legend);
}

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

/**
 * This method initializes jPanel   /*from  w  w  w  .  j a  va  2 s  .  co m*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanelBottom == null) {
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridx = 0;
        gridBagConstraints11.anchor = GridBagConstraints.WEST;
        gridBagConstraints11.gridy = 2;
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.anchor = GridBagConstraints.WEST;
        gridBagConstraints5.insets = new Insets(0, 30, 0, 0);
        gridBagConstraints5.gridy = 3;
        GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
        gridBagConstraints9.fill = GridBagConstraints.BOTH;
        gridBagConstraints9.gridx = 0;
        gridBagConstraints9.gridy = 0;
        gridBagConstraints9.weightx = 1.0;
        gridBagConstraints9.weighty = 1.0;
        gridBagConstraints9.gridwidth = 1;
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.gridx = 0;
        gridBagConstraints4.anchor = GridBagConstraints.WEST;
        gridBagConstraints4.insets = new Insets(0, 0, 3, 0);
        gridBagConstraints4.gridwidth = 1;
        gridBagConstraints4.gridy = 5;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.anchor = GridBagConstraints.WEST;
        gridBagConstraints2.insets = new Insets(3, 0, 0, 0);
        gridBagConstraints2.gridwidth = 1;
        gridBagConstraints2.gridy = 1;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 0;
        gridBagConstraints1.anchor = GridBagConstraints.WEST;
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.gridy = 4;
        jPanelBottom = new JPanel();
        jPanelBottom.setLayout(new GridBagLayout());
        jPanelBottom.add(getJRadioButtonOpt3(), gridBagConstraints1);
        jPanelBottom.add(getJRadioButtonOpt1(), gridBagConstraints2);
        jPanelBottom.add(getJRadioButtonOpt4(), gridBagConstraints4);
        jPanelBottom.add(getJPanelTableForCardLayout(), gridBagConstraints9);
        jPanelBottom.add(getJPanelFolder(), gridBagConstraints5);
        jPanelBottom.add(getJPanelFolderTitle(), gridBagConstraints11);

        this.addComponentListener(new ComponentAdapter() {
            public void componentResized(ComponentEvent e) {
                log.debug("code match source code divider resized...");
                jSplitPaneSourceCode.setDividerLocation(jSplitPaneSourceCode.getSize().width / 2);
            }
        });

    }
    return jPanelBottom;
}

From source file:org.nuclos.client.layout.wysiwyg.component.properties.PropertyChartPropertyDomainStep.java

private PanelComponent getPanelComponent(ChartFunction chartFunction, String prefix) {
    JPanel editor = new JPanel();
    editor.setLayout(new BorderLayout());

    JPanel valueEditor = new JPanel(new GridBagLayout());
    valueEditor.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Werte"));

    JLabel propValue = new JLabel(SpringLocaleDelegate.getInstance().getMessage(
            "wysiwyg.chart.wizard.domain.value", "Bestimmen Sie die Spalte, die die Werte enthlt:"));
    valueEditor.add(propValue, new GridBagConstraints(0, 0, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 0), 0, 0));

    ChartColumn[] valueColumns = chartFunction.getValueColumnDesc();
    for (int i = 0; i < valueColumns.length; i++) {
        ChartColumn chartColumn = valueColumns[i];
        PropertyEditorString propValueEditor = new PropertyEditorString(prefix + chartColumn.property,
                getFittingFieldnames(wysiwygChart.getEntityName(), chartColumn.clazz), true);
        propValueEditor.setEditorValue(getChartProperty(prefix + chartColumn.property));
        valueEditor.add(/*w  ww .j  av  a 2  s . co m*/
                new JLabel(SpringLocaleDelegate.getInstance()
                        .getMessage("wysiwyg.chart.wizard.domain.column." + chartColumn.property, "")),
                new GridBagConstraints(0, i + 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                        GridBagConstraints.HORIZONTAL, new Insets(10, 0, 10, 0), 0, 0));
        valueEditor.add(propValueEditor.getComponent(true),
                new GridBagConstraints(1, i + 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                        GridBagConstraints.HORIZONTAL, new Insets(10, -152, 10, 0), 0, 0));
        propertyEditorList.add(propValueEditor);
    }

    editor.add(valueEditor, BorderLayout.NORTH);

    JPanel domainEditor = new JPanel(new GridBagLayout());
    domainEditor.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Domain"));

    ChartColumn[] domainColumns = chartFunction.getDomainColumnDesc();
    if (domainColumns.length > 0) {
        JLabel propDomain = new JLabel(
                SpringLocaleDelegate.getInstance().getMessage("wysiwyg.chart.wizard.domain.compare",
                        "Geben Sie hier die Spalte(n) fr die vergleichenden Werte oder weitere Angaben an:"));
        domainEditor.add(propDomain, new GridBagConstraints(0, 0, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                GridBagConstraints.HORIZONTAL, new Insets(5, 0, 0, 0), 0, 0));

        int glue = 185;
        for (int i = 0; i < domainColumns.length; i++) {
            ChartColumn chartColumn = domainColumns[i];
            PropertyEditorString propDomainEditor = new PropertyEditorString(prefix + chartColumn.property,
                    getFittingFieldnames(wysiwygChart.getEntityName(), chartColumn.clazz), true);
            propDomainEditor.setEditorValue(getChartProperty(prefix + chartColumn.property));
            domainEditor.add(
                    new JLabel(SpringLocaleDelegate.getInstance()
                            .getMessage("wysiwyg.chart.wizard.domain.column." + chartColumn.property, "")),
                    new GridBagConstraints(0, i + 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                            GridBagConstraints.HORIZONTAL, new Insets(10, 0, 10, 0), 0, 0));
            domainEditor.add(propDomainEditor.getComponent(true),
                    new GridBagConstraints(1, i + 1, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                            GridBagConstraints.HORIZONTAL, new Insets(10, -240, 10, 0), 0, 0));
            glue -= propDomainEditor.comboBox.getPreferredSize().height + 10; // add size.
            propertyEditorList.add(propDomainEditor);
        }

        domainEditor.add(new JPanel(), new GridBagConstraints(0, 3, 1, 1, 1D, 1D, GridBagConstraints.NORTHWEST,
                GridBagConstraints.BOTH, new Insets(glue < 0 ? 0 : glue, 0, 10, 0), 0, 0));

        editor.add(domainEditor, BorderLayout.CENTER);
    }
    editor.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    PanelComponent pnlScroller = new PanelComponent(prefix, editor);
    pnlScroller.setPreferredSize(new Dimension(250, 80));
    pnlScroller.setAlignmentX(LEFT_ALIGNMENT);
    pnlScroller.setBorder(BorderFactory.createEmptyBorder(2, 2, 2, 2));

    return pnlScroller;
}

From source file:net.sf.jabref.gui.ContentSelectorDialog2.java

private void initLayout() {
    fieldNameField.setEnabled(false);//ww w.  j  a  v a  2 s. c  o  m
    fieldList.setVisibleRowCount(4);
    wordList.setVisibleRowCount(10);
    final String VAL = "Uren luren himmelturen, ja Besseggen.";
    fieldList.setPrototypeCellValue(VAL);
    wordList.setPrototypeCellValue(VAL);

    fieldPan.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            Localization.lang("Field name")));
    wordPan.setBorder(
            BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), Localization.lang("Keyword")));
    fieldPan.setLayout(gbl);
    wordPan.setLayout(gbl);
    con.insets = new Insets(2, 2, 2, 2);
    con.fill = GridBagConstraints.BOTH;
    con.gridwidth = 2;
    con.weightx = 1;
    con.weighty = 1;
    con.gridx = 0;
    con.gridy = 0;
    gbl.setConstraints(fPane, con);
    fieldPan.add(fPane);
    gbl.setConstraints(wPane, con);
    wordPan.add(wPane);
    con.gridwidth = 1;
    con.gridx = 2;
    //con.weightx = 0.7;
    con.gridheight = 2;
    gbl.setConstraints(fieldNamePan, con);
    fieldPan.add(fieldNamePan);
    gbl.setConstraints(wordEditPan, con);
    wordPan.add(wordEditPan);
    con.gridx = 0;
    con.gridy = 1;
    con.weightx = 0;
    con.weighty = 0;
    con.gridwidth = 1;
    con.gridheight = 1;
    con.fill = GridBagConstraints.NONE;
    con.anchor = GridBagConstraints.WEST;
    gbl.setConstraints(newField, con);
    fieldPan.add(newField);
    gbl.setConstraints(newWord, con);
    wordPan.add(newWord);
    con.gridx = 1;
    //con.anchor = GridBagConstraints.EAST;
    gbl.setConstraints(removeField, con);
    fieldPan.add(removeField);
    gbl.setConstraints(removeWord, con);
    wordPan.add(removeWord);
    con.anchor = GridBagConstraints.WEST;
    con.gridx = 0;
    con.gridy = 0;
    gbl.setConstraints(fieldNameField, con);
    fieldNamePan.add(fieldNameField);
    gbl.setConstraints(wordEditField, con);
    wordEditPan.add(wordEditField);

    // Add buttons:
    ButtonBarBuilder bsb = new ButtonBarBuilder(buttonPan);
    bsb.addGlue();
    bsb.addButton(ok);
    bsb.addButton(apply);
    bsb.addButton(cancel);
    bsb.addRelatedGap();
    bsb.addButton(new HelpAction(HelpFile.CONTENT_SELECTOR).getHelpButton());
    bsb.addGlue();

    // Add panels to dialog:
    con.fill = GridBagConstraints.BOTH;
    getContentPane().setLayout(gbl);
    con.weightx = 1;
    con.weighty = 0.5;
    con.gridwidth = 1;
    con.gridheight = 1;
    con.gridx = 0;
    con.gridy = 0;
    gbl.setConstraints(fieldPan, con);
    getContentPane().add(fieldPan);
    con.gridy = 1;
    gbl.setConstraints(wordPan, con);
    getContentPane().add(wordPan);
    con.weighty = 0;
    con.gridy = 2;
    con.insets = new Insets(12, 2, 2, 2);
    gbl.setConstraints(buttonPan, con);
    getContentPane().add(buttonPan);

}