Adding Scroll to Display
Hi ive been reading through the scoll tutorials but still cant add a working scroll bar to my display. This is what ive come up with so far:
private JTextArea display, display2, textArea;
private JScrollPane scroll;
//setting up scroll bar.
display =new JTextArea(5, 30);
JScrollPane scrollPane =new JScrollPane(display);
setPreferredSize(new Dimension(450, 110));
add(scrollPane, BorderLayout.CENTER);
JScrollPane ScrollPane =new JScrollPane(display,JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
//display which needs scroll bar
display =new JTextArea();
display.setText("" );
display.setBorder(new LineBorder(Color.BLACK));
display.setFont(new Font("Candara", Font.BOLD, 13));
display.setLineWrap(true);
display.setBackground(Color.WHITE);
display.setOpaque(true);
display.setBounds(10, 5, 420, 340);
mainPanel.add( display );
display.setLayout(null);
display.setEditable (false);
That is not the full code listing but everything that ive done to try and add a scoll pane to the listed display JTextarea.
What am i doing wrong?
Thanks

