Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Swing / AWT / SWT
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Swing / AWT / SWT
JList and scrollpane issue
vijaya raghva naidu rambha
Greenhorn
Posts: 9
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
i hava JList wich is having 1000 elements but when i put in a scroll pane i can see only 80 while scrolling can any one suggest where is the issue is .
vijay<br />SCJP,SCWD
Craig Wood
Ranch Hand
Posts: 1535
posted 15 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
import java.awt.*; import javax.swing.*; public class ScrollList { private JScrollPane getContent() { // Copied from comments section of JList class api. // This list model has about 2^16 elements. Enjoy scrolling. JList bigDataList = new JList(bigData); // We don't want the JList implementation to compute the width // or height of all of the list cells, so we give it a string // that's as big as we'll need for any cell. It uses this to // compute values for the fixedCellWidth and fixedCellHeight // properties. bigDataList.setPrototypeCellValue("Index 1234567890"); return new JScrollPane(bigDataList); } // Copied from comments section of JList class api. ListModel bigData = new AbstractListModel() { public int getSize() { return Short.MAX_VALUE; } public Object getElementAt(int index) { return "Index " + index; } }; public static void main(String[] args) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.add(new ScrollList().getContent()); f.setSize(200,200); f.setLocation(200,200); f.setVisible(true); } }
Consider Paul's
rocket mass heater
.
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
JList
JLIST Store and retreive data to Properties
Add text and image to JList
JList + Vector
Drag and Drop from JList to JTree
More...