Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help: Could you help me understand this Java GUI project?

0 views
Skip to first unread message

Leo Smith

unread,
May 25, 2006, 5:28:50 PM5/25/06
to
Dear All,

I have received a small Java GUI project. I am a Java programmer. But I
don't fully understand the requirement. The project is:

Using J2SE 5.0, develop a JPanel that draws a list of semi-transparent
(alpha = 128) rectangles with a border. The control must have the
following public API:

public void enableZoom (boolean enabled)

When set to true (default value), the panel draws its contents 10 times
as big as the screen resolution. Similar to the “View - Zoom - Large
Size” menu option in Windows Paint*.

public bool AddRectangle (java.awt.Rectangle r)

Adds a rectangle to the list.

Also the panel must handle Mouse Events so that you can click inside of
it and create rectangles. Much like you do in Paint* when the
"Rectangle" tool is selected.

End of project description.

Major points I don't understand:
1. "..the panel draws its contents 10 times as big as the screen
resolution. Similar to the “View - Zoom - Large Size” menu option in
Windows Paint*."
What does this mean?

2. "a JPanel that draws a list of semi-transparent (alpha = 128)
rectangles with a border"
What does this mean?

If you can give me some hints to tackle this project, I would be greatly
appreciative for that.

Thank you very much.

Oliver Wong

unread,
May 25, 2006, 5:44:52 PM5/25/06
to

"Leo Smith" <c...@nospam.com> wrote in message
news:e557k3$ea1m$1...@osf1.gmu.edu...

> Dear All,
>
> I have received a small Java GUI project. I am a Java programmer. But I
> don't fully understand the requirement. The project is:
>
> Using J2SE 5.0, develop a JPanel that draws a list of semi-transparent
> (alpha = 128) rectangles with a border. The control must have the
> following public API:
>
> public void enableZoom (boolean enabled)
>
> When set to true (default value), the panel draws its contents 10 times as
> big as the screen resolution. Similar to the “View - Zoom - Large Size”
> menu option in Windows Paint*.
>
> public bool AddRectangle (java.awt.Rectangle r)
>
> Adds a rectangle to the list.
>
> Also the panel must handle Mouse Events so that you can click inside of it
> and create rectangles. Much like you do in Paint* when the "Rectangle"
> tool is selected.
>
> End of project description.
>
> Major points I don't understand:
> 1. "..the panel draws its contents 10 times as big as the screen
> resolution. Similar to the “View - Zoom - Large Size” menu option in
> Windows Paint*."
> What does this mean?

Why don't you ask the client/teacher for clarification? I'd imagine it
means where-ever you would draw something 1 pixel tall by 1 pixel wide, you
would instead draw something 10 pixels tall by 10 pixels wide.

>
> 2. "a JPanel that draws a list of semi-transparent (alpha = 128)
> rectangles with a border"
> What does this mean?

You have a list of rectangles via the addRectangle method, right? So
draw them with alpha transparency. The client/teacher/whatever is probably
assuming a scale of 0 to 255 (again, ask for clarification), so this means
50% transparent.

http://en.wikipedia.org/wiki/Alpha_transparency

- Oliver

Leo Smith

unread,
May 25, 2006, 6:17:46 PM5/25/06
to
Thank you very much. That helps a lot.

One more thing I am not clear: "a list of rectangles". Does it mean the
following:

I have a list, currently with two rectangles. So the window shows two
rectangles in it. If the method AddRectangle is called and one rectangle
is added to the list, the window shows three rectangles.

Is my understanding correct? Thank you.

Oliver Wong

unread,
May 26, 2006, 9:44:01 AM5/26/06
to

"Leo Smith" <c...@nospam.com> wrote in message
news:e55afr$5e02$1...@osf1.gmu.edu...

Ask for clarification from your client/teacher/whatever.

- Oliver

Leo Smith

unread,
May 26, 2006, 10:19:50 AM5/26/06
to
This is a job interview related tech testing project. I avoid to bother
the interview manager.

If you could explain a little or even provide some hints/guidance, I

would be greatly appreciative for that.

Oliver Wong

unread,
May 26, 2006, 10:41:18 AM5/26/06
to
[post re-ordered]

"Leo Smith" <c...@nospam.com> wrote in message

news:e572rj$5sqs$1...@osf1.gmu.edu...


> Oliver Wong wrote:
>> Ask for clarification from your client/teacher/whatever.
>

> This is a job interview related tech testing project. I avoid to bother
> the interview manager.
>
> If you could explain a little or even provide some hints/guidance, I would
> be greatly appreciative for that.
>

Perhaps part of the test is to see if you would, when given insufficient
information, actively seek out that information, or just randomly guess what
the information should be.

E.g. let's say someone hires you to build a house. So you start building
it, and then you realize you don't know how many floors the person wants for
their house. Would you ask them how many floors, or would you just decide 2
is a good number and built a 2-story house?

- Oliver

0 new messages