Why the JScrollPane is not working?
hi i'm having a problem with this JScrollPane that does not allow me to scroll when my textarea exceed the screen. I can't figure out the problem Can anyone tell me why ?
import java.awt.*;
import java.text.*;
import javax.swing.*;
import java.awt.event.*;
publicclass MovieBook1extends JFrame
{
private JPanel jPane6;
private JTextArea atext1;
private JScrollPane scroll;
publicstaticvoid main(String[] args)
{
MovieBook1 m =new MovieBook1();
m.setVisible(true);
m.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public MovieBook1()
{
setSize(200,300);
setTitle("Movie Booking");
Font bigFont =new Font("TimesRoman", Font.BOLD, 24);
getContentPane().setLayout(new GridLayout(1,1));
jPane6 =new JPanel();
jPane6.setLayout(new BorderLayout());
atext1 =new JTextArea(1,1);
atext1.setText("Movie\t\tTime\t#Tkt\t$");
atext1.setCaretPosition(atext1.getText().length());
scroll =new JScrollPane(atext1, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
jPane6.add(atext1,BorderLayout.CENTER);
jPane6.add(scroll,BorderLayout.EAST);
getContentPane().add(jPane6);
}
}

