// GraphTea Project: http://github.com/graphtheorysoftware/GraphTea
// Copyright (C) 2012 Graph Theory Software Foundation: http://GraphTheorySoftware.com
// Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
// Distributed under the terms of the GNU Lesser General Public License (LGPL): http://www.gnu.org/licenses/
package graphtea.plugins.commonplugin.reporter;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class TextBox extends JFrame {
JPanel contentPane;
JButton buttonOK;
JTextArea textArea1;
public TextBox() {
setContentPane(contentPane);
getRootPane().setDefaultButton(buttonOK);
buttonOK.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
onOK();
}
});
}
private void onOK() {
// add your code here
dispose();
}
public static void showTextDialog(String dialogTitle, String text) {
TextBox dialog = new TextBox();
dialog.setTitle(dialogTitle);
dialog.textArea1.setText(text);
dialog.setSize(700, 600);
dialog.setVisible(true);
}
public String getText(){
return textArea1.getText();
}
public static TextBox editTextDialog(String title, String text) {
TextBox dialog = new TextBox();
dialog.setTitle(title);
dialog.textArea1.setText(text);
dialog.setSize(700, 600);
dialog.setVisible(true);
return dialog;
}
{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}
/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
contentPane = new JPanel();
contentPane.setLayout(new GridBagLayout());
buttonOK = new JButton();
buttonOK.setText("ok");
GridBagConstraints gbc;
gbc = new GridBagConstraints();
gbc.gridx = 1;
gbc.gridy = 1;
gbc.fill = GridBagConstraints.HORIZONTAL;
contentPane.add(buttonOK, gbc);
final JPanel spacer1 = new JPanel();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 1;
gbc.weightx = 1.0;
gbc.fill = GridBagConstraints.HORIZONTAL;
contentPane.add(spacer1, gbc);
final JScrollPane scrollPane1 = new JScrollPane();
gbc = new GridBagConstraints();
gbc.gridx = 0;
gbc.gridy = 0;
gbc.gridwidth = 2;
gbc.weightx = 1.0;
gbc.weighty = 1.0;
gbc.fill = GridBagConstraints.BOTH;
contentPane.add(scrollPane1, gbc);
textArea1 = new JTextArea();
scrollPane1.setViewportView(textArea1);
}
/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return contentPane;
}
}