Solved

JDesktopPane background

Posted on 2004-04-14
12
2,912 Views
Last Modified: 2009-02-08
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.
0
Comment
Question by:glottis
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 3
  • +1
12 Comments
 
LVL 37

Expert Comment

by:zzynx
ID: 10821668
A JDeskTopPane is a JLayeredPane.
I guess you can play with the different layers.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10821669
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10821682
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)

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10821693

For setting up a image background,

// Note 11.
JDesktopPane desktop = new JDesktopPane();
JInternalFrame frA = makeInternalFrame();
desktop.add(frA); // Note 12.
getContentPane().add(desktop); // Note 13.
getContentPane().getGraphics().drawImage(---------) // add this line



Regards,
Muruga
0
 
LVL 2

Author Comment

by:glottis
ID: 10825748
zzynx:
that option didnt help. It didnt show me the Image.

mmuruganandam:
when i do a getContentPane().getGraphics() it returns me null
0
 
LVL 2

Author Comment

by:glottis
ID: 10825832
public MyFrame() {
  super("My Frame");
  desktop = new JDesktopPane();
  desktop.setDragMode(JDesktopPane.LIVE_DRAG_MODE);
  setContentPane(desktop);
 
  desktop.add(new JLabel("Hello, World"), JLayeredPane.FRAME_CONTENT_LAYER);
 
  setDefaultCloseOperation(EXIT_ON_CLOSE);
  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.
0
 
LVL 37

Expert Comment

by:zzynx
ID: 10830738
>> that option didnt help. It didnt show me the Image.
Sorry.
0
 
LVL 2

Author Comment

by:glottis
ID: 10858037
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.
0
 
LVL 9

Expert Comment

by:mmuruganandam
ID: 10858048
Delete or close the question... if you are done with this question
0
 
LVL 2

Author Comment

by:glottis
ID: 10858092
ive already requested it in the Community_Support,
thanks.
0
 

Accepted Solution

by:
modulo earned 0 total points
ID: 10902515
Closed, 100 points refunded.
modulo
Community Support Moderator
Experts Exchange
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Android development question 2 78
JAVA API design with micro service cloud in mind 1 77
How to log java errors in tomcat 8 24
Java array 21 82
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question