| 
    
        | 
        | karim 
 Posts: 5
 Nickname: apahliani
 Registered: Nov, 2004
 
 
 |  | problem with scroll | Posted: Dec 1, 2004 10:45 AM |  |  
        | 
Hi,
| 
Advertisement
 |  I am writing an application to show a scroll panel attached to a text area
 but it does not appear on the screen. If remove the lines
 
 JScrollPane scrollText = new JScrollPane(textArea);
 contentPane.add(scrollText);
 
 and add
 
 contentPane.add(textField)
 
 It appears but without scroll?.
 
 
 import javax.swing.*;
 import java.awt.*;
 
 class TestFrame extends JFrame  {
 private JTextArea textArea;
 
 public static void main(String[] args) {
 TestFrame frame = new TestFrame();
 frame.setVisible(true);
 }
 
 public TestFrame( ) {
 
 setSize  ( 700, 400 );
 setLocation  ( 5, 5 );
 
 Container contentPane = getContentPane();
 contentPane.setBackground(Color.white);
 contentPane.setLayout(null);
 
 textArea = new JTextArea();
 textArea.setEditable(false);
 textArea.setBounds(350, 50, 100, 135);
 textArea.setBorder(BorderFactory.createLineBorder(Color.red));
 JScrollPane scrollText = new JScrollPane(textArea);
 contentPane.add(scrollText);
 
 }
 
 
 
 }
 
         |  |