Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Should we consider this also as platform dependent?  RSS feed

maha anna
Ranch Hand
Posts: 1467
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
In Jxam, one of the qstns asked say tru/false about 'java.awt.List' related info. The author says the foll is false.

Possible Answer 3:
A vertical scroll bar will be added automatically if needed.

I thought List will have scroll bars if needed, since I have seen in some GUIs. So I checked the SAME example given in Java Doc. In JavaDoc the image shown DOES NOT show scroll bars. But when I tested the same example on Win 98 , JDK 1.2.2, it shows the scroll bars. So what do we say if this kind of qstns come up in the Exam.
Thank you all.
maha anna
Please refer to the online Java Doc here,

import java.awt.*;
class mframe extends Frame{
public mframe(){
setLayout(new FlowLayout());
List lst = new List(4, false);

public static void main(String args[]){
new mframe();


[This message has been edited by maha anna (edited April 24, 2000).]
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

The figure in the jdk1.2 api docs is misleading.
The scroll bars should appear otherwise how would you select
other items (i.e. other than the four which are displaying).
However if you increase the # of rows to be displayed in c'tor
the to be more or equal to # of items in the list c'tor
like: <code> List lst = new List(13,false); </code> then
the scrollbar disappears (at least on Solaris X86 2.6).
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

If I remember the question correctly, the code given
in the exam doesnot add anything to the list.
It says something like:
List lst = new List(X, false);
Then the answers given are (something like this):
A. multiple items can be selected
B. Max. "X" items are visible.
C. scroll bar is added automatically, if needed
D. Only "X" items can be added to the list.
I think the code does not add any items to the list.
Hence there is no need to add any scroll bar automatically.
I told this to myself and agreed with the author of the exam.
Re your example, I think the scroll bar is added (if needed)
irrespective of the machine it runs. I am on UNIX and it did
add a scroll bar.

- satya
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!