Example usage for javax.swing BorderFactory createEtchedBorder

List of usage examples for javax.swing BorderFactory createEtchedBorder

Introduction

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

Prototype

public static Border createEtchedBorder() 

Source Link

Document

Creates a border with an "etched" look using the component's current background color for highlighting and shading.

Usage

From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java

/**
 * Calculates and displays values of 'time in between' metrics of two
 * transitions.//from  w w w  .  ja v  a2 s.c  o  m
 * @param lastTransition ExtendedTransition: one of the two transitions
 * @param otherTransition ExtendedTransition: one of the two transitions
 */
private void displayTransitionMetrics(ExtendedTransition lastTransition, ExtendedTransition otherTransition) {
    //clear the table Panel
    tablePanel.removeAll();
    //create a transition analysis object
    TransitionAnalysis ta = new TransitionAnalysis(lastTransition, otherTransition);
    try {
        //calculate the time-metrics
        ta.calculateMetrics(getSelectedInstanceIDs(), advancedSettings[2], failedInstances);
        //initialize the transition time-metrics table
        OneMetricTableModel ttm = new OneMetricTableModel();
        ttm.setHeadings("", "Time in between (" + timeSort + ")");
        transitionTable = new JTable(ttm);
        transitionTable.setBorder(BorderFactory.createEtchedBorder());
        transitionTable.setPreferredSize(new Dimension(300, 112));
        transitionTable.setMinimumSize(new Dimension(280, 112));
        transitionTable.getColumnModel().getColumn(0).setPreferredWidth(80);
        transitionTable.getColumnModel().getColumn(0).setMaxWidth(150);
        transitionTable.setRowSelectionAllowed(false);
        transitionTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12));
        DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer();
        dtcr.setBackground(new Color(235, 235, 235));
        dtcr.setFont(new Font("SansSerif", Font.BOLD, 12));
        transitionTable.getColumnModel().getColumn(0).setCellRenderer(dtcr);
        //add the table to the tablePanel
        tablePanel.add(transitionTable.getTableHeader(), BorderLayout.PAGE_START);
        tablePanel.add(transitionTable, BorderLayout.CENTER);

        //frequency of process instances in which both transitions occur
        freqObjectLabel.setText(ta.getFrequency() + "" + " cases");
        //fill table with 'in-between-times'
        transitionTable.setValueAt(formatString(ta.getMeanTime() / timeDivider, decimalPlaces), 0, 1);
        transitionTable.setValueAt(formatString((ta.getMinTime() * 1.0) / timeDivider, decimalPlaces), 1, 1);
        transitionTable.setValueAt(formatString((ta.getMaxTime() * 1.0) / timeDivider, decimalPlaces), 2, 1);
        transitionTable.setValueAt(formatString(ta.getStdevTimeInBetween() / timeDivider, decimalPlaces), 3, 1);
        //place average of fastest traces in the table
        DecimalFormat df = new DecimalFormat("0.00");
        int[] sizes = ta.getSizes(fastestBetweenPercentage, slowestBetweenPercentage);
        transitionTable.setValueAt("fast " + df.format(fastestBetweenPercentage) + "%(" + sizes[0] + ")", 4, 0);
        transitionTable.setValueAt("slow " + df.format(slowestBetweenPercentage) + "%(" + sizes[1] + ")", 5, 0);
        transitionTable.setValueAt("normal "
                + df.format(100 - fastestBetweenPercentage - slowestBetweenPercentage) + "%(" + sizes[2] + ")",
                6, 0);
        double[] avgTimes = ta.getAverageTimes(fastestBetweenPercentage, slowestBetweenPercentage);
        transitionTable.setValueAt(formatString(avgTimes[0] / timeDivider, decimalPlaces), 4, 1);
        //place average of slowest traces in the table
        transitionTable.setValueAt(formatString(avgTimes[1] / timeDivider, decimalPlaces), 5, 1);
        //place average of other traces in the table
        transitionTable.setValueAt(formatString(avgTimes[2] / timeDivider, decimalPlaces), 6, 1);

        //make metrics visible
        changePercentagesButton.setVisible(true);
        exportButton.setVisible(true);
        titleLabel.setVisible(true);
        titleLabel.setText("Performance information of the selected transitions:");
        numberObjectLabel.setVisible(true);
        freqObjectLabel.setVisible(true);
        transitionTable.repaint();
        metricsBottomPanel.revalidate();
    } catch (Exception ex) {
        Message.add(
                "An internal error occured while calculating" + " time in between metrics.\n" + ex.toString(),
                2);
        ex.printStackTrace();
    }
}

From source file:org.prom5.analysis.performance.PerformanceAnalysisGUI.java

/**
 * Calculates metrics related to activities, such as waiting time, execution
 * time and throughput time. and displays these on the metricsBottomPanel,
 *
 * @param activity ExtendedActivity: the activity involved
 */// www.  j  a  va  2  s  .  c o  m
private void displayActivityMetrics(ExtendedActivity activity) {
    tablePanel.removeAll();
    try {
        //calculate time-metrics of the activity based on the selected instances
        activity.calculateMetrics(getSelectedInstanceIDs(), advancedSettings[3], failedInstances);
        activity.checkWhichMetricsToUse();
        //initialize the activityTable
        ThreeMetricsRowExtraTableModel atm = new ThreeMetricsRowExtraTableModel();
        atm.setHeadings("", "Waiting time (" + timeSort + ")", "Execution" + " time (" + timeSort + ")",
                "Sojourn time (" + timeSort + ")");
        activityTable.setModel(atm);
        activityTable.setBorder(BorderFactory.createEtchedBorder());
        activityTable.setPreferredSize(new Dimension(480, 128));
        activityTable.setMinimumSize(new Dimension(480, 128));
        activityTable.getColumnModel().getColumn(0).setPreferredWidth(60);
        activityTable.getColumnModel().getColumn(0).setMaxWidth(150);
        DefaultTableCellRenderer dtcr = new DefaultTableCellRenderer();
        dtcr.setBackground(new Color(235, 235, 235));
        activityTable.getColumnModel().getColumn(0).setCellRenderer(dtcr);
        activityTable.setRowSelectionAllowed(false);
        activityTable.getTableHeader().setFont(new Font("SansSerif", Font.BOLD, 12));

        /*
        Iterator entries = mapping.entrySet().iterator();
        while (entries.hasNext()) {
           Map.Entry entr = (Map.Entry) entries.next();
           if (entr.getKey() instanceof ExtendedTransition) {
              ExtendedTransition transition = (ExtendedTransition) entr.getKey();
              ExtendedActivity act = transition.getAssociatedActivity();
              if (act != null) {
          act.calculateMetrics(getSelectedInstanceIDs(), advancedSettings[3], failedInstances);
          act.checkWhichMetricsToUse();
          act.getArrivalRate();
              }
           }
        }*/
        //fill table with the calculated activity time-metrics
        TableCellRenderer renderer = new CustomTableCellRenderer(activity.getBoundWaitingUsed(),
                activity.getBoundExecutionUsed(), activity.getBoundSojournUsed());
        activityTable.setDefaultRenderer(Class.forName("java.lang.String"), renderer);
        activityTable.setValueAt(formatString(activity.getMeanWaitTime() / timeDivider, decimalPlaces), 0, 1);
        activityTable.setValueAt(formatString(activity.getMeanExecutionTime() / timeDivider, decimalPlaces), 0,
                2);
        activityTable.setValueAt(formatString(activity.getMeanSojournTime() / timeDivider, decimalPlaces), 0,
                3);
        activityTable.setValueAt(formatString(activity.getMinWaitTime() / timeDivider, decimalPlaces), 1, 1);
        activityTable.setValueAt(formatString(activity.getMinExecutionTime() / timeDivider, decimalPlaces), 1,
                2);
        activityTable.setValueAt(formatString(activity.getMinSojournTime() / timeDivider, decimalPlaces), 1, 3);
        activityTable.setValueAt(formatString(activity.getMaxWaitTime() / timeDivider, decimalPlaces), 2, 1);
        activityTable.setValueAt(formatString(activity.getMaxExecutionTime() / timeDivider, decimalPlaces), 2,
                2);
        activityTable.setValueAt(formatString(activity.getMaxSojournTime() / timeDivider, decimalPlaces), 2, 3);
        activityTable.setValueAt(formatString(activity.getStdevWaitTime() / timeDivider, decimalPlaces), 3, 1);
        activityTable.setValueAt(formatString(activity.getStdevExecutionTime() / timeDivider, decimalPlaces), 3,
                2);
        activityTable.setValueAt(formatString(activity.getStdevSojournTime() / timeDivider, decimalPlaces), 3,
                3);
        double[] avgWaitTimes = activity.getAvgWaitTimes(fastestActivityPercentage, slowestActivityPercentage);
        double[] avgExecutionTimes = activity.getAvgExecutionTimes(fastestActivityPercentage,
                slowestActivityPercentage);
        double[] avgThroughputTimes = activity.getAvgSojournTimes(fastestActivityPercentage,
                slowestActivityPercentage);
        activityTable.setValueAt(formatString(avgWaitTimes[0] / timeDivider, decimalPlaces), 4, 1);
        activityTable.setValueAt(formatString(avgExecutionTimes[0] / timeDivider, decimalPlaces), 4, 2);
        activityTable.setValueAt(formatString(avgThroughputTimes[0] / timeDivider, decimalPlaces), 4, 3);
        activityTable.setValueAt(formatString(avgWaitTimes[1] / timeDivider, decimalPlaces), 5, 1);
        activityTable.setValueAt(formatString(avgExecutionTimes[1] / timeDivider, decimalPlaces), 5, 2);
        activityTable.setValueAt(formatString(avgThroughputTimes[1] / timeDivider, decimalPlaces), 5, 3);
        activityTable.setValueAt(formatString(avgWaitTimes[2] / timeDivider, decimalPlaces), 6, 1);
        activityTable.setValueAt(formatString(avgExecutionTimes[2] / timeDivider, decimalPlaces), 6, 2);
        activityTable.setValueAt(formatString(avgThroughputTimes[2] / timeDivider, decimalPlaces), 6, 3);
        activityTable.setValueAt(activity.getFrequencyWait() + "", 7, 1);
        activityTable.setValueAt(activity.getFrequencyExecution() + "", 7, 2);
        activityTable.setValueAt(activity.getFrequencySojourn() + "", 7, 3);

        DecimalFormat df = new DecimalFormat("0.00");
        activityTable.setValueAt("fast " + df.format(fastestActivityPercentage) + "%", 4, 0);
        activityTable.setValueAt("slow " + df.format(slowestActivityPercentage) + "%", 5, 0);
        activityTable.setValueAt(
                "normal " + df.format(100 - fastestActivityPercentage - slowestActivityPercentage) + "%", 6, 0);
        ratePlaceLabel.setText(formatString(activity.getArrivalRate() * timeDivider, decimalPlaces)
                + " visits per " + timeSort.substring(0, timeSort.length() - 1));
        //add the table to the tablePanel
        tablePanel.add(activityTable.getTableHeader(), BorderLayout.PAGE_START);
        tablePanel.add(activityTable, BorderLayout.CENTER);
        //display the title
        titleLabel.setText("Performance information of activity " + activity.getName() + ":");
        titleLabel.setVisible(true);
        arrivalPlaceLabel.setVisible(true);
        ratePlaceLabel.setVisible(true);
        changePercentagesButton.setVisible(true);
        exportButton.setVisible(true);
        activityTable.repaint();
        metricsBottomPanel.revalidate();
    } catch (Exception ex) {
        Message.add("An internal error occured while calculating " + " activity metrics.\n" + ex.toString(), 2);
        ex.printStackTrace();
    }
}

From source file:org.quackedcube.impl.Gui.java

public JComponent generateContent() {
    //Inital creation
    JPanel clockPanel = new JPanel(new BorderLayout());
    JPanel virtualCubePanel = new JPanel(new BorderLayout());
    JPanel logPanel = new JPanel(new BorderLayout());
    virtualCubePanel/* w ww.j  a v a  2  s. co  m*/
            .setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Cube Position"));
    logPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Log"));

    //Clock setup
    clock = new Clock();
    clock.setPreferredSize(new Dimension((int) clock.getPreferredSize().getWidth(), 100));
    clock.setFont(new Font("Arial", Font.PLAIN, 180));
    clock.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(), "Timer"));
    clock.setAlignmentX(JComponent.CENTER_ALIGNMENT);
    clockPanel.add(clock, BorderLayout.CENTER);

    //Logging panel setup
    logScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    logScroll.setAlignmentX(Component.RIGHT_ALIGNMENT);
    logPane.setEditable(false);
    logPane.setAlignmentX(Component.CENTER_ALIGNMENT);
    logPanel.add(logScroll, BorderLayout.CENTER);

    //Virtual Cube panel
    log.trace("Creating virtual cube");
    virtualCubePanel.add(virtualCube = new VirtualBuilder(), BorderLayout.CENTER);
    log.trace("Done creating virtual cube.");
    JPanel virtualCubeControl = new JPanel(new FlowLayout());
    virtualCubeControl.add(new JButton("Rotate") {
        {
            final JButton self = this;
            addActionListener(new ActionListener() {
                final String start = "Rotate";
                final String end = "Stop Rotating";

                @Override
                public void actionPerformed(ActionEvent e) {
                    if (self.getText().equals(start)) {
                        Gui.this.virtualCube.rotate();
                        self.setText(end);
                    } else if (self.getText().equals(end)) {
                        Gui.this.virtualCube.stopRotating();
                        self.setText(start);
                    }
                }
            });
        }
    });
    virtualCubeControl.add(new JButton("Reset Position") {
        {
            addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    Gui.this.virtualCube.resetPosition();
                }
            });
            setEnabled(false);
        }
    });
    virtualCubePanel.add(virtualCubeControl, BorderLayout.SOUTH);

    log.trace("Creating content pane");
    JPanel contentPane = new JPanel(new MigLayout("fill", "fill", "fill"));
    contentPane.add(clock, "dock north"); //span 2, hmax 25%, wrap
    contentPane.add(virtualCubePanel, "growprio 20");
    contentPane.add(logPanel, "span 1 2");

    return contentPane;
}

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

