This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 127079 - Specify Icons for a Dialog
Summary: Specify Icons for a Dialog
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker with 1 vote (vote)
Assignee: Stanislav Aubrecht
URL:
Keywords: API
Depends on:
Blocks:
 
Reported: 2008-02-10 17:58 UTC by David.m Beer
Modified: 2010-10-07 10:40 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David.m Beer 2008-02-10 17:58:22 UTC
I would like to be able to specify a custom Icon when creating either a DialogDescriptor or a NotifyDescriptor. This
should be similar to the way you can specify your own Icon in a JOptionPane.
Comment 1 Jiri Rechtacek 2008-02-12 10:31:25 UTC
There are three ways how to specified a icon in Dialog:
1) choose one from standard icons specified by message type (ERROR_MESSAGE, INFORMATION_MESSAGE, WARNING_MESSAGE,
QUESTION_MESSAGE, PLAIN_MESSAGE) See
http://bits.netbeans.org/dev/javadoc/org-openide-dialogs/org/openide/NotifyDescriptor.html#setMessageType(int)
2) your message/innerPane can be JLabel decorated by icon
(http://bits.netbeans.org/dev/javadoc/org-openide-dialogs/org/openide/DialogDescriptor.html#DialogDescriptor(java.lang.Object,%20java.lang.String))
3) your message/innerPane can be Object[], e.g. new Object[] {<my_icon>, <my_component>}. DialogDisplayer uses
FlowLayout for layout these parts of message.
Maybe it can help you.
Comment 2 ssamayoa 2008-02-12 14:34:29 UTC
I tried #1 in Windows but doesnt work:

        PruebaPanel p = new PruebaPanel();
        DialogDescriptor d = new DialogDescriptor(p, "Hola mundo !!", true,
                NotifyDescriptor.INFORMATION_MESSAGE, null, new ActionListener() {
            public void actionPerformed(ActionEvent e) {
            }
        });

It doesnt show the ICON.
Comment 3 David.m Beer 2008-02-12 22:46:15 UTC
My main point here is that to specify an Icon it takes quite a bit of coding it would be nice to be able to just specify
the Icon in the constructor, like you do with JOptionPane.

I thought the Dialogs API was based around the JOptionPane idea. For a simple Dialog you should be able to specify your
title, message, option type (type of buttons), your own icon if needed.