• Advertisement

Archived

This topic is now archived and is closed to further replies.

[java] Pop up "window" over a gameboard?

This topic is 6441 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hey all, I''ve got an interesting situation. I''m building a Java applictaion, that is basically a board game that wil be played over the net. The client/server stuff will be no huge problem, but the problem is this: I can''t show all the information I need at once, so what we''re proposing is to have a series of tabs to the left of the Frame. When you click on one of these tabs, the appropriate "windows" will appear over the top of the game board (making it slide, or fade it would be nice, but is not imperative). The information in each of the panels will also be changing depending on what is happening in the game. I honestly have almost no idea where to start with this... Changing panels around on mouseclick??? Its the problem of placing it over the top of the board image. I may have to end up putting it all on a external window. Any thoughts anyone? Thanks, Mark

Share this post


Link to post
Share on other sites
Advertisement
Your doing this with Java? That should be easy shouldn''t it!?!?

Well I don''t know java but I could do that DHTML, so java should be easier. I''m not sure how java works but in DHTML you have layers, so I''d have a base layer with my basic stuff, then when you click on a button, lets say, on the layer above I''d add in some HTML for a table with links that looks like a menu. then when you move your mouse away, take away that menu on the top layer.

So in Java I''d suspect you''d have some sort of objects right? Well I''d probably have let''s say 3 objects which are these tabs. Now when you click on the first tab, it makes the first boject (Some sort of panel or collection of other objects) visible while the other 2 panels would be made invisible, thereby bringing up the first panel to the top.

Get the idea? Then for # 2 you''d simply make #2 visible, others invisible! Etc... etc...

The trick is if you want to add blending or fading... you could do a "wipe" sort of effect by bring in the new panel over top of the old one before making the old one invisble or something... just experiment.

Good luck! Have fun!
See ya,
Ben

Share this post


Link to post
Share on other sites
Thanks,

Sounds like some interesting ideas, except for a few things:

1) Its not for sitting inside a browser, it''ll be an app. so no dhtml.

2) I''m not sure if you can layer like that... I may end up having to write some sort of weird Canvas extension... with ImageMaps...

Mark

----
http://go.to/e[m]anate
----

Share this post


Link to post
Share on other sites
Set the applet''s LayoutManager to a java.awt.BorderLayout.
Create a Panel with a java.awt.CardLayout, and add it to the applet at BorderLayout.WEST. This is your mainPanel. Create another Panel and add it to the applet at BorderLayout.EAST. This is your controlPanel.

You''ll end up with something like this:

XXXXXXXXX YYY
XXXXXXXXX YYY
XXXXXXXXX YYY
XXXXXXXXX YYY

where the X''s represent your mainPanel and the Y''s represent the controlPanel.

In the mainPanel, add your game canvas as a child with the constraint "game", for example:
mainPanel.add(gameCanvas, "game");

Then add your other informational panels in a similar fashion:

mainPanel.add(infoPanel1, "info1");
mainPanel.add(infoPanel2, "info2");
etc.

In the controlPanel, add whatever cool controls you want that enable players to switch views. Whenever one of these is activated, you''ll tell the CardLayout to show the corresponding panel, for example

cardLayout.show(mainPanel, "game");

would show the game canvas.

Anyway, CardLayout and BorderLayout have been around since JDK 1.0, so you should have no problems implementing this in any applet.

Share this post


Link to post
Share on other sites
Well, if it''s not in an applet, then you should be using JDK 1.3 and Swing components. Look up javax.swing.JTabbedPane, that''ll take care of most of what I mentioned above.

Share this post


Link to post
Share on other sites
Aha!

I had COMPLETLEY forgotted about CardLayoutManager >smacks forhead<

And wandering my way through swing, I''m sure I will find more useful extensions of it as well.

Much appreciated!!

Mark

----
http://go.to/e[m]anate
----

Share this post


Link to post
Share on other sites
You could implement/extend your own popup window like this:

New popupper popup:

popup = new popupper(xpos, ypos, xsize, ysize, data0)

data0 means that it uses data from data slot 0 from the database which could mean, Show information about Wall Street(monopoly).


I''m sorry about my floppy java syntax, but I haven''t been using java since 1 month, because I had to move

Share this post


Link to post
Share on other sites
Dialog boxes actually look like they''re going to be the easiest way to implement this.

Its just we would have liked it all in one window.. not in multiple.. but what can you do

Guess you have to work within your time restrictions.

Mark

----
http://go.to/e[m]anate
----

Share this post


Link to post
Share on other sites

  • Advertisement