/**
 * Creates the tooltip for the component. This changes the default tooltip by
 * setting a different border./*from www .j ava  2s  .  c o m*/
 * 
 * @return  the tooltip created
 */
public JToolTip createToolTip() {
    JToolTip toolTip = super.createToolTip();
    toolTip.setBackground(Color.decode("#FFFFFC"));
    toolTip.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    return toolTip;
}

From source file:org.zaproxy.zap.extension.encoder2.EncodeDecodeDialog.java

private ZapTextArea newField(boolean editable) {
    final ZapTextArea field = new ZapTextArea();
    field.setLineWrap(true);/* w w w . j a v  a2 s . co m*/
    field.setBorder(BorderFactory.createEtchedBorder());
    field.setEditable(editable);
    field.setName(ENCODE_DECODE_RESULTFIELD);

    field.addMouseListener(new java.awt.event.MouseAdapter() {
        @Override
        public void mousePressed(java.awt.event.MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                View.getSingleton().getPopupMenu().show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });

    return field;
}

From source file:org.zaproxy.zap.view.MainToolbarPanel.java

public void initialise() {
    setLayout(new java.awt.GridBagLayout());
    setPreferredSize(DisplayUtils.getScaledDimension(getMaximumSize().width, 25));
    setMaximumSize(DisplayUtils.getScaledDimension(getMaximumSize().width, 25));
    this.setBorder(BorderFactory.createEtchedBorder());

    expandButtons = new ButtonGroup();

    GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
    GridBagConstraints gridBagConstraints2 = new GridBagConstraints();

    gridBagConstraints1.gridx = 0;//from  w w w  .j av a2  s. c  o  m
    gridBagConstraints1.gridy = 0;
    gridBagConstraints1.anchor = java.awt.GridBagConstraints.WEST;

    gridBagConstraints2.gridx = 1;
    gridBagConstraints2.gridy = 0;
    gridBagConstraints2.weightx = 1.0;
    gridBagConstraints2.weighty = 1.0;
    gridBagConstraints2.anchor = java.awt.GridBagConstraints.EAST;
    gridBagConstraints2.fill = java.awt.GridBagConstraints.HORIZONTAL;

    JToolBar t1 = new JToolBar();
    t1.setEnabled(true);
    t1.setPreferredSize(new java.awt.Dimension(80000, 25));
    t1.setMaximumSize(new java.awt.Dimension(80000, 25));

    add(getToolbar(), gridBagConstraints1);
    add(t1, gridBagConstraints2);

    toolbar.add(getModeSelect());
    toolbar.add(getBtnNew());
    toolbar.add(getBtnOpen());
    toolbar.add(getBtnSave());
    toolbar.add(getBtnSnapshot());
    toolbar.add(getBtnSession());
    toolbar.add(getBtnOptions());

    toolbar.addSeparator();
    toolbar.add(getShowAllTabs());
    toolbar.add(getHideAllTabs());
    toolbar.add(getShowTabIconNames());
    toolbar.addSeparator();

    toolbar.add(getBtnExpandSites());
    toolbar.add(getBtnExpandReports());
    toolbar.add(getBtnExpandFull());

    toolbar.addSeparator();
}

From source file:ru.medved.json.wssoap.WebServiceSamplerGui.java

private final JPanel createTopPanel() {
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new VerticalLayout(5, VerticalLayout.BOTH));

    JPanel wsdlHelper = new JPanel();
    wsdlHelper.setLayout(new BoxLayout(wsdlHelper, BoxLayout.Y_AXIS));
    wsdlHelper.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("webservice_configuration_wizard"))); // $NON-NLS-1$

    // Button for browsing webservice wsdl
    JPanel wsdlEntry = new JPanel();
    wsdlEntry.setLayout(new BoxLayout(wsdlEntry, BoxLayout.X_AXIS));
    Border margin = new EmptyBorder(0, 5, 0, 5);
    wsdlEntry.setBorder(margin);// w ww .ja  va2s.  com
    wsdlHelper.add(wsdlEntry);
    wsdlEntry.add(wsdlField);
    wsdlEntry.add(wsdlButton);
    wsdlButton.addActionListener(this);

    // Web Methods
    JPanel listPanel = new JPanel();
    listPanel.setLayout(new FlowLayout(FlowLayout.LEFT));
    JLabel selectLabel = new JLabel(JMeterUtils.getResString("webservice_methods")); // $NON-NLS-1$
    wsdlMethods = new JLabeledChoice();
    wsdlHelper.add(listPanel);
    listPanel.add(selectLabel);
    listPanel.add(wsdlMethods);
    listPanel.add(selectButton);
    selectButton.addActionListener(this);

    topPanel.add(wsdlHelper);

    JPanel urlPane = new JPanel();
    urlPane.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
    urlPane.add(protocol);
    urlPane.add(Box.createRigidArea(new Dimension(5, 0)));
    urlPane.add(domain);
    urlPane.add(Box.createRigidArea(new Dimension(5, 0)));
    urlPane.add(port);
    urlPane.add(Box.createRigidArea(new Dimension(5, 0)));
    urlPane.add(connectTimeout);
    topPanel.add(urlPane);

    topPanel.add(path);
    topPanel.add(soapAction);

    topPanel.add(jsonConfigFile);
    topPanel.add(configSection);
    return topPanel;
}

From source file:ru.medved.json.wssoap.WebServiceSamplerGui.java

private final JPanel createMessagePanel() {
    JPanel msgPanel = new JPanel();
    msgPanel.setLayout(new BorderLayout(5, 0));
    msgPanel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
            JMeterUtils.getResString("webservice_message_soap"))); // $NON-NLS-1$

    JPanel soapXmlPane = new JPanel();
    soapXmlPane.setLayout(new BorderLayout(5, 0));
    soapXmlPane.setBorder(BorderFactory.createTitledBorder(JMeterUtils.getResString("soap_data_title"))); // $NON-NLS-1$
    soapXmlPane.setPreferredSize(new Dimension(4, 4)); // Permit dynamic
    // resize of/*from ww w. j av  a 2  s.  com*/
    // TextArea
    soapXml = new JTextArea();
    soapXml.setLineWrap(true);
    soapXml.setWrapStyleWord(true);
    soapXml.setTabSize(4); // improve xml display
    soapXmlPane.add(new JScrollPane(soapXml), BorderLayout.CENTER);
    msgPanel.add(soapXmlPane, BorderLayout.CENTER);

    JPanel southPane = new JPanel();
    southPane.setLayout(new BoxLayout(southPane, BoxLayout.Y_AXIS));
    southPane.add(soapXmlFile);
    JPanel randomXmlPane = new JPanel();
    randomXmlPane.setLayout(new BorderLayout(5, 0));
    randomXmlPane.setBorder(
            BorderFactory.createTitledBorder(JMeterUtils.getResString("webservice_get_xml_from_random_title"))); // $NON-NLS-1$
    randomXmlPane.add(randomXmlFile, BorderLayout.CENTER);
    southPane.add(randomXmlPane);
    msgPanel.add(southPane, BorderLayout.SOUTH);
    return msgPanel;
}

