Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.BorderLayout;
- import javax.swing.JPanel;
- import javax.swing.JScrollPane;
- import javax.swing.JTextArea;
- public class TextPanel extends JPanel {
- // Variables-components
- private JTextArea textArea;
- // Constructor
- public TextPanel() {
- // Initialize the variables
- textArea = new JTextArea();
- // Create the layout and determine the position of textArea
- setLayout(new BorderLayout());
- add(new JScrollPane(textArea), BorderLayout.CENTER); // Gia na mporw na scrollarw stin textArea (tin pernaw san orisma sto JScrollPane)
- }
- // Methods
- public void appendText(String text) {
- textArea.append(text);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement