Example usage for javax.swing JLayeredPane setBorder

List of usage examples for javax.swing JLayeredPane setBorder

Introduction

In this page you can find the example usage for javax.swing JLayeredPane setBorder.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.")
public void setBorder(Border border) 

Source Link

Document

Sets the border of this component.

Usage

From source file:ecosim.gui.SummaryPane.java

/**
 *  Private method to build the text pane.
 *
 *  @return A JLayeredPane containing the text pane.
 *//*from   ww  w.  ja  v  a2s .  co m*/
private JLayeredPane makeTextPane() {
    final String ls = System.getProperty("line.separator");
    final String fmt = "Outgroup: %s" + ls + "Number: %,d" + ls + "Length: %,d" + ls + "Diversity: %.2f" + ls;

    final JLayeredPane pane = new JLayeredPane();
    final JTextArea summaryTextArea = new JTextArea(String.format(fmt, summary.getOutgroup(), summary.getNu(),
            summary.getLength(), summary.getDiversity()));
    summaryTextArea.setBackground(getBackground());
    pane.setBorder(BorderFactory.createTitledBorder("Sequences"));
    pane.setLayout(new FlowLayout(0));
    pane.add(summaryTextArea);
    // Watch for changes to the Summary object.
    summary.addObserver(new Observer() {
        public void update(Observable o, Object obj) {
            Summary s = (Summary) obj;
            ParameterEstimate estimate = s.getEstimate();
            summaryTextArea
                    .setText(String.format(fmt, s.getOutgroup(), s.getNu(), s.getLength(), s.getDiversity()));
            pane.repaint();
        }
    });
    return pane;
}