From source file:savant.chromatogram.ChromatogramPlugin.java

@Override
public void init(JPanel panel) {

    NavigationUtils.addLocationChangedListener(new Listener<LocationChangedEvent>() {
        @Override/*from   www .j  a  v a2s .  c om*/
        public void handleEvent(LocationChangedEvent event) {
            updateChromatogram();
        }
    });
    GenomeUtils.addGenomeChangedListener(new Listener<GenomeChangedEvent>() {
        @Override
        public void handleEvent(GenomeChangedEvent event) {
            updateChromatogram();
        }
    });
    panel.setLayout(new GridBagLayout());
    panel.setBorder(BorderFactory.createEtchedBorder());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(new JLabel("File:"), gbc);

    pathField = new JTextField();
    gbc.gridwidth = 3;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(pathField, gbc);

    JButton browseButton = new JButton("Browse\u2026");
    browseButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            File f = DialogUtils.chooseFileForOpen("Chromatogram File", null, null);
            if (f != null) {
                try {
                    pathField.setText(f.getAbsolutePath());
                    if (canvas != null) {
                        canvas.getParent().remove(canvas);
                        canvas = null;
                    }
                    chromatogram = ChromatogramFactory.create(f);
                    updateEndField();
                    updateChromatogram();
                } catch (UnsupportedChromatogramFormatException x) {
                    DialogUtils.displayMessage("Unable to Open Chromatogram", String.format(
                            "<html><i>%s</i> does not appear to be a valid chromatogram file.<br><br><small>Supported formats are ABI and SCF.</small></html>",
                            f.getName()));
                } catch (Exception x) {
                    DialogUtils.displayException("Unable to Open Chromatogram",
                            String.format("<html>There was an error opening <i>%s</i>.</html>", f.getName()),
                            x);
                }
            }
        }
    });
    gbc.weightx = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    panel.add(browseButton, gbc);

    JLabel startLabel = new JLabel("Start Base:");
    gbc.gridy++;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(startLabel, gbc);

    startField = new JTextField("0");
    startField.setColumns(12);
    startField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            updateEndField();
        }
    });
    gbc.weightx = 0.5;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(startField, gbc);

    JLabel endLabel = new JLabel("End Base:");
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(endLabel, gbc);

    endField = new JTextField();
    endField.setColumns(12);
    endField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            try {
                NumberFormat numberParser = NumberFormat.getIntegerInstance();
                int endBase = numberParser.parse(endField.getText()).intValue();
                if (chromatogram != null) {
                    int startBase = endBase - chromatogram.getSequenceLength();
                    startField.setText(String.valueOf(startBase));
                    if (canvas != null) {
                        canvas.updatePos(startBase);
                    }
                }
            } catch (ParseException x) {
                Toolkit.getDefaultToolkit().beep();
            }
        }
    });
    gbc.weightx = 0.5;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(endField, gbc);

    JCheckBox fillCheck = new JCheckBox("Fill Background");
    fillCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            canvas.updateFillbackground(((JCheckBox) ae.getSource()).isSelected());
        }
    });
    gbc.gridy++;
    gbc.gridx = 1;
    gbc.weightx = 0.0;
    panel.add(fillCheck, gbc);

    // Add a filler panel at the bottom to force our components to the top.
    gbc.gridy++;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1.0;
    panel.add(new JPanel(), gbc);
}

From source file:se.cambio.cds.gdl.editor.view.panels.DescriptionPanel.java

public JPanel getDescriptionPanel() {
    if (descriptionPanel == null) {
        descriptionPanel = new JPanel(new BorderLayout());
        JTextArea ta = new JTextArea();
        ta.setLineWrap(true);//from   w  ww. j a  v a2 s. c  om
        ta.setWrapStyleWord(true);
        connect(_conceptContext, "/description", ta);
        ta.setBorder(BorderFactory.createEtchedBorder());
        descriptionPanel.add(ta, BorderLayout.CENTER);
    }
    return descriptionPanel;
}