I've been doing some research about Swing in order to build a css editor with Java. I'm stuck trying to export CSS and HTML in JTextArea's ( I'll after create .css document. ) Here is the GridLayout that my main layout calls after clicking "Build" menu item.
package csseditor_gui_built;
import java.awt.GridLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextArea;
import javax.swing.JScrollPane;
import javax.swing.JScrollBar;
import javax.swing.text.DefaultCaret;
import java.awt.Font;
import java.awt.Color;
public class ExportGridLayout extends JFrame {
public ExportGridLayout(String HTML, String CSS){
GridLayout layout = new GridLayout(1,2,2,2);
setLayout(layout);
JTextArea textAreaHtml = new JTextArea();
JTextArea textAreaCss = new JTextArea();
//Creating a new font.
Font fontumuz = new Font("Courier New", Font.PLAIN, 12);
// Setting constructor strings
textAreaHtml.setText(HTML);
textAreaCss.setText(CSS);
//Additional details..
textAreaHtml.setEditable(false);
textAreaCss.setEditable(false);
//Appending font to the textArea's
textAreaHtml.setFont(fontumuz);
textAreaCss.setFont(fontumuz);
// Adding the objects to JFrame
add(textAreaHtml);
add(textAreaCss);
}
}
It's pretty straight forward. Just help me adding scroll bars or panes to these textArea's. Any other suggestions in the website do not work.