Name: mc57594 Date: 01/23/97
import java.awt.*;
//This program shows the problem with creating a win95 window that uses
whole screen
//we ask for and get the whole screen in this program but the win95 icons in
the top right don't
//reflect this. If we now tell win95 to maximise the window from this point
what happens isn't
//clear to me but in my app things definately go wrong. Win95 dosn't know
that the window has
//already been made the size of the screen by my 'setSize();' call.
//The essence of the problem is that we have no way to communicate with
win95 to tell it
//what kind of window we want nor to find out what kind of window win95
allocates.
//Under JDK1.02 the problem was that win95 always allocates a standard
window to the app //which was
//less than the screen size but you never knew where that was on the screen.
The new feature
// getLocationOnScreen() solves that problem. However now in JDK1.1 we've
returned to the way
//JDK1.0 works, to wit the window always appears wtih the origin in the top
left corner of the
//screen which is great because you now always know where the origin is,
getLocationOnScreen
//isn't needed and you can confidently set the Frame size to be the Screen
size as below. The
//only problem is that the win95 gives you a single rectangle icon in the
top right meaning
// that the window can be maximised further which you don't want.
//Ideally the app should be able to tell win95 what kind of window it wants
so that win95
//decides the positioning and size and also sets the win95 icons in the top
right of the
//app window accordingly. Something like
'Frame.setScreenWindow(Frame.MAXIMISE);' and
// then
//we know we have the whole screen or
'Frame.setScreenWindow(Frame.DEFAULT);' in which
// case
//'Frame.setSize()' and 'Frame.pack()' become relevent. In either case the
win95 icons should
//reflect the kind of window we display and in the latter case
getLocationOnScreen() tells
//us where on the screen the default window is displayed by win95.
//But then you have the problem that the default window positioning might
not allow all of the
//Frame to be displayed on the screen. To overcome this you need to get the
position on screen
//then get the screen size and then make sure your 'setSize()' doesn't take
you off the screen.
//I think if java is to run well on small PDA type devices applications will
typically have to
//take over the whole screen because the screen is so small, so a simple way
to do it in java
//would be useful. Java originally came from such a small device so I'm a
little surprised
//that there seems to be a problem in this area.
//However this feature might be irrelevant to many of the patforms
//under which java will run. It's also only relevant to people like me who
are writing
//standalone app's and who want to have the app start out using the entire
screen and let
//the user decide if they want to click the win95 double rectangle icon to
get a smaller
//window. There is another aspect to this however. My app also runs as an
applet under applet
// viewer and again requests the entire screen for a new Frame which appears
as an
//'untrusted window'. The problems in this case are the same.
//As a footnote, I might say I'm not getting the 'Untrusted Window' message
under 1.1Beta3
//Appletviewer but if I did I have no way of knowing the message is there or
of knowing
// where the message is appearing in my Frame.
public class Test extends Frame{Dimension dim;
Test(){
dim=Toolkit.getDefaultToolkit().getScreenSize();
setSize(dim.width,dim.height);setVisible(true);
}
public static void main(String args[]){new Test();}
}
======================================================================