- For individual users
- Instant access to solutions
- Ask your tech questions
- Start your 30-day Free Trial
Main Topics
Browse All TopicsHow to display an application logo screen (a rectangular graphic) in Java? From what I know every Java application must start with a frame but I need to start it with some kind of container with no buttons or titlebars but with an image inside.
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Business Accounts
Answer for Membership
by: stalefishPosted on 2000-03-26 at 18:31:21ID: 2659369
I found this at http://www.tactika.com/rea lhome/real home.html
);
;
t we) {
import java.awt.*;
import java.awt.event.*;
public class Splash extends Window {
private Image splashImage;
private int imgWidth, imgHeight;
private String imgName;
private static final int BORDERSIZE = 5;
private static final Color BORDERCOLOR = Color.blue;
Toolkit tk;
public Splash(Frame f, String imgName) {
super(f);
this.imgName = imgName;
tk = Toolkit.getDefaultToolkit(
splashImage = loadSplashImage();
showSplashScreen();
f.addWindowListener(new WindowListener());
}
public Image loadSplashImage() {
MediaTracker tracker = new MediaTracker(this);
Image result;
result = tk.getImage(imgName);
tracker.addImage(result, 0);
try {
tracker.waitForAll();
}
catch (Exception e) {
e.printStackTrace();
}
imgWidth = result.getWidth(this);
imgHeight = result.getHeight(this);
return (result);
}
public void showSplashScreen() {
Dimension screenSize = tk.getScreenSize();
setBackground(BORDERCOLOR)
int w = imgWidth + (BORDERSIZE * 2);
int h = imgHeight + (BORDERSIZE * 2);
int x = (screenSize.width - w) /2;
int y = (screenSize.height - h) /2;
setBounds(x, y, w, h);
setVisible(true);
}
public void paint(Graphics g) {
g.drawImage(splashImage, BORDERSIZE, BORDERSIZE,
imgWidth, imgHeight, this);
}
class WindowListener extends WindowAdapter {
public void windowActivated(WindowEven
setVisible(false);
dispose();
}
}
}
The following example use this image (jht.gif) as the splash image.
import java.awt.*;
import java.awt.event.*;
public class TestSplash {
MyFrame theFrame;
public static void main (String args[]){
TestSplash t = new TestSplash();
t.createMainFrame();
}
private void createMainFrame() {
theFrame = new MyFrame("A Dummy Frame");
theFrame.setVisible(true);
}
}
class MyFrame extends Frame {
Splash mySplash;
public MyFrame(String title){
super(title);
addWindowListener
(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
System.exit(0);
}
}
);
mySplash = new Splash(this, "jht.gif");
// dummy delay so we can see the Splash!
for(int i = 0; i < 3000; i++) {
System.out.println(i) ;
}
setSize(200,200);
}
}