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.
Summary: | Specify Icons for a Dialog | ||
---|---|---|---|
Product: | platform | Reporter: | David.m Beer <dbeer> |
Component: | Dialogs&Wizards | Assignee: | Stanislav Aubrecht <saubrecht> |
Status: | NEW --- | ||
Severity: | blocker | CC: | hmichel, raccah |
Priority: | P3 | Keywords: | API |
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
David.m Beer
2008-02-10 17:58:22 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. 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. 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. |