File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Should we consider this also as platform dependent? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Should we consider this also as platform dependent?" Watch "Should we consider this also as platform dependent?" New topic

Should we consider this also as platform dependent?

maha anna
Ranch Hand

Joined: Jan 31, 2000
Posts: 1467
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).]

Joined: Apr 17, 2000
Posts: 23

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

Joined: Nov 22, 2008
Posts: 18944

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
I agree. Here's the link:
subject: Should we consider this also as platform dependent?
It's not a secret anymore!