Example usage for javax.swing BoxLayout Y_AXIS

List of usage examples for javax.swing BoxLayout Y_AXIS

Introduction

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

Prototype

int Y_AXIS

To view the source code for javax.swing BoxLayout Y_AXIS.

Click Source Link

Document

Specifies that components should be laid out top to bottom.

Usage

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates the scenario information display including information such as title, description, url.
 * For an update (isUpdate = true), the displayed options are slightly different.
 *///from  www  .  j a v a 2s .  c o m
private void createScenarioDisplay() {
    leftPanel = new Box(BoxLayout.Y_AXIS);
    JLabel text;
    MiksGridLayout titleAndDescLayout = new MiksGridLayout(6, 2, 8, 8);
    titleAndDescLayout.setVerticallyExpandingRow(3);

    titleAndDescPanel = new JPanel(titleAndDescLayout);
    titleAndDescPanel.setBackground(background);

    if (imagePanel == null) {
        imagePanel = new ImageEditPanel(IMAGE_WIDTH, IMAGE_HEIGHT);
        imagePanel.setBackground(background);
    }

    Box textPanel = new Box(BoxLayout.Y_AXIS);
    {
        text = new JLabel(Config.getString("export.publish.image1"));
        text.setAlignmentX(Component.RIGHT_ALIGNMENT);
        text.setFont(font);
        textPanel.add(text);
        text = new JLabel(Config.getString("export.publish.image2"));
        text.setAlignmentX(Component.RIGHT_ALIGNMENT);
        text.setFont(font);
        textPanel.add(text);
    }
    titleAndDescPanel.add(textPanel);
    titleAndDescPanel.add(imagePanel);

    if (isUpdate) {
        text = new JLabel(Config.getString("export.snapshot.label"), SwingConstants.TRAILING);
        text.setFont(font);
        titleAndDescPanel.add(text);

        keepScenarioScreenshot = new JCheckBox();
        keepScenarioScreenshot.setSelected(true);
        // "keep screenshot" defaults to true, therefore the image panel should be disabled
        imagePanel.enableImageEditPanel(false);
        keepScenarioScreenshot.setName(Config.getString("export.publish.keepScenario"));
        keepScenarioScreenshot.setOpaque(false);
        keepScenarioScreenshot.addChangeListener(this);
        titleAndDescPanel.add(keepScenarioScreenshot);
    }

    text = new JLabel(Config.getString("export.publish.title"), SwingConstants.TRAILING);
    text.setFont(font);
    titleAndDescPanel.add(text);

    String title = project.getName();
    if (getTitle() != null) {
        title = getTitle();
    }
    titleField = new JTextField(title);
    titleField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            String text = titleField.getText();
            return text.length() > 0;
        }
    });
    titleField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForExistingScenario();
        }
    });
    titleAndDescPanel.add(titleField);

    // If there is an update a "changes" description area is shown.
    // If not there a short description and long description area are shown.
    if (isUpdate) {
        JLabel updateLabel = new JLabel(Config.getString("export.publish.update"), SwingConstants.TRAILING);
        updateLabel.setVerticalAlignment(SwingConstants.TOP);
        updateLabel.setFont(font);

        updateArea = new JTextArea();
        updateArea.setRows(6);
        updateArea.setLineWrap(true);
        updateArea.setWrapStyleWord(true);
        JScrollPane updatePane = new JScrollPane(updateArea);

        titleAndDescPanel.add(updateLabel);
        titleAndDescPanel.add(updatePane);
        titleAndDescLayout.setVerticallyExpandingRow(4);
    } else {
        text = new JLabel(Config.getString("export.publish.shortDescription"), SwingConstants.TRAILING);
        text.setFont(font);
        shortDescriptionField = new JTextField();
        titleAndDescPanel.add(text);
        titleAndDescPanel.add(shortDescriptionField);
        text = new JLabel(Config.getString("export.publish.longDescription"), SwingConstants.TRAILING);
        text.setVerticalAlignment(SwingConstants.TOP);
        text.setFont(font);

        descriptionArea = new JTextArea();
        descriptionArea.setRows(6);
        descriptionArea.setLineWrap(true);
        descriptionArea.setWrapStyleWord(true);
        JScrollPane description = new JScrollPane(descriptionArea);
        titleAndDescPanel.add(text);
        titleAndDescPanel.add(description);
    }

    text = new JLabel(Config.getString("export.publish.url"), SwingConstants.TRAILING);
    text.setFont(font);
    titleAndDescPanel.add(text);

    urlField = new JTextField();
    titleAndDescPanel.add(urlField);

    leftPanel.add(titleAndDescPanel, BorderLayout.SOUTH);

    JComponent sourceAndLockPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 0));
    {
        sourceAndLockPanel.setBackground(background);
        includeSource = new JCheckBox(Config.getString("export.publish.includeSource"));
        includeSource.setOpaque(false);
        includeSource.setSelected(false);
        includeSource.setFont(font);
        sourceAndLockPanel.add(includeSource);
        lockScenario.setFont(font);
        sourceAndLockPanel.add(lockScenario);
        sourceAndLockPanel.setMaximumSize(sourceAndLockPanel.getPreferredSize());
    }

    leftPanel.add(sourceAndLockPanel, BorderLayout.SOUTH);
}

From source file:ConfigFiles.java

public JPanel addPanel(String title, String description, final JTextField textfield, String fieldtext, int Y,
        boolean withbutton, ActionListener actionlistener) {
    JPanel p1 = new JPanel();
    p1.setBackground(Color.WHITE);
    TitledBorder border = BorderFactory.createTitledBorder(title);
    border.setTitleFont(new Font("Arial", Font.PLAIN, 14));
    border.setBorder(BorderFactory.createLineBorder(new Color(150, 150, 150), 1));
    p1.setBorder(border);/*from  ww w .ja v a  2  s.  c  om*/
    p1.setLayout(new BoxLayout(p1, BoxLayout.Y_AXIS));
    p1.setBounds(80, Y, 800, 75);
    paths.add(p1);
    JTextArea tcpath = new JTextArea(description);
    tcpath.setWrapStyleWord(true);
    tcpath.setLineWrap(true);
    tcpath.setEditable(false);
    tcpath.setCursor(null);
    tcpath.setOpaque(false);
    tcpath.setFocusable(false);
    tcpath.setFont(new Font("Arial", Font.PLAIN, 12));
    tcpath.setBackground(getBackground());
    tcpath.setMaximumSize(new Dimension(170, 22));
    tcpath.setPreferredSize(new Dimension(170, 22));
    tcpath.setBorder(null);
    JPanel p11 = new JPanel();
    p11.setBackground(Color.WHITE);
    p11.setLayout(new GridLayout());
    p11.add(tcpath);
    p11.setMaximumSize(new Dimension(700, 18));
    p11.setPreferredSize(new Dimension(700, 18));
    textfield.setMaximumSize(new Dimension(340, 27));
    textfield.setPreferredSize(new Dimension(340, 27));
    textfield.setText(fieldtext);
    JButton b = null;
    if (withbutton) {
        b = new JButton("...");
        if (!PermissionValidator.canChangeFWM()) {
            b.setEnabled(false);
        }
        b.setMaximumSize(new Dimension(50, 20));
        b.setPreferredSize(new Dimension(50, 20));
        if (actionlistener == null) {
            b.addActionListener(new AbstractAction() {
                public void actionPerformed(ActionEvent ev) {
                    Container c;

                    if (RunnerRepository.container != null)
                        c = RunnerRepository.container.getParent();
                    else
                        c = RunnerRepository.window;
                    try {
                        new MySftpBrowser(RunnerRepository.host, RunnerRepository.user,
                                RunnerRepository.password, textfield, c, false);
                    } catch (Exception e) {
                        System.out.println("There was a problem in opening sftp browser!");
                        e.printStackTrace();
                    }
                }
            });
        } else {
            b.addActionListener(actionlistener);
            b.setText("Save");
            b.setMaximumSize(new Dimension(70, 20));
            b.setPreferredSize(new Dimension(70, 20));
        }
    }
    JPanel p12 = new JPanel();
    p12.setBackground(Color.WHITE);
    p12.add(textfield);
    if (withbutton)
        p12.add(b);
    p12.setMaximumSize(new Dimension(700, 32));
    p12.setPreferredSize(new Dimension(700, 32));
    p1.add(p11);
    p1.add(p12);
    return p12;
}

From source file:com.unionpay.upmp.jmeterplugin.gui.UPMPUrlConfigGui.java

/**
 * This method defines the Panel for the HTTP path, 'Follow Redirects'
 * 'Use KeepAlive', and 'Use multipart for HTTP POST' elements.
 *
 * @return JPanel The Panel for the path, 'Follow Redirects' and 'Use
 *         KeepAlive' elements./*from  w w w  . j av a2  s.  c o m*/
 */
