/*******************************************************************************
* gMix open source project - https://svs.informatik.uni-hamburg.de/gmix/
* Copyright (C) 2014 SVS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*******************************************************************************/
package staticContent.evaluation.simulator.gui.results;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
/**
* @author Infectiou
*
*/
@SuppressWarnings("serial")
public class TextResult extends JPanel {
private JTextArea textArea;
private JScrollPane scroll;
/**
* @param text
* @return
*/
private TextResult TextResult(String text) {
this.textArea = new JTextArea();
this.scroll = new JScrollPane(textArea);
GridBagLayout gridBagLayout = new GridBagLayout();
GridBagConstraints gridBagConstraints = new GridBagConstraints();
gridBagConstraints.fill = gridBagConstraints.BOTH;
gridBagConstraints.anchor = GridBagConstraints.NORTH;
gridBagConstraints.weightx = 1;
gridBagConstraints.weighty = 1;
gridBagConstraints.gridx = GridBagConstraints.RELATIVE;
gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
gridBagLayout.setConstraints(this, gridBagConstraints);
this.setLayout( gridBagLayout );
this.textArea.setEditable(false);
this.add(this.scroll, gridBagConstraints);
this.textArea.setVisible(true);
this.scroll.setVerticalScrollBarPolicy( JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
this.scroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED );
this.textArea.setText(text);
return this;
}
public TextResult TextResult() {
return TextResult("No results found");
}
}