Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2005

Tip: Looking for answers? Try searching our database.

Modal dialogs don't paint in full screen mode

Thread view: 
Chris Baker - 03 Apr 2005 07:09 GMT
[I searched Google Groups and received a result with the same title;
however, the result couldn't be found.]

I am working on a tile-based game with a group for class.  It is a
SimCity style game, except called SimUniversity.  It works completely
well without any screen modification, but I want to enhance it by
setting fullscreen and changing the DisplayMode, allowing a customized
playing environment (make for easier map scrolling, too).

I have the code that does this in a class of it's own and I call
[FullScreen fs = new Fullscreen(mainFrame);] where mainFrame is the
parent frame/window of the game.  This way I can plug in the fullscreen
functionality and take it out at will.

The problem lies when the WelcomeScreen JDialog is created.  It
loads/paints at first correctly, but if you drag it anywhere, it is
painted over with the other panels that are children of mainFrame.  The
JDialog remains on top; however, you can't really see the buttons.
Tabbing is the only way to get glimpses of them before they're painted
over again.

The JDialogs that do not work are WelcomeScreen, a
JOptionPane.showMessageDialog and a JOptionPane.showConfirmDialog (for
saving).  They all are painted over by their backgrounds.  I am known
for over looking the obvious, but I have tried and tried to make it
work and it wont!

Thanks,
--Chris Baker
Rhino - 03 Apr 2005 21:27 GMT
> [I searched Google Groups and received a result with the same title;
> however, the result couldn't be found.]
[quoted text clipped - 22 lines]
> for over looking the obvious, but I have tried and tried to make it
> work and it wont!

Well, you've overlooked the obvious again: you haven't provided any code for
us to examine. It's pretty hard to debug code that we can't see....

Rhino
Chris Baker - 03 Apr 2005 22:37 GMT
> > [I searched Google Groups and received a result with the same title;
> > however, the result couldn't be found.]
[quoted text clipped - 27 lines]
>
> Rhino

-JFrame mainFrame = new JFrame("Sim University");
-WelcomeScreen ws = new WelcomeScreen(mainFrame);   // a JDialog to ask
user to load game or create a new game
-GameMainPanel gmp = new GameMainPanel(); // the game's scrolling map
-mainFrame.setContentPane(gmp);
- FullScreen fs = new FullScreen(mainFrame); // checks compatibile and
sets fullscreen/displaymode
-mainFrame.validate();
-mainFrame.setVisible(true);
-mainFrame.pack();
-gmp.init();

This code is basically the main class.  I don't know what other code
would be useful.  Thx.
Rhino - 04 Apr 2005 05:03 GMT
> > > [I searched Google Groups and received a result with the same
> title;
[quoted text clipped - 51 lines]
> This code is basically the main class.  I don't know what other code
> would be useful.  Thx.

My main point was that anyone wanting to help you would have a lot better
chance if they could see some code; I didn't necessarily mean that *I* could
solve your problem effortlessly if you only provided some code. You've now
provided a little bit of the code. I don't see a problem in what you have
provided but I also don't have the time to ask for and review your entire
program.

I think I'll step aside and let others jump in.

Just a few thoughts of a general nature though....

1. The preferred newsgroup for GUI questions for Java programs is
comp.lang.java.gui. You might get a better answer there since all the
questions are GUI-oriented.

2. When trying something new - and modal dialogs in full screen mode would
appear to be a technique you haven't tried before - I often find that it
helps to put together a small prototype to try the new technique before
implementing it in your "real" program. Why not try knocking together a very
simple version of what you are trying to do and then get the basic bugs out
of it, then imitate what you have learned in the real program. For instance,
if you display a trivial modal dialog over a very simple full screen frame,
you will learn a lot about what happens with painting without having to
worry about all of the details handled by your program.

Lastly, a design question that you might want to ask yourself. What does
full screen mode really mean to you? How many pixels are you going to
actually have to work with (length X width)? What happens when your program
runs on a screen that has a higher or lower resolution? For instance, if you
write your application to use 1280 X 1024, what happens to the poor schmoe
whose computer is running 1024 x 768 when he tries to run your program?
Unless you plan on forcibly resetting the user's screen resolution via your
program, you might want to rethink the idea of writing a program that relies
on a specific screen size.

My two cents worth....

Rhino
Chris Baker - 04 Apr 2005 05:59 GMT
> > > > [I searched Google Groups and received a result with the same
> > title;
[quoted text clipped - 90 lines]
>
> Rhino

Thanks, Rhino.  I will def. make a testing version and try it there.
The only reason I posted in this group was b/c the post (Apr 12 2004,
1:39 pm by Mike Westerfield), now removed, with the same subject, was
posted here.

The thing I /thought/ I was getting at is: Is Java's fullscreen
capability bugged out so bad that it can't properly do dialogs as
normal?  Is there some general modification that must be made whenever
transitioning over to fullscreen?

I didn't intend for anybody to try to debug lines of code.  Since it
works perfectly w/o fullscreen, I thought there might be some
technicality I haven't yet read about regarding Java's fullscreen
capabiltiy.

Re: the design.  As mentioned previously, the program does jump to
fullscreen and then set the DisplayMode _if_ the user has a DisplayMode
type with our preferred resolution.  It greatly improves the ability to
maneuver the map, making it a highly desired feature if supported.  The
program operates well in any other DisplayMode as well.  That has
already been accounted for.  Thx, though...

I'm going to assume that I shouldn't double post and send a copy over
to .gui as well, but if anybody else has an idea, feel free to post.
Thanks!

--Chris Baker


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.