Results 1 to 2 of 2
- 04-17-2010, 04:08 PM #1
Member
- Join Date
- Apr 2010
- Posts
- 8
- Rep Power
- 0
image not dispalyed inside border
Plesae need support border is displayed but image not displayed
JLabel label = new JLabel(new ImageIcon("logo.gif"));
package misc;
import java.awt.*;
import javax.swing.*;
public class SplashDemo extends JWindow {
private int duration;
public SplashDemo(int d) {
duration = d;
}
// A simple little method to show a title screen in the center
// of the screen for the amount of time given in the constructor
public void showSplash() {
JPanel content = (JPanel)getContentPane();
content.setBackground(Color.white);
// Set the window's bounds, centering the window
int width = 450;
int height =115;
Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
int x = (screen.width-width)/2;
int y = (screen.height-height)/2;
setBounds(x,y,width,height);
// Build the splash screen
JLabel label = new JLabel(new ImageIcon("logo.gif"));
JLabel copyrt = new JLabel
("Copyright 2010, Ejada System", JLabel.CENTER);
copyrt.setFont(new Font("Sans-Serif", Font.BOLD, 12));
content.add(label, BorderLayout.CENTER);
content.add(copyrt, BorderLayout.SOUTH);
Color oraRed = new Color(156, 20, 20, 255);
content.setBorder(BorderFactory.createLineBorder(o raRed, 10));
// Display it
setVisible(true);
// Wait a little while, maybe while loading resources
try { Thread.sleep(duration); } catch (Exception e) {}
setVisible(false);
}
public void showSplashAndExit() {
showSplash();
System.exit(0);
}
public static void main(String[] args) {
// Throw a nice little title page up on the screen first
SplashDemo splash = new SplashDemo(10000);
// Normally, we'd call splash.showSplash() and get on
// with the program. But, since this is only a test...
splash.showSplashAndExit();
}
}
-
Since you don't seem to be replying to responses made to any of your previous threads, there's no way for anyone to know if you're actually reading them. Myself, I hate to waste time, so I plan to hold off making replies to your threads til this is rectified. I recommend that others do the same.
Best of luck.
Similar Threads
-
Set border
By anilkumar_vist in forum New To JavaReplies: 1Last Post: 02-06-2010, 11:25 AM -
problem aligning both image/text inside a button
By rick_cols in forum SWT / JFaceReplies: 0Last Post: 09-18-2008, 08:20 PM -
Does anyone know how this Swing Object is called ? Image inside
By hannehomuth in forum Advanced JavaReplies: 1Last Post: 07-26-2008, 05:26 PM -
Border Layout
By mark-mlt in forum Java AppletsReplies: 5Last Post: 05-12-2008, 09:48 AM -
how to draw an image inside of jscrollpane
By paty in forum Java AppletsReplies: 1Last Post: 07-24-2007, 12:44 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks