Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    8
    Rep Power
    0

    Default 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();

    }
    }

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

    Default

    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

  1. Set border
    By anilkumar_vist in forum New To Java
    Replies: 1
    Last Post: 02-06-2010, 12:25 PM
  2. problem aligning both image/text inside a button
    By rick_cols in forum SWT / JFace
    Replies: 0
    Last Post: 09-18-2008, 09:20 PM
  3. Replies: 1
    Last Post: 07-26-2008, 06:26 PM
  4. Border Layout
    By mark-mlt in forum Java Applets
    Replies: 5
    Last Post: 05-12-2008, 10:48 AM
  5. how to draw an image inside of jscrollpane
    By paty in forum Java Applets
    Replies: 1
    Last Post: 07-24-2007, 01:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •