Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
TriPOINT/src/edu/uconn/tripoint/ui/CommandOutputPanel.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
41 lines (32 sloc)
1.05 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.uconn.tripoint.ui; | |
import java.awt.BorderLayout; | |
import java.awt.Font; | |
import javax.swing.BoxLayout; | |
import javax.swing.JLabel; | |
import javax.swing.JPanel; | |
import javax.swing.JScrollPane; | |
import javax.swing.JTextArea; | |
@SuppressWarnings("serial") | |
public class CommandOutputPanel extends JPanel { | |
private JTextArea _ota; | |
public CommandOutputPanel(Font font){ | |
setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); | |
JLabel sol = new JLabel("Command Line Output:"); | |
sol.setHorizontalAlignment(JLabel.LEFT); | |
sol.setFont(font); | |
_ota = new JTextArea(15, 35); | |
_ota.setEditable(false); | |
JScrollPane osp = new JScrollPane(_ota); | |
osp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); | |
osp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS); | |
JPanel opanel = new JPanel(new BorderLayout()); | |
opanel.add(sol, BorderLayout.NORTH); | |
opanel.add(osp, BorderLayout.CENTER); | |
add(opanel); | |
} | |
public void addLine(String s){ | |
_ota.append(s+"\n"); | |
revalidate(); | |
repaint(); | |
} | |
} |