473,660 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ 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 1236
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.getImag e() 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
1675
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 get an error 1935 or something like that. They said, "Error 1935 means you already have Microsoft .Net and this one cannot overwrite it." So we tried finding it on my comp and could not. So they said, "I dont know why Microsoft .Net wont...
2
2969
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 len(surname & "") > 0 and soundex(surname) = soundex("Smith")
2
2122
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 relative newcomer to Access and need to be methodical until it become more familiar. Thanks in advance for your help. I have a form with a subform that has a subform. form: frmEvents subform: sfrmTrialInfo (controlname = )
38
2527
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 my scanf ("%c",&q); On input 3 4 1 (for a,b and c) I had real roots OK On input 1 8 16 I had same real roots OK. However on 4 2 5, (for imaginary roots ) the computer cannot see the scanf ("%c",&q); statement. It just jumps...
3
4395
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 really understand how this could be an issue. The assemblies that the system is complaining about are ones that we build here and we're not changing version numbers on anything. The errors come and go with no apparent rhyme or reason. We do not...
15
7557
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" between the three frames is blue, 4 or 5 pixels wide, and -- most importantly! -- draggable! It is great -- in IE, that is. Is it possible to have this same look and behavior in Firefox?
6
2348
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 - com.mysql.jdbc.Statement here is my code below public class DBAssign { /**
1
7095
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 someone who bothers to read all of it have some pointers. Note, I have posted the stack trace and the code exhibiting the problem further down so if you want to start by reading that, search for +++ Also note that I am unable to reproduce...
8
2315
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 thoe files to a specified directory. But couple of attempts did not work as desired this is one of them. Could someone help fix it or maybe give a better example.
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8539
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6181
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5650
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4176
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4342
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1982
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.