avatar
JAVA 面世题.# Java - 爪哇娇娃
k*g
1
今天作了个面世, 有一题:
You decide to write a GUI application that displays a large image from a
location on the Internet while the application loads/processes in the
background.
Which of the following statements is correct?
A When using the ToolKit class, images are loaded synchronously, so it is
necessary to run the image displayer in a separate thread to allow background
processes to continue.
B The ToolKit class loads images asynchronously. It also provides notification
when the image has been loaded
avatar
c*s
2
B

background
notification
to

【在 k****g 的大作中提到】
: 今天作了个面世, 有一题:
: You decide to write a GUI application that displays a large image from a
: location on the Internet while the application loads/processes in the
: background.
: Which of the following statements is correct?
: A When using the ToolKit class, images are loaded synchronously, so it is
: necessary to run the image displayer in a separate thread to allow background
: processes to continue.
: B The ToolKit class loads images asynchronously. It also provides notification
: when the image has been loaded

avatar
g*y
3
B? There is no callback mechanism in Toolkit with getImage() or createImage().
I think C is right.

【在 c*****s 的大作中提到】
: B
:
: background
: notification
: to

avatar
c*s
4
Definitely B.
Tookit will create the reference to an asynchronizing loaded image object.
Graphics.drawImage() accepts an ImageObserver as argument. After the image is
loaded, this ImageObserver will be notified.
This is the most common usage to display an image in SWing.

createImage().
is
need

【在 g**********y 的大作中提到】
: B? There is no callback mechanism in Toolkit with getImage() or createImage().
: I think C is right.

avatar
g*y
5
B. The ToolKit class loads images asynchronously. It also provides
notification when the image has been loaded successfully.
It is Graphics, not Toolkit notifies ImageObserver.
BTW, there is nothing wrong in C.

is
a
been

【在 c*****s 的大作中提到】
: Definitely B.
: Tookit will create the reference to an asynchronizing loaded image object.
: Graphics.drawImage() accepts an ImageObserver as argument. After the image is
: loaded, this ImageObserver will be notified.
: This is the most common usage to display an image in SWing.
:
: createImage().
: is
: need

avatar
c*t
6
E also could be right :D It does load bitmap images only although it
gets information such as font list and font matrices as well.

【在 g**********y 的大作中提到】
: B. The ToolKit class loads images asynchronously. It also provides
: notification when the image has been loaded successfully.
: It is Graphics, not Toolkit notifies ImageObserver.
: BTW, there is nothing wrong in C.
:
: is
: a
: been

avatar
g*y
7
Toolkit.getImage() support GIF/JPEG/PNG, I think the interview question mean
that.

object.
image

【在 c*****t 的大作中提到】
: E also could be right :D It does load bitmap images only although it
: gets information such as font list and font matrices as well.

avatar
g*g
8
Next time tell the interviewer 1.4 above, this queston
is irrelevant.

【在 k****g 的大作中提到】
: 今天作了个面世, 有一题:
: You decide to write a GUI application that displays a large image from a
: location on the Internet while the application loads/processes in the
: background.
: Which of the following statements is correct?
: A When using the ToolKit class, images are loaded synchronously, so it is
: necessary to run the image displayer in a separate thread to allow background
: processes to continue.
: B The ToolKit class loads images asynchronously. It also provides notification
: when the image has been loaded

avatar
B*N
9
MediaTracker is make the main thread wait for the image loading. It can not
tell you "when" it's loaded.
If the image is loaded from harddrive it's common to use MediatTracker and
just make the main thread waiting, not a big deal.

from
the
it
you

【在 g**********y 的大作中提到】
: B. The ToolKit class loads images asynchronously. It also provides
: notification when the image has been loaded successfully.
: It is Graphics, not Toolkit notifies ImageObserver.
: BTW, there is nothing wrong in C.
:
: is
: a
: been

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。