| 1 | /* |
| 2 | * TerminalPanel.java |
| 3 | * |
| 4 | * Copyright (c) 2002-2015 Alexei Drummond, Andrew Rambaut and Marc Suchard |
| 5 | * |
| 6 | * This file is part of BEAST. |
| 7 | * See the NOTICE file distributed with this work for additional |
| 8 | * information regarding copyright ownership and licensing. |
| 9 | * |
| 10 | * BEAST is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU Lesser General Public License as |
| 12 | * published by the Free Software Foundation; either version 2 |
| 13 | * of the License, or (at your option) any later version. |
| 14 | * |
| 15 | * BEAST is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU Lesser General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU Lesser General Public |
| 21 | * License along with BEAST; if not, write to the |
| 22 | * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, |
| 23 | * Boston, MA 02110-1301 USA |
| 24 | */ |
| 25 | |
| 26 | package dr.app.bss; |
| 27 | |
| 28 | import java.awt.BorderLayout; |
| 29 | |
| 30 | import javax.swing.BoxLayout; |
| 31 | import javax.swing.JPanel; |
| 32 | import javax.swing.JScrollPane; |
| 33 | import javax.swing.JTextArea; |
| 34 | import javax.swing.ScrollPaneConstants; |
| 35 | |
| 36 | @SuppressWarnings("serial") |
| 37 | public class TerminalPanel extends JPanel { |
| 38 | |
| 39 | private JTextArea textArea; |
| 40 | |
| 41 | public TerminalPanel() { |
| 42 | |
| 43 | // Setup miscallenous |
| 44 | setLayout(new BoxLayout(this, BoxLayout.LINE_AXIS)); |
| 45 | |
| 46 | // Setup text area |
| 47 | textArea = new JTextArea(); |
| 48 | textArea.setEditable(true); |
| 49 | textArea.setLineWrap(true); |
| 50 | textArea.setWrapStyleWord(true); |
| 51 | |
| 52 | JScrollPane scrollPane = new JScrollPane(textArea, |
| 53 | ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, |
| 54 | ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS); |
| 55 | add(scrollPane, BorderLayout.CENTER); |
| 56 | |
| 57 | }// END: Constructor |
| 58 | |
| 59 | public void setText(String text) { |
| 60 | textArea.append(text); |
| 61 | }//END: setText |
| 62 | |
| 63 | public void clearTerminal() { |
| 64 | textArea.setText(""); |
| 65 | }//END: clearTerminal |
| 66 | |
| 67 | }// END: class |