Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Frame Positioning

  Asked By: Clifford    Date: Nov 08    Category: Java    Views: 604
  

If I have 2 different frames to be shown together in
my application, how can I keep one of the two always
on top of the other.

Share: 

 

1 Answer Found

 
Answer #1    Answered By: Mario Ryan     Answered On: Nov 08

Do you mean on top  of the other on the y-axis or the frames  actually
stacked on each other? If you mean the y-axis one you can do it a
few ways the simplest is this:
public class KFrame /*just an example name*/ extends Frame
{
public KFrame(String name, int x, int y)
{
super(s);//calls the frame  constructor that excepts the name of the
frame
setSize(x,y);//sets the Frame size to x,y
setLayout(new GridLayout(1,2));//it might be (2,1) I forget, I
//don't use GridLayouts that much
add(new Panel());//you can use a pre-defined panel, this is just an
// example. Be sure to use Panels, not Frames, you can't add Frames
add(new Panel());

setVisible(true);//this just makes the window visble
}
}

 
Didn't find what you were looking for? Find more on Frame Positioning Or get search suggestion and latest updates.




Tagged: