glottis
asked on
JDesktopPane background
Hi,
What I want is a JFrame of size(1024, 768);
i can setJMenuBar of the frame, and then I create a JToolBar and add it to the NORTH of the ContentPane.
I add a JLabel in the CENTER and the label simply contains an image (so it looks as if it is the background).
No i want to add InternalFrame. However they can only be added to a JDesktopPane.
there fore i created a JDesktopPane and set it as the contentPane of the JFrame.
However the layout of the desktopPane is null... if i set it to BorderLayout, then the internal frames dont minimize.
if i let the layout to null, then I cant see the background image, and the ToolBar is not seen also.
So is there any help I can get, so that I may add these things:
1. A JMenuBar.
2. A JToolBar at the NORTH (non-floatable).
3. A Background Image of the entire frame.
4. Internal frames (5 - 10 of them).
Thanks.
What I want is a JFrame of size(1024, 768);
i can setJMenuBar of the frame, and then I create a JToolBar and add it to the NORTH of the ContentPane.
I add a JLabel in the CENTER and the label simply contains an image (so it looks as if it is the background).
No i want to add InternalFrame. However they can only be added to a JDesktopPane.
there fore i created a JDesktopPane and set it as the contentPane of the JFrame.
However the layout of the desktopPane is null... if i set it to BorderLayout, then the internal frames dont minimize.
if i let the layout to null, then I cant see the background image, and the ToolBar is not seen also.
So is there any help I can get, so that I may add these things:
1. A JMenuBar.
2. A JToolBar at the NORTH (non-floatable).
3. A Background Image of the entire frame.
4. Internal frames (5 - 10 of them).
Thanks.
see http://java.sun.com/developer/qow/archive/49/index.html
where you can read:
JDesktopPane is a JLayeredPane. Add a JLabel with the ImageIcon using
desktopPane.add(child, JLayeredPane.FRAME_CONTENT _LAYER)
where you can read:
JDesktopPane is a JLayeredPane. Add a JLabel with the ImageIcon using
desktopPane.add(child, JLayeredPane.FRAME_CONTENT
For setting up a image background,
// Note 11.
JDesktopPane desktop = new JDesktopPane();
JInternalFrame frA = makeInternalFrame();
desktop.add(frA); // Note 12.
getContentPane().add(deskt
getContentPane().getGraphi
Regards,
Muruga
ASKER
zzynx:
that option didnt help. It didnt show me the Image.
mmuruganandam:
when i do a getContentPane().getGraphi cs() it returns me null
that option didnt help. It didnt show me the Image.
mmuruganandam:
when i do a getContentPane().getGraphi
ASKER
public MyFrame() {
super("My Frame");
desktop = new JDesktopPane();
desktop.setDragMode(JDeskt opPane.LIV E_DRAG_MOD E);
setContentPane(desktop);
desktop.add(new JLabel("Hello, World"), JLayeredPane.FRAME_CONTENT _LAYER);
setDefaultCloseOperation(E XIT_ON_CLO SE);
setResizable(false); setSize(1024, 768);
setVisible(true);
}
it isnt showing me Hello, World.
i can add internal frames easily.
JDesktopPane's layout is null.
do I have to setBounds of the JLabel ???
i think that is why it is not showing me.
super("My Frame");
desktop = new JDesktopPane();
desktop.setDragMode(JDeskt
setContentPane(desktop);
desktop.add(new JLabel("Hello, World"), JLayeredPane.FRAME_CONTENT
setDefaultCloseOperation(E
setResizable(false); setSize(1024, 768);
setVisible(true);
}
it isnt showing me Hello, World.
i can add internal frames easily.
JDesktopPane's layout is null.
do I have to setBounds of the JLabel ???
i think that is why it is not showing me.
>> that option didnt help. It didnt show me the Image.
Sorry.
Sorry.
ASKER
ok figured my problem.
as the layout of JDesktopPane is null, the added label (or any other component) will not be visible, as its bounds are not set.
thanks anyway.
as the layout of JDesktopPane is null, the added label (or any other component) will not be visible, as its bounds are not set.
thanks anyway.
Delete or close the question... if you are done with this question
ASKER
ive already requested it in the Community_Support,
thanks.
thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I guess you can play with the different layers.