473,468 Members | 1,371 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Help me try finding the error

14 New Member
Hello Friends
The code below has no error at compile time.
But while executing, it does not show the icon at the left hand top corner of the frame, where a java cup icon is originally shown.
I want to replace it with my icon.

Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2. import javax.swing.*;
  3. import java.awt.*;
  4. import java.util.*;
  5.  
  6. class Error1
  7. {
  8.  
  9. public JPanel contentPane()
  10. {
  11. JPanel panel=new JPanel();
  12. JLabel label=new JLabel("This is a frame with its own Icon.");
  13. panel.add(label);
  14.  
  15.  
  16. return panel;
  17.  
  18. }
  19.  
  20. private static void createGui() 
  21.    {
  22.  
  23.  
  24.        JFrame frame=new JFrame("Error");
  25.        frame.setDefaultLookAndFeelDecorated(false);
  26.        Error1 obj=new Error1();
  27.        frame.setContentPane(obj.contentPane());
  28.        frame.setVisible(true);
  29.        frame.setSize(new Dimension(650,100));
  30.        frame.setResizable ( false );
  31.        frame.setLocation(50,50);
  32.  
  33.       // frame.setIconImage(getFDImage());
  34.        Image icon = Toolkit.getDefaultToolkit().getImage("D:\\error.bmp");
  35.        frame.setIconImage(icon);
  36.     }    
  37.     /*protected static Image getFDImage() 
  38.     {
  39.         java.net.URL imgURL = Error.class.getResource("D:\\error.bmp");
  40.         if (imgURL != null)
  41.         {
  42.             return new ImageIcon(imgURL).getImage();
  43.         } else 
  44.         {
  45.             return null;
  46.         }
  47.     }*/
  48.     public static void main(String args[]) 
  49.     {
  50.            SwingUtilities.invokeLater(new Runnable() {public void run() {createGui(); }});
  51.     }
  52. }
Oct 9 '08 #1
1 1227
JosAH
11,448 Recognized Expert MVP
You can only use .gif, .jpeg, .jpg or .png files; a .bmp file isn't recognized. Also
see the Toolkit.getImage() API documentation.

kind regards,

Jos
Oct 9 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: JKJr | last post by:
I have an hp printer that im trying to hookup to my dell comp. I talked to hp and they said, "It does not work because you have to have Microsoft .Net." Well I tried installing Microsoft .Net and I...
2
by: C L Humphreys | last post by:
Hi, Using a soundex function that works with anything except an empty/null string the following gives me an error part way through the results select surname, soundex(surname) from pd where...
2
by: Susan Bricker | last post by:
Greetings. Before I begin, I have been stuck on this problem for about a 5 days, now. I have tried and just seem to be not getting anywhere. I know that the explanation is lengthy, but I am a...
38
by: Red Dragon | last post by:
I am self study C student. I got stuck in the program below on quadratic equation and will be most grateful if someone could help me to unravel the mystery. Why does the computer refuse to execute...
3
by: Richard Lewis Haggard | last post by:
We are having a lot of trouble with problems relating to failures relating to 'The located assembly's manifest definition with name 'xxx' does not match the assembly reference" but none of us here...
15
by: Giggle Girl | last post by:
Hello there, :) I need a frameset that will have the same look and behavior in Firefox 1.5+ as it does in IE 6+. Here is a URL for it: http://66.51.164.93/fs/default.htm In IE, the "seam"...
6
by: redashley40 | last post by:
This is my first attempt in SQL and PreparedStatement I have add the PreparedStatement and I'm not to sure if I'm doing it correctly. When I do a test run on Choose 1 ,or 2 I get this error. Error...
1
by: =?ISO-8859-1?Q?Lasse_V=E5gs=E6ther_Karlsen?= | last post by:
I get the above error in some of the ASP.NET web applications on a server, and I need some help figuring out how to deal with it. This is a rather long post, and I hope I have enough details that...
8
by: inFocus | last post by:
Hello, I am new to python and wanted to write something for myself where after inputing two words it would search entire drive and when finding both names in files name would either copy or move...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.