protected Component getPathPanel() {
    path = new JTextField(15);

    JLabel label = new JLabel(JMeterUtils.getResString("path")); //$NON-NLS-1$
    label.setLabelFor(path);

    if (notConfigOnly) {
        followRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects")); // $NON-NLS-1$
        followRedirects.setSelected(true);
        followRedirects.addChangeListener(this);

        autoRedirects = new JCheckBox(JMeterUtils.getResString("follow_redirects_auto")); //$NON-NLS-1$
        autoRedirects.addChangeListener(this);
        autoRedirects.setSelected(false);// Default changed in 2.3 and again in 2.4

        useKeepAlive = new JCheckBox(JMeterUtils.getResString("use_keepalive")); // $NON-NLS-1$
        useKeepAlive.setSelected(true);

        useMultipartForPost = new JCheckBox(JMeterUtils.getResString("use_multipart_for_http_post")); // $NON-NLS-1$
        useMultipartForPost.setSelected(false);

        useBrowserCompatibleMultipartMode = new JCheckBox(
                JMeterUtils.getResString("use_multipart_mode_browser")); // $NON-NLS-1$
        useBrowserCompatibleMultipartMode
                .setSelected(UPMPSamplerBase.BROWSER_COMPATIBLE_MULTIPART_MODE_DEFAULT);

    }

    JPanel pathPanel = new JPanel(new BorderLayout(5, 0));
    pathPanel.add(label, BorderLayout.WEST);
    pathPanel.add(path, BorderLayout.CENTER);
    pathPanel.setMinimumSize(pathPanel.getPreferredSize());

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
    panel.add(pathPanel);
    if (notConfigOnly) {
        JPanel optionPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
        optionPanel.add(autoRedirects);
        optionPanel.add(followRedirects);
        optionPanel.add(useKeepAlive);
        optionPanel.add(useMultipartForPost);
        optionPanel.add(useBrowserCompatibleMultipartMode);
        optionPanel.setMinimumSize(optionPanel.getPreferredSize());
        panel.add(optionPanel);
    }

    return panel;
}

From source file:SuitaDetails.java

private void initComponents(ArrayList<String[]> descriptions) {
    global = new JPanel();
    global.setBackground(Color.WHITE);
    initGlobal();/*w ww . j a  v a  2 s .  com*/
    initTCOptions();
    initSummary();
    definitions.clear();
    border = BorderFactory.createTitledBorder("Global options");
    setBorder(border);
    scroll = new JScrollPane();
    //         setMinimumSize(new Dimension(10,10));
    //         setMaximumSize(new Dimension(1000,1000));
    //         setPreferredSize(new Dimension(100,100));
    defsContainer = new JPanel();
    setLayout(new BorderLayout());
    defsContainer.setBackground(Color.WHITE);
    defsContainer.setBorder(BorderFactory.createEmptyBorder(10, 0, 10, 0));
    defsContainer.setLayout(new BoxLayout(defsContainer, BoxLayout.Y_AXIS));
    defsContainer.add(suiteoptions);
    scroll.setViewportView(global);
    add(scroll, BorderLayout.CENTER);
    JLabel l = new JLabel("test");
    FontMetrics metrics = l.getFontMetrics(l.getFont());
    int width = 0;
    for (int i = 0; i < descriptions.size(); i++) {
        if (width < metrics.stringWidth(descriptions.get(i)[RunnerRepository.LABEL])) {
            width = metrics.stringWidth(descriptions.get(i)[RunnerRepository.LABEL]);
        }
    }
    for (int i = 0; i < descriptions.size(); i++) {
        String button = descriptions.get(i)[RunnerRepository.SELECTED];
        DefPanel define = new DefPanel(descriptions.get(i)[RunnerRepository.LABEL], button,
                descriptions.get(i)[RunnerRepository.ID], width, i, this);
        definitions.add(define);
        defsContainer.add(define);
    }
}

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

