Example usage for javax.swing JTextArea JTextArea

List of usage examples for javax.swing JTextArea JTextArea

Introduction

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

Prototype

public JTextArea() 

Source Link

Document

Constructs a new TextArea.

Usage

From source file:DropTest2.java

public DropTest2() {
    super("Drop Test");
    setSize(300, 300);/*from w  ww . ja  v a2s.c om*/

    getContentPane().add(new JLabel("Drop a list from your file chooser here:"), BorderLayout.NORTH);
    ta = new JTextArea();
    ta.setBackground(Color.white);
    getContentPane().add(ta, BorderLayout.CENTER);

    // Set up our text area to recieve drops...
    // This class will handle drop events
    dt = new DropTarget(ta, this);
    setVisible(true);
}

From source file:Main.java

protected JTextComponent createTextComponent() {
    JTextArea ta = new JTextArea();
    ta.setLineWrap(true);
    return ta;
}

From source file:net.sf.firemox.deckbuilder.DeckRules.java

/**
 * Create a new instance of DeckRules//www.ja v  a 2s . com
 * 
 * @param parent
 */
public DeckRules(JFrame parent) {
    super(LanguageManager.getString("jdeckrules", MdbLoader.getTbsFullName()),
            LanguageManager.getString("jdeckrules.tooltip", MdbLoader.getTbsFullName()), "wiz_library_wiz.png",
            LanguageManager.getString("close"), 490, 300);
    // ... Set initial text, scrolling, and border.
    final JTextArea textRules = new JTextArea();
    textRules.setEditable(false);
    textRules.setLineWrap(true);
    textRules.setWrapStyleWord(true);
    textRules.setAutoscrolls(true);
    textRules.setTabSize(2);
    textRules.setText("No defined rules");
    BufferedReader inGPL = null;
    try {
        inGPL = new BufferedReader(new FileReader(MToolKit.getTbsFile(
                "decks/DECK_CONSTRAINTS-" + LanguageManager.getLanguage().getLocale() + "-lang.info")));
        textRules.read(inGPL, "Deck constraints");
    } catch (IOException e) {
        // Ignore this error
    } finally {
        IOUtils.closeQuietly(inGPL);
    }

    final JScrollPane scrollingArea = new JScrollPane(textRules);
    gameParamPanel.add(scrollingArea);
    pack();
}

From source file:com.k42b3.zubat.TrafficDetail.java

public TrafficDetail() {
    this.setTitle("zubat (version: " + Zubat.version + ")");

    this.setLocation(100, 100);

    this.setSize(600, 400);

    this.setMinimumSize(this.getSize());

    this.setLayout(new BorderLayout());

    tabPane = new JTabbedPane();

    txtRequest = new JTextArea();
    txtResponse = new JTextArea();

    tabPane.addTab("Request", new JScrollPane(txtRequest));
    tabPane.addTab("Response", new JScrollPane(txtResponse));

    this.add(tabPane, BorderLayout.CENTER);

    this.setVisible(true);
}

From source file:ProgressMonitorTest.java

public ProgressMonitorFrame() {
    setTitle("ProgressMonitorTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // this text area holds the activity output
    textArea = new JTextArea();

    // set up a button panel
    JPanel panel = new JPanel();
    startButton = new JButton("Start");
    panel.add(startButton);/*ww w.  j  a v  a2s .co  m*/

    add(new JScrollPane(textArea), BorderLayout.CENTER);
    add(panel, BorderLayout.SOUTH);

    // set up the button action

    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            startButton.setEnabled(false);
            final int MAX = 1000;

            // start activity
            activity = new SimulatedActivity(MAX);
            activity.execute();

            // launch progress dialog
            progressDialog = new ProgressMonitor(ProgressMonitorFrame.this, "Waiting for Simulated Activity",
                    null, 0, MAX);
            cancelMonitor.start();
        }
    });

    // set up the timer action

    cancelMonitor = new Timer(500, new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            if (progressDialog.isCanceled()) {
                activity.cancel(true);
                startButton.setEnabled(true);
            } else if (activity.isDone()) {
                progressDialog.close();
                startButton.setEnabled(true);
            } else {
                progressDialog.setProgress(activity.getProgress());
            }
        }
    });
}

From source file:Main.java

public ProgressBarFrame() {
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // this text area holds the activity output
    textArea = new JTextArea();

    // set up panel with button and progress bar

    final int MAX = 1000;
    JPanel panel = new JPanel();
    startButton = new JButton("Start");
    progressBar = new JProgressBar(0, MAX);
    progressBar.setStringPainted(true);/*from  ww w  . j a v a  2  s .c  o m*/
    panel.add(startButton);
    panel.add(progressBar);

    checkBox = new JCheckBox("indeterminate");
    checkBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            progressBar.setIndeterminate(checkBox.isSelected());
            progressBar.setStringPainted(!progressBar.isIndeterminate());
        }
    });
    panel.add(checkBox);
    add(new JScrollPane(textArea), BorderLayout.CENTER);
    add(panel, BorderLayout.SOUTH);

    // set up the button action

    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            startButton.setEnabled(false);
            activity = new SimulatedActivity(MAX);
            activity.execute();
        }
    });
}

From source file:SplitPaneTest.java

public SplitPaneFrame() {
    setTitle("SplitPaneTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // set up components for planet names, images, descriptions

    final JList planetList = new JList(planets);
    final JLabel planetImage = new JLabel();
    final JTextArea planetDescription = new JTextArea();

    planetList.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent event) {
            Planet value = (Planet) planetList.getSelectedValue();

            // update image and description

            planetImage.setIcon(value.getImage());
            planetDescription.setText(value.getDescription());
        }//w w w.j  ava  2s .c o m
    });

    // set up split panes

    JSplitPane innerPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, planetList, planetImage);

    innerPane.setContinuousLayout(true);
    innerPane.setOneTouchExpandable(true);

    JSplitPane outerPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT, innerPane, planetDescription);

    add(outerPane, BorderLayout.CENTER);
}

From source file:com.sec.ose.osi.ui.dialog.about.JPanAbout.java

public JTextArea getJTextAreaAbout() {
    if (jTextAreaAbout == null) {
        jTextAreaAbout = new JTextArea();
        jTextAreaAbout.setEditable(false);
        jTextAreaAbout.setLineWrap(true);
        jTextAreaAbout.setMargin(new Insets(15, 15, 15, 15));
        jTextAreaAbout.setText(getLicenseText());
    }/*from w w  w.java  2  s. c om*/
    return jTextAreaAbout;
}

From source file:ProgressBarTest.java

public ProgressBarFrame() {
    setTitle("ProgressBarTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    // this text area holds the activity output
    textArea = new JTextArea();

    // set up panel with button and progress bar

    final int MAX = 1000;
    JPanel panel = new JPanel();
    startButton = new JButton("Start");
    progressBar = new JProgressBar(0, MAX);
    progressBar.setStringPainted(true);//from  w w w.  ja v  a  2 s  . c  o m
    panel.add(startButton);
    panel.add(progressBar);

    checkBox = new JCheckBox("indeterminate");
    checkBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            progressBar.setIndeterminate(checkBox.isSelected());
            progressBar.setStringPainted(!progressBar.isIndeterminate());
        }
    });
    panel.add(checkBox);
    add(new JScrollPane(textArea), BorderLayout.CENTER);
    add(panel, BorderLayout.SOUTH);

    // set up the button action

    startButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            startButton.setEnabled(false);
            activity = new SimulatedActivity(MAX);
            activity.execute();
        }
    });
}

From source file:TextTransferTest.java

public TextTransferFrame() {
    setTitle("TextTransferTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    textArea = new JTextArea();
    add(new JScrollPane(textArea), BorderLayout.CENTER);
    JPanel panel = new JPanel();

    JButton copyButton = new JButton("Copy");
    panel.add(copyButton);/*from ww w. j av  a2 s  . com*/
    copyButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            copy();
        }
    });

    JButton pasteButton = new JButton("Paste");
    panel.add(pasteButton);
    pasteButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            paste();
        }
    });

    add(panel, BorderLayout.SOUTH);
}