Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Don Sims   on Sep 05 In Java Category.

  
Question Answered By: Archana Kamble   on Sep 05

You can run the following code.It works in java 7


/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.basic;

import javax.swing.*;
/**
*
* @author mac
*/
public class ScrollDemo extends JFrame {

public ScrollDemo() {

JTextArea txtArea = new JTextArea(20,20);
txtArea.setAutoscrolls(true);
txtArea.setEditable(true);
JPanel panel= new JPanel();
panel.add(txtArea);
JScrollPane scrollPane = new JScrollPane(panel);

// scrollPane.setVerticalScrollBar(JScrollBar.VERTICAL);

setContentPane(scrollPane);
setTitle("scrollpane demo");
setSize(300,300);
setVisible(true);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
public static void main(String args[])
{
new ScrollDemo();
}

}

Share: 

 

This Question has 1 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on scrolling feature in a frame Or get search suggestion and latest updates.


Tagged: