List of usage examples for javax.swing JLayeredPane setBorder
@BeanProperty(preferred = true, visualUpdate = true, description = "The component's border.") public void setBorder(Border border)
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; }