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

L

Leo Smith

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.
 
O

Oliver Wong

Leo Smith said:
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
 
L

Leo Smith

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.
 
O

Oliver Wong

Leo Smith said:
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.

Ask for clarification from your client/teacher/whatever.

- Oliver
 
L

Leo Smith

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.
 
O

Oliver Wong

[post re-ordered]

Leo Smith said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top