Hi Cynthia,
Hi, I had a similar problem time ago, and I modified
my code as following to get a better result...

if(frame.getState()==Frame.ICONIFIED)
                 frame.setState(Frame.NORMAL);
frame.setVisible(true);
frame.requestFocus();

Hope it helps.
K.

------------------------------------
At 12:59 22/09/2001 -0400, you wrote:

Christian,

Here is the code that I use.  I added the "toFront()" and changed "show()" 
to
"setVisible(true)", but this has no effect.    Again, I don't have any 
problem if
I simply start a Swing applicaton on NT.  The problem arises when we have an
already running non-GUI TCP/IP Java server application which is request to 
start
a Swing application.  The problem occurs whether or not the the MSDOS window
containing the TCP/IP Java server is maximized and has the focus or not.


Cynthia Jeness

----------------------------------------------------------------------------------------

   /**
    * This method sizes the frame and shows it.  The window is
    * sized at a maximum of MAX_WINDOW_WIDTH X MAX_WINDOW_HEIGHT and
    * centered on the screen.
    */
   public void showFrame() {

      // If any error during initialization, then return.
      if (initError)
         return;

      // Size the frame and display it in the middle of the screen.
      Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
      int width = Math.min(Constants.MAX_WINDOW_WIDTH, screen.width);
      int height = Math.min(Constants.MAX_WINDOW_HEIGHT, screen.height);
      int left = (screen.width - width)/2;
      int top = (screen.height - height)/2;
      setBounds(left, top, width, height);

      // Trying to force visibility on Windows.
      toFront();
      setVisible(true);
      //show();
      windowOpen = true;
   }

Christian Pesch wrote:

>Cynthia Jeness schrieb:
>
> > We have a legacy GUI application which communicates with a Java TCP/IP
> > server application running on the same computer.  Depending on the type
> > of message received, we load a JFrame which contains a JTabbedPane.  The
> > application is launched correctly.  However, at least under NT, it is
> > minimized and, thus, you must select it from the Taskbar to actually see
> > it.  The application is launched correctly under OS/2.  In the case of
> > NT, we are using the latest JDK 1.3.1 from Sun.  I have tried explicitly
> > setting the state of the frame to NORMAL.  But this has no effect.
>
>I use the following code sequence to open frames and bring them to front
>with JDK 1.3.1 Windows NT and 2000:
>
>if(System.getProperty("os.name").startsWith("Windows")) {
>   Gui.getLog().write(Log.LEVEL_INFO, "Enabled Windows window to front 
>patch");
>
>    enableWindowsPatch = true;
>}
>
>Then opening does this
>
>     // workaround for windows to bring frame to front
>     if(enableWindowsPatch)
>       frame.toFront();
>
>     frame.setVisible(true);
>
> > Does
> > anyone have any suggestions about how to get the application launched in
> > a normal size.  If I launch it from the command line on NT rather than
> > from an already running Java application, then the window is displayed
> > correctly on NT.
>
>Please extract your code sequence to show a frame. May that shows up
>an error.
>
>--
>Christian Pesch - Software Engineer
>CoreMedia AG - http://www.coremedia.com - 0700-COREMEDIA
>Visit us on the Systems, M�nchen and Orbit, Basel


_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing


_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to