The attached pic is the Editor thing I am working on, and i cannot for the life of me get JScrollPane working on it.. Please help me out!
Code:
//Creating JFrame for the Edit window
JFrame text = new JFrame("Text Field/Edit");
//Need the MenuBar for the Save choice
JMenuBar menuBar = new JMenuBar();
text.setDefaultLookAndFeelDecorated(true);
//A container to hold all the content
Container content = text.getContentPane();
text.setBackground(Color.GRAY);
text.setSize(800,300);
text.setLocation(500, 500);
//Setting the JPanel for the JTextArea and the ScrollBar
JPanel jp = new JPanel();
//jp.setLayout(new FlowLayout());
//this.field is the JTextField
this.field = new JTextArea(txt,70, 62);
this.field.setRows(70);
this.field.setColumns(62);
//Menu Bar Option
JMenu file = new JMenu("File");
//Does this not set the ScrollBar?
JScrollPane jsp = new JScrollPane(this.field);
//The line below this one, I thought this was suppose to set it, but doesnt.
//jsp.getViewport().add(this.field);
jsp.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
JMenuItem save = new JMenuItem("Save");
file.add(save);
save.setActionCommand("save");
save.addActionListener(this);
menuBar.add(file);
text.setJMenuBar(menuBar);
jp.add(this.field);
jp.add(jsp, BorderLayout.CENTER);
content.add(jp);
text.setVisible(true);