How to change the icon of JOptionPane and JFileChooser in swing

Hi,
Does any body know how to change the icon of JOptionPane and JFileChooser in swing.
Please help me out in this.
Thanx in advance.

Try this
import javax.swing.*;
import java.awt.event.*;
public class Untitled4 {
  public Untitled4() {
  public static void main(String[] args) {
    ImageIcon i = new ImageIcon("C:/TestTree/closed.gif");
    JOptionPane p = new JOptionPane();
    p.setMessage("This JOptionPane has my icon");
    p.setMessageType(JOptionPane.QUESTION_MESSAGE);
    p.setOptionType(JOptionPane.YES_NO_CANCEL_OPTION);
    final JDialog d = p.createDialog("test");
    d.setIconImage(i.getImage());
    d.setVisible(true);
    d.setModal(true);
    if(Integer.parseInt(p.getValue().toString()) == JOptionPane.YES_OPTION) {
        System.out.println("You Clicked Yes");
}

Similar Messages

  • How to change the icon for print dialog?

    Hello,
    I have a JTable, and with the print() method, I'm able to bring up the Print dialog and successfully print the contents of the table. Example:
    myTable.print( JTable.PrintMode.FIT_WIDTH, myHeaderFormat, myFooterFormat );This works great, but one small detail I'd like to change is the icon in the top-left corner of the dialog. The icon is currently the default Java coffee cup icon, while the rest of my application uses my custom icon. I couldn't find any documentation in the API or tutorials that Java has listed which shows how to change the icon, so I'm not even sure if it's possible (but why shouldn't it be?).
    My question is this: Is it possible to change the default icon in the print dialog? Or do I have to either make my own print dialog somehow, or use a third-party print dialog?
    Thanks

    tjacobs01: Appreciate the assistance (despite your sass). I've already searched the API, tutorials, and this forum. I'm already well aware of the setIconImage() method for JFrame -- after all, that's how I set the icon for my other frames as I previously mentioned. However, I want to set the icon for the print dialog called from the print() method of JTable.
    How would I use setIconImage() for the print() method of JTable? The print() method returns a boolean value, not a JFrame, so I'm just not sure how to implement what you're saying.
    Thanks

  • How to change the icon of the news in Portal?

    Do you know how to change the icon of the news in Portal?
    I use NewBrowser to Browser the news, but I think the Icon of the News is not good,I want change it ? what should I do?
    Thanks for your help!

    Hi,
    if you are talking about the NewsBrowser of Knowledge Management (Content Management -> Explorer -> News), you should see a button "Edit" on the right side of the news.
    Press this button and fill in a new URL in the input field "Image URL". After saving the new settings, the new image should be displayed.
    Kind regards,
    Ralf

  • How to change the Default login script and the USER login script in Netware3.12

    I need to cut down the disk map from Neware 3.12 in Win98 client's PC.
    please tell me
    how to change the Default login script and the USER login script in
    Netware3.12 ?
    Or is there any other ways to do this thing?
    Thanks a lot!

    On 4/6/2006 [email protected] wrote:
    > how to change the Default login script and the USER login script in
    > Netware3.12 ?
    Please repost in the discontinued.forums.
    Edison Ortiz
    Novell Product Support Forum SysOp
    (No Email Support, Thanks !)

  • How to change the icon of coffee on the titile bar

    Hi!
    I am having this problem that
    how to change the icon of coffee on the titile bar
    if someone know how please respond
    Asif

    Next time please post your question in the appropriate forum, since this forum discusses the Java3D API.
    The answer is use the Frame.setIconImage method.

  • How to change the Icon for a JFileChooser ?

    Has anyone figured out how to change the icon for an instance of JFileChooser from the coffee cup to something else?
    I'm on 1.4
    Thanks,
    Ken

    Never mind. I figured it out.
    You have to use an instance of JFrame in the call to showXxxxDialog(Component c). Set the icon of the JFrame to what you want the JFileChooser's icon to be.

  • How I change the icon for iTunes songs?

    When I drag iTunes songs onto my desktop the icon is white with a gray iTunes icon. How can change this icon for all of my iTunes songs?

    Thanks Patrick. I used Control-Click on the actual audio file on my desktop opened the Show View Options menu and turned off the icon preview option. That changed my icons from gray with a white background to red with a white background which is exactly what I wanted.  You pointed me in the right direction. Appreciate it.

  • How to change the icon for 'windows group' in Java 1.6 [Windows XP] ?

    Hello,
    I was wondering if there is a possibility to change the icon for 'windows group' in Java 1.6...
    I'm using Windows XP SP2. Now the windows from my Java 1.6 application are grouped with the standard Sun icon [screen below] on the group.
    http://img382.imageshack.us/img382/8995/iconbl1.png
    I would like to change the icon for my own. Is there a way to do that ?
    Please help.

    Whichever icon I use for the main frame (I tried few), after grouping the main frame and other sub-frames the icon is changed to standard 'Java Sun' icon as you can see in the screenshot from my first post. The problem occurs only when frames are grouped, when the are separated in the task bar their titles and icons are ok...
    So how can I change the icon/title for the group only (for Java 1.6 in Windows XP) ?

  • How to change the icon of a spot in a dynpro application?

    Hi,
    I am trying to change the icons for the spots on the map in a dynpro application dynamically. Is it possible to change the icon for only some of the spots? If yes, which method should I use?
    The images for the icons are located in the mime repository and I added them to the application in the initialization of the application.
    Thanks and regards,
    Marc

    Hello Mark,
    The intended place for any UI technology is method DETERMINE_SPOT_ICONS of the control adapter. The default impl. resides in class CL_VBI_CONTROL_ADAPTER_GEO. There are two options for changing the icons:
    1. derive your own control adapter impl. and overwrite this method
    2. If the default pin assignment is sufficient you may simply replace the images. To do so provide an alternative MIME repository path to method GET_INITIAL_ZIP_ARCHIVE of class CL_VBI_GEOMAP_APPLICATION
    In the later case all pin images need to be available under the new path.
    Hope the answer your question.
    Cheers Uwe

  • How to change the icon in PPOME?

    Hi experts!!!
    I want to change the icon that appears in transaction PPOME, in Detail Area part. I want to put a "Tick" in address flap. I know I have to change it in SPRO Adjust tab Pages in Detail Area, but when I save the changes I make, it doesn't apper, can anybody help me???
    Thanks a lot,
    Regards,
    Rebeca

    Hello Rebeca,
    I am not sure but It all depends on your settings in table T77OMTABS. So perhaps you should check it again steps by steps for scenario OME0 "Organization and Staffing". Hope it helps,
    Kind Regards
    Christine

  • How to change the ESS objects, iViews and Pages, translation in the portal?

    Hello everyone,
    I'd like to change the standard SAP translation for iView and Pages in the Portal level. Does anybody knows how to do this?
    My landscape is NW2004s and  ESS  for  ECC 6.0
    Regards
    Luciano

    you can change the standard SAP iViews and Pages using the Portal Content Translation feature of the Portal ( go to Content Administration->Portal Content Translation. Follow the instructions at
    http://help.sap.com/saphelp_nw04/helpdata/en/25/08174082fe1961e10000000a155106/frameset.htm
    all ESS iviews and pages have their content "ready for translation" and you can use the instructions above to translate that content.
    Tiberiu
    please award points if response was useful.

  • How to change the icon of the Frame(JFrame)

    my doubt is,
    how to change the by default icon(sun coffee cup) icon of a frame to a small user defined icon.
    thank you,
    Ranjith.M

    Take a look at this method:
    http://java.sun.com/j2se/1.4/docs/api/java/awt/Frame.html#setIconImage(java.awt.Image)

  • Change The Icon Of JOptionPane

    Can anybody tell me how can I chnage the Icon of JOptionPane ,
    I would like to chnage the default Icons come with Java, I want my own Icons to be displayed
    Thanx in advance
    pritesh

    hi,
    just use those static showXXXDialog() methods that expect a javax.swing.Icon as parameter, such as:
    JOptionPane.showMessageDialog(null, "My message", "My title", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("info.gif"));
    Or use the showOptionDialog() method that provides similar features.
    sincerely Michael

  • How to change the name / IP address and domain name for BOE Server

    Hello,
    We want to change the name / IP address and domain name for BOE Server, please could you indicate the steps or procedure to follow?
    I need your help
    thank you

    If it's 3.1 just change them, shouldn't cause any issues if by domain name you are referring to changing the domain the computer belongs to. If you are changing your domain for AD authentication then you will may have to take quite a few steps if the old domain is going away. Let us know.
    Regards,
    Tim

  • How to change the icon of the jar file w/o changing the windows setting

    I may be in wrong forum/area but I am not sure.
    I have created a windows executable jar file. Functionally it works fine. I can double click it to start my app. I want to change the icon of the jar file. I know I can change the icon for .jar extension in windows, but I want to be able to give a seperate icon for just this one file.
    All windows applications have thier own icon like Word, Excel etc. Is there any way I can do this for java apps? Also could this icon be kept consistent across platform say if I copy my app to linux? (Assuming it is not made for any particular os.)
    I am sure someone has come across this before.
    Thanks in advance.

    AFAIK you cannot specify an icon for a jar file. You can, however, specify an icon for a Frame using the setIconImage() method. This will have the effect of showing the icon in the taskbar for instance.

Maybe you are looking for

  • Purchased Acrobat 10 and 9, No serial for 9

    Hey all, I have purchased both Acrobat 10 and 9. I logged into my account at Adobe Worldwide Licensing website, and see the serial for 10.  However I do not see the serial for 9, and I am unable to install 9.  Is there any reason why there is no seri

  • Can a thread created in an applet still run after the browser is closed?

    Dear all, I was able to make an applet's thread keep running even the web page changed to other page. Is it possible to make a thread spawned by an applet keep running even if the browser is close? I am using signed applet and JRE1.3.1_02. Thank for

  • Account assignment  G/L Account Reg

    Dear Sap gurus Whenever i am creating Purchase Order with accunt assignment(K) without material number , system is selecting one G/L account automatically,I know the G/L account selection with material number but i don't know the G/L acount selection

  • Knowledge management Functionality  - C4C

    Hi , I am going to work on C4C project  and this my first C4C project with Marketing Sales and  Service as part of the scope. Our Client also have knowledge management functionality as part of the legacy. My question or my concern is  that I am aware

  • Revision no of Routing/Inspection plan in Purchase order

    Hi MM friends, I have two requirements from client 1. Is it possible to update the revision number of Routing/inspection plan or attaching any document in Purchase order to inform the vendor the relevant changes. 2 Also the Routing changed revision n