protected void doGraph() {

    // graph Component is available here
    // data: variables double xData, yData, residuals, predicted are available here after doAnalysis() is run.
    ////System.out.println("\nAnovaOneWay doGraph call removeAll");

    graphPanel.removeAll();/*from w  w w .  j ava2 s. c  o  m*/
    JPanel innerPanel = new JPanel();
    JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    graphPanel.add(graphPane);
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    // 1. Box plot of data: yData vs. xData (where xData is categorical)

    //int seriesCount = 3; // seriesCount
    //int categoryCount= 1;
    //double[][][] yValue = new double[seriesCount][categoryCount][];
    //String[] seriesName = {"1", "2", "3"};
    /*
    String[][] xNameData = new String[seriesCount][categoryCount]; // xNameData: category names.
    xNameData[0] = new String[] {""};
    xNameData[1] = xNameData[0];
    xNameData[2] = xNameData[0];
    */
    // data is for testing only.
    // the data below gives hallow triagle and circles.
    // static test data only
    /*      yValue[0][0] = new double[] {14.67,13.72,13.84,13.90,14.56,13.88,14.30,14.11,13.84,13.90,14.56,13.88, 15, 16, 17};
            
          yValue[1][0] = new double[] {13.94,14.40,14.14,14.59,13.59,14.24,14.05,11,12,13, 15, 20, 8};
            
          yValue[2][0] = new double[] {14.24,14.05,14.65,13,10,19,20,10,11,12,23, 20, 23, 24};
    */

    /* the parameters to be passed are:
    1.boxPlotTitle, xAxisLabel, YAxisLabel.
    2. serieCount, categoryCount
    3. seriesname (e.g. sex, race, etc)
    4. category's name (e.g. height, weight, etc)--xData
    5. yValue(double),
    */
    /*
    JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot of " + dependentHeader + " vs " + independentHeader, independentHeader, dependentHeader, dependentHeader + " Value  " , xData, yData,  "Regression Line", intercept, slope, "");
    ChartPanel chartPanel = new ChartPanel(scatterChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight));
    innerPanel.add(chartPanel);
    */

    double xDataDouble[] = new double[xData.length];
    String groupLegend = "";
    boolean useStringLegend = false;
    TreeSet<String> treeSet = new TreeSet<String>();
    try {
        for (int i = 0; i < xData.length; i++) {
            xDataDouble[i] = (new Double(xData[i])).doubleValue();
        }
    } catch (Exception e) {
        useStringLegend = true;
        for (int i = 0; i < xData.length; i++) {
            treeSet.add((String) xData[i]);
        }
    }
    int groupSize = treeSet.size();

    ////System.out.println("TreeSet.size() = " + groupSize);

    Iterator<String> iterator = treeSet.iterator();
    int groupIndex = 1;
    String groupName = null;
    while (iterator.hasNext()) {
        groupName = (String) iterator.next();
        //xDataDouble[groupIndex-1] = groupIndex;
        groupLegend += ("\t" + groupName + "=" + groupIndex + "  ");
        for (int i = 0; i < xData.length; i++) {
            if (xData[i].equalsIgnoreCase(groupName)) { // xData[i] is a String.
                xDataDouble[i] = (double) groupIndex;
            }
        }
        groupIndex++;

    }

    if (useStringLegend) {
        groupLegend = "Group Names: " + groupLegend;
        groupLegend = groupLegend.substring(0, groupLegend.length() - 2);
        //System.out.println("groupLegend = " + groupLegend);
        // 1. scatter plot of data: yData vs. xData
    }

    //JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot", independentHeader, "Residuals", "Residual Value", xData, residuals, "At Residual = 0", 0, 0, "");

    JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot", independentHeader, "Residuals",
            "Residual Value", xDataDouble, residuals, "   " + groupLegend, 0, 0, "");
    //JFreeChart scatterChart = chartFactory.getLineChart("Scatter Plot", independentHeader, dependentHeader, xDataDouble, yData);//getChart(title, xlabel, ylabel, xdata,ydata)

    ChartPanel chartPanel = new ChartPanel(scatterChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    /*
    if (useStringLegend) {
       JPanel labelPanel = new JPanel();
       labelPanel.setBackground(Color.WHITE);
       JLabel legendLabel1 = new JLabel(groupLegend);
       legendLabel1.setBackground(Color.WHITE);
       labelPanel.add(legendLabel1, BorderLayout.NORTH);
       innerPanel.add(labelPanel);
    }
    */
    // this is only a test for having more than one charts in a boxlayout

    // 1.5. box plot of data
    //mapToArray(boxPlotNameValueMap);
    /*
    JFreeChart boxChart = chartFactory.getBoxAndWhiskerChart(boxPlotTitle, xAxisLabel, yAxisLabel, seriesCount, categoryCount,  seriesName, xNameData, yValue);
    chartPanel = new ChartPanel(boxChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight));
    graphPanel.add(chartPanel);
    */

    // 2. residual on fit plot: residuals vs. xData
    //JFreeChart rxChart = chartFactory.getLineChart("Residual on Covariate Plot", independentHeader, "Residuals", xDataDouble, residuals);

    JFreeChart rxChart = chartFactory.getQQChart("Residual on Covariate Plot", independentHeader, "Residuals",
            "Residuals", xDataDouble, residuals, "   " + groupLegend, 0, 0, "");

    chartPanel = new ChartPanel(rxChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    // 3. residual on fit plot: residuals vs. predicted

    //JFreeChart rfChart = chartFactory.getLineChart("Residual on Fit Plot", "Predicted", "Residuals", predicted, residuals);

    JFreeChart rfChart = chartFactory.getQQChart("Residual on Fit Plot", "Predicted " + dependentHeader,
            "Residuals", "Residuals", predicted, residuals, "At Residual = 0", 0, 0, "");
    chartPanel = new ChartPanel(rfChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    // 4. Normal QQ plot: need residuals and standardized normal scores
    //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals);
    int len = sortedNormalQuantiles.length;
    double slope = (sortedStandardizedResiduals[len - 1] - sortedStandardizedResiduals[0])
            / (sortedNormalQuantiles[len - 1] - sortedNormalQuantiles[0]);
    double y0 = sortedStandardizedResiduals[len - 1] - slope * sortedNormalQuantiles[len - 1];

    //   max_x = Math.max (normalQuantiles[row_count-1],stdResiduals[row_count-1]);

    JFreeChart qqChart = chartFactory.getQQChart("Residual Normal QQ Plot", "Theoretical Quantiles",
            "Standardized Residuals", "Standardized Residual Value  ", sortedStandardizedNormalQuantiles,
            sortedStandardizedResiduals, "At Standardized Residual = 0", y0, slope, "noshape");
    //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "noline");

    chartPanel = new ChartPanel(qqChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    graphPanel.validate();

}

From source file:edu.ucla.stat.SOCR.chart.SuperHistogramChart.java

protected void initGraphPanel() {
    //System.out.println("initGraphPanel called");
    graphPanel = new JPanel();

    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    JFreeChart chart = createEmptyChart(null); //create a empty graph first
    chartPanel = new ChartPanel(chart, false);
    chartPanel.setPreferredSize(new Dimension(CHART_SIZE_X, CHART_SIZE_Y - 100));

    sliderPanel = new JPanel();

    /*   binSlider = new JSlider(SwingConstants.HORIZONTAL, 1, 10, default_bin);
       binSlider.setPaintLabels(true);/*from   ww w. j  a va2  s  .  c  o m*/
       binSlider.setPaintTicks(true);
       binSlider.setMajorTickSpacing(space_bin);
      // binSlider.setMinorTickSpacing(5);
      // binSlider.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
       binSlider.addChangeListener(this);
       sliderPanel.add(new JLabel("Bin Size"));
       sliderPanel.add(this.binSlider);
       sliderPanel.add(new JLabel(":"+this.binSlider.getValue()));*/

    // ValueSetter(String title, int type int min, int max, int initial,boolean minimumRange10) 
    binSlider2 = new FloatSlider("Bin Size", 1, 10, 5, true);

    reset_BinSlider();// the range will need to be reset
    binSlider2.setPreferredSize(new Dimension(CHART_SIZE_X - 10, 100));
    binSlider2.addObserver(this);
    sliderPanel.add(this.binSlider2);
    sliderPanel.setPreferredSize(new Dimension(CHART_SIZE_X + 100, 80));

    graphPanel.add(chartPanel);
    graphPanel.add(sliderPanel);
    graphPanel.validate();
}

From source file:com.openbravo.pos.sales.JRetailTicketPreviewTicket.java

/** This method is called from within the constructor to
 * initialize the form.//from   w w  w  . ja v a 2s  .com
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    buttonGroup1 = new javax.swing.ButtonGroup();
    m_jOptions = new javax.swing.JPanel();
    m_jButtons = new javax.swing.JPanel();
    m_jTicketId = new javax.swing.JLabel();
    jButtonSearch = new javax.swing.JButton();
    //    m_jEdit = new javax.swing.JButton();
    m_jRefund = new javax.swing.JButton();
    m_jPrint = new javax.swing.JButton();
    jPanel2 = new javax.swing.JPanel();
    m_jPanelTicket = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jPanel4 = new javax.swing.JPanel();
    // m_jKeys = new com.openbravo.editor.JEditorKeys();
    //        jPanel5 = new javax.swing.JPanel();
    jButton1 = new javax.swing.JButton();
    //        m_jTicketEditor = new com.openbravo.editor.JEditorIntegerPositive();
    jPanel1 = new javax.swing.JPanel();
    //        jrbSales = new javax.swing.JRadioButton();
    //     jrbRefunds = new javax.swing.JRadioButton();

    setLayout(new java.awt.BorderLayout());

    m_jOptions.setLayout(new java.awt.BorderLayout());

    m_jButtons.setPreferredSize(new java.awt.Dimension(506, 56));
    m_jButtons.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

    m_jTicketId.setBackground(java.awt.Color.white);
    m_jTicketId.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    m_jTicketId.setBorder(javax.swing.BorderFactory.createCompoundBorder(
            javax.swing.BorderFactory
                    .createLineBorder(javax.swing.UIManager.getDefaults().getColor("Button.darkShadow")),
            javax.swing.BorderFactory.createEmptyBorder(1, 4, 1, 4)));
    m_jTicketId.setOpaque(true);
    m_jTicketId.setPreferredSize(new java.awt.Dimension(160, 25));
    m_jTicketId.setRequestFocusEnabled(false);
    m_jButtons.add(m_jTicketId, new org.netbeans.lib.awtextra.AbsoluteConstraints(5, 15, -1, 30));

    jButtonSearch.setBackground(new java.awt.Color(255, 255, 255));
    jButtonSearch
            .setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/search.png"))); // NOI18N
    jButtonSearch.setText(AppLocal.getIntString("label.search")); // NOI18N
    jButtonSearch.setFocusPainted(false);
    jButtonSearch.setFocusable(false);
    jButtonSearch.setMargin(new java.awt.Insets(0, 0, 0, 0));
    jButtonSearch.setRequestFocusEnabled(false);
    jButtonSearch.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jButtonSearchActionPerformed(evt);
        }
    });
    m_jButtons.add(jButtonSearch, new org.netbeans.lib.awtextra.AbsoluteConstraints(170, 12, 85, 35));

    //        m_jEdit.setBackground(new java.awt.Color(255, 255, 255));
    //        m_jEdit.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/edit.png"))); // NOI18N
    //        m_jEdit.setText(AppLocal.getIntString("button.edit")); // NOI18N
    //        m_jEdit.setFocusPainted(false);
    //        m_jEdit.setFocusable(false);
    //        m_jEdit.setMargin(new java.awt.Insets(8, 14, 8, 14));
    //        m_jEdit.setRequestFocusEnabled(false);
    //        m_jEdit.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                m_jEditActionPerformed(evt);
    //            }
    //        });
    //        m_jButtons.add(m_jEdit, new org.netbeans.lib.awtextra.AbsoluteConstraints(258, 12, 85, 35));

    //        m_jRefund.setBackground(new java.awt.Color(255, 255, 255));
    //        m_jRefund.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/inbox.png"))); // NOI18N
    //        m_jRefund.setText(AppLocal.getIntString("button.refund")); // NOI18N
    //        m_jRefund.setFocusPainted(false);
    //        m_jRefund.setFocusable(false);
    //        m_jRefund.setMargin(new java.awt.Insets(8, 14, 8, 14));
    //        m_jRefund.setRequestFocusEnabled(false);
    //        m_jRefund.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                m_jRefundActionPerformed(evt);
    //            }
    //        });
    //        m_jButtons.add(m_jRefund, new org.netbeans.lib.awtextra.AbsoluteConstraints(450, 10, 50, 35));

    m_jPrint.setBackground(new java.awt.Color(255, 255, 255));
    m_jPrint.setIcon(
            new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/yast_printer.png"))); // NOI18N
    m_jPrint.setText(AppLocal.getIntString("button.print")); // NOI18N
    m_jPrint.setFocusPainted(false);
    m_jPrint.setFocusable(false);
    m_jPrint.setMargin(new java.awt.Insets(0, 0, 0, 0));
    m_jPrint.setRequestFocusEnabled(false);
    m_jPrint.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            m_jPrintActionPerformed(evt);
        }
    });
    m_jButtons.add(m_jPrint, new org.netbeans.lib.awtextra.AbsoluteConstraints(258, 12, 85, 35));

    m_jOptions.add(m_jButtons, java.awt.BorderLayout.WEST);

    jPanel2.setLayout(new java.awt.FlowLayout(java.awt.FlowLayout.LEFT));
    m_jOptions.add(jPanel2, java.awt.BorderLayout.CENTER);

    add(m_jOptions, java.awt.BorderLayout.NORTH);

    m_jPanelTicket.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    m_jPanelTicket.setLayout(new java.awt.BorderLayout());
    add(m_jPanelTicket, java.awt.BorderLayout.CENTER);

    jPanel3.setLayout(new java.awt.BorderLayout());

    jPanel4.setPreferredSize(new java.awt.Dimension(175, 276));
    jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.Y_AXIS));

    //        m_jKeys.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                m_jKeysActionPerformed(evt);
    //            }
    //        });
    //        jPanel4.add(m_jKeys);

    //  jPanel5.setBorder(javax.swing.BorderFactory.createEmptyBorder(5, 5, 5, 5));
    //  jPanel5.setPreferredSize(new java.awt.Dimension(201, 60));
    //  jPanel5.setLayout(new java.awt.GridBagLayout());

    //        jButton1.setBackground(new java.awt.Color(255, 255, 255));
    //        jButton1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/com/openbravo/images/button_ok.png"))); // NOI18N
    //        jButton1.setFocusPainted(false);
    //        jButton1.setFocusable(false);
    //        jButton1.setMargin(new java.awt.Insets(8, 14, 8, 14));
    //        jButton1.setRequestFocusEnabled(false);
    //        jButton1.addActionListener(new java.awt.event.ActionListener() {
    //            public void actionPerformed(java.awt.event.ActionEvent evt) {
    //                jButton1ActionPerformed(evt);
    //            }
    //        });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 5, 0, 0);
    //        jPanel5.add(jButton1, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 0;
    //   jPanel5.add(m_jTicketEditor, gridBagConstraints);

    //  jPanel4.add(jPanel5);

    jPanel3.add(jPanel4, java.awt.BorderLayout.NORTH);

    jPanel1.setPreferredSize(new java.awt.Dimension(130, 25));

    //        buttonGroup1.add(jrbSales);
    //        jrbSales.setText(AppLocal.getIntString("label.sales")); // NOI18N
    //        jrbSales.setFocusPainted(false);
    //        jrbSales.setFocusable(false);
    //        jrbSales.setRequestFocusEnabled(false);
    //        jPanel1.add(jrbSales);

    //        buttonGroup1.add(jrbRefunds);
    //        jrbRefunds.setText(AppLocal.getIntString("label.refunds")); // NOI18N
    //        jrbRefunds.setFocusPainted(false);
    //        jrbRefunds.setFocusable(false);
    //        jrbRefunds.setRequestFocusEnabled(false);
    //        jPanel1.add(jrbRefunds);

    jPanel3.add(jPanel1, java.awt.BorderLayout.CENTER);

    add(jPanel3, java.awt.BorderLayout.EAST);
}

From source file:EnvironmentExplorer.java

Box lightPanel() {
    Box panel = new Box(BoxLayout.Y_AXIS);

    // add the ambient light checkbox to the panel
    JCheckBox ambientCheckBox = new JCheckBox("Ambient Light");
    ambientCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JCheckBox checkbox = (JCheckBox) e.getSource();
            lightAmbient.setEnable(checkbox.isSelected());
        }/*from  w  w w.  j  ava  2s  .c  o m*/
    });
    ambientCheckBox.setSelected(true);
    panel.add(new LeftAlignComponent(ambientCheckBox));

    String[] lightTypeValues = { "None", "Directional", "Positional", "Spot" };
    IntChooser lightTypeChooser = new IntChooser("Light Type:", lightTypeValues);
    lightTypeChooser.addIntListener(new IntListener() {
        public void intChanged(IntEvent event) {
            int value = event.getValue();
            switch (value) {
            case 0:
                lightDirectional.setEnable(false);
                lightPoint.setEnable(false);
                lightSpot.setEnable(false);
                break;
            case 1:
                lightDirectional.setEnable(true);
                lightPoint.setEnable(false);
                lightSpot.setEnable(false);
                break;
            case 2:
                lightDirectional.setEnable(false);
                lightPoint.setEnable(true);
                lightSpot.setEnable(false);
                break;
            case 3:
                lightDirectional.setEnable(false);
                lightPoint.setEnable(false);
                lightSpot.setEnable(true);
                break;
            }
        }
    });
    lightTypeChooser.setValueByName("Directional");
    panel.add(lightTypeChooser);

    // Set up the sliders for the attenuation

    // top row
    panel.add(new LeftAlignComponent(new JLabel("Light attenuation:")));

    FloatLabelJSlider constantSlider = new FloatLabelJSlider("Constant ", 0.1f, 0.0f, 3.0f, attenuation.x);
    constantSlider.setMajorTickSpacing(1.0f);
    constantSlider.setPaintTicks(true);
    constantSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            attenuation.x = e.getValue();
            lightPoint.setAttenuation(attenuation);
            lightSpot.setAttenuation(attenuation);
        }
    });
    panel.add(constantSlider);

    FloatLabelJSlider linearSlider = new FloatLabelJSlider("Linear   ", 0.1f, 0.0f, 3.0f, attenuation.y);
    linearSlider.setMajorTickSpacing(1.0f);
    linearSlider.setPaintTicks(true);
    linearSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            attenuation.y = e.getValue();
            lightPoint.setAttenuation(attenuation);
            lightSpot.setAttenuation(attenuation);
        }
    });
    panel.add(linearSlider);

    FloatLabelJSlider quadradicSlider = new FloatLabelJSlider("Quadradic", 0.1f, 0.0f, 3.0f, attenuation.z);
    quadradicSlider.setMajorTickSpacing(1.0f);
    quadradicSlider.setPaintTicks(true);
    quadradicSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            attenuation.z = e.getValue();
            lightPoint.setAttenuation(attenuation);
            lightSpot.setAttenuation(attenuation);
        }
    });
    panel.add(quadradicSlider);

    // Set up the sliders for the attenuation
    // top row
    panel.add(new LeftAlignComponent(new JLabel("Spot light:")));

    // spread angle is 0-180 degrees, no slider scaling
    FloatLabelJSlider spotSpreadSlider = new FloatLabelJSlider("Spread Angle ", 1.0f, 0.0f, 180.0f,
            spotSpreadAngle);
    spotSpreadSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            spotSpreadAngle = e.getValue();
            lightSpot.setSpreadAngle((float) Math.toRadians(spotSpreadAngle));
        }
    });
    panel.add(spotSpreadSlider);

    // concentration angle is 0-128 degrees
    FloatLabelJSlider spotConcentrationSlider = new FloatLabelJSlider("Concentration", 1.0f, 0.0f, 128.0f,
            spotConcentration);
    spotConcentrationSlider.addFloatListener(new FloatListener() {
        public void floatChanged(FloatEvent e) {
            spotConcentration = e.getValue();
            lightSpot.setConcentration(spotConcentration);
        }
    });
    panel.add(spotConcentrationSlider);

    return panel;
}

From source file:edu.ucla.stat.SOCR.chart.SuperHistogramChart.java

protected void initMixPanel() {
    dataPanel2 = new JPanel();
    dataPanel2.setLayout(new BoxLayout(dataPanel2, BoxLayout.Y_AXIS));

    graphPanel2 = new JPanel();
    graphPanel2.setLayout(new BoxLayout(graphPanel2, BoxLayout.Y_AXIS));

    mixPanel = new JPanel(new BorderLayout());
    //      resetChart();

    setMixPanel();//from  w w  w.ja v a2 s  .  co m
}

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

protected void doGraph() {
    // graphComponent is available here
    // data: variables double xData, yData, residuals, predicted are available here after doAnalysis() is run.
    graphPanel.removeAll();//from   w  ww  . j  av  a  2 s .  com
    /************************************/
    JPanel innerPanel = new JPanel();
    JScrollPane graphPane = new JScrollPane(innerPanel, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
            JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);

    graphPanel.add(graphPane);
    innerPanel.setLayout(new BoxLayout(innerPanel, BoxLayout.Y_AXIS));
    graphPanel.setLayout(new BoxLayout(graphPanel, BoxLayout.Y_AXIS));

    //JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot of " + dependentHeader + " vs " + independentHeader, independentHeader, dependentHeader, dependentHeader + " Value  " , xData, yData,  "Regression Line", intercept, slope, "");
    //ChartPanel chartPanel = new ChartPanel(scatterChart, false);
    //chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight));
    //innerPanel.add(chartPanel);
    /************************************/

    ChartPanel chartPanel = null;

    // 1. scatter plot of data: yData vs. xData
    ////////System.out.println("MLR doGraph independentHeaderArray.length = " + independentHeaderArray.length);
    for (int i = 0; i < xDataArray.length; i++) {
        xData = xDataArray[i];
        independentHeader = independentHeaderArray[i];
        JFreeChart scatterChart = chartFactory.getLineChart(
                "Scatter Plot of " + dependentHeader + " vs. " + independentHeader, independentHeader,
                dependentHeader, xData, yData, "noline");//getChart(title, xlabel, ylabel, xdata,ydata)

        //JFreeChart scatterChart = chartFactory.getQQChart("Scatter Plot of " + dependentHeader + " vs " + independentHeader, independentHeader, dependentHeader, dependentHeader , xData, yData,  "", 0, 0, "");

        chartPanel = new ChartPanel(scatterChart, false);
        chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
        innerPanel.add(chartPanel);
    }

    // this is only a test for having more than one charts in a boxlayout

    // 2. residual on fit plot: residuals vs. predicted

    JFreeChart rfChart = chartFactory.getLineChart("Residual on Fit Plot", "Predicted", "Residuals", predicted,
            residuals, "noline");

    //JFreeChart rfChart = chartFactory.getQQChart("Residual on Fit Plot", "Predicted", "Residuals", " Predicted Value  " , predicted, residuals,  "At Residual = 0", 0, 0, "");

    chartPanel = new ChartPanel(rfChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    // 3. residual on fit plot: residuals vs. xData
    /*JFreeChart rxChart = chartFactory.getLineChart("Residual on covariate Plot", "xData", "Residuals", xData, residuals);
    chartPanel = new ChartPanel(rxChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth,plotHeight));
    graphPanel.add(chartPanel);
    */
    for (int i = 0; i < xDataArray.length; i++) {
        xData = xDataArray[i];
        independentHeader = independentHeaderArray[i];
        JFreeChart scatterChart = chartFactory.getLineChart(
                "Residual on covariate Plot: Residuals vs. " + independentHeader, independentHeader,
                "Residuals", xData, yData, "noline");//getChart(title, xlabel, ylabel, xdata,ydata)
        //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "noline");

        //JFreeChart scatterChart = chartFactory.getQQChart("Residual on Covariate Plot: Residuals vs. " + independentHeader, independentHeader, "Residuals", "Residuals" , xData, residuals,  "At Residual = 0", 0, 0, "noline");

        chartPanel = new ChartPanel(scatterChart, false);
        chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
        innerPanel.add(chartPanel);
    }
    // 4. Normal QQ plot: need residuals and standardized normal scores
    //JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals);

    //JFreeChart qqChart = chartFactory.getQQChart("Residual Normal QQ Plot", "Theoretical Quantiles", "Standardized Residuals", "", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "", 0, 0, "");
    JFreeChart qqChart = chartFactory.getLineChart("Residual Normal QQ Plot", "Theoretical Quantiles",
            "Standardized Residuals", sortedStandardizedNormalQuantiles, sortedStandardizedResiduals, "noline");
    chartPanel = new ChartPanel(qqChart, false);
    chartPanel.setPreferredSize(new Dimension(plotWidth, plotHeight));
    innerPanel.add(chartPanel);

    graphPanel.validate();
}