(Answer) (Category) FAQ-O-Matic : (Category) General : (Category) Designer :
I want to set an icon on a button within the Designer. How do I make the icon available in the Property Editor?
Gillmer Derge writes:

Create a member variable in your class for the icon:

    Icon myIcon = new ImageIcon("my-icon.gif");

Now myIcon should show up in the icon combo box.
2001-Apr-09 12:57pm gyles19@visi.com

Stein Somers writes:

1. Load the icons in a separate class. This has to be done almost exactely like this, it seems. The icon variables have to be static, and have to be initialised on the spot, otherwise JBuilder Designer doesn't understand.

        public class Images {
            public static final Icon logo = new ImageIcon(
                Images.class.getResource("/images/logo.gif"));
            public static final Icon pedist = new ImageIcon(
             ... 

2. Link to these icons in the frame/dialog class, by adding members e.g.

        public class AboutBox extends JDialog {
            Icon logo = Images.logo;

3. Now Designer lists the icons in the combobox for Icon properties exactely as you would expect.

This seems to be the way Designer was supposed to be used, but I couldn't find information about it with the Borland search engine.

2001-Apr-20 10:45am gyles19@visi.com

[Append to This Answer]
2001-Apr-20 10:45am
Previous: (Answer) How do I write my own proxy classes for the Designer?
Next: (Answer) I'm writing a JavaBean. I need it to behave differently in JBuilder's Designer than it will at runtime. How do I do this?
This document is: http://www.visi.com/~gyles19/cgi-bin/fom.cgi?file=124
[Search] [Appearance]
This is a Faq-O-Matic 2.709.
This FAQ administered by gyles19@visi.com.

Other JBuilder Links

Java Community
Java Tools
Code Central
JB OpenTools
Community
Recent
Threads
Borland Chat
Chat FAQ
Feature Matrices
3.0 |  3.5 |  4.0
5.0 |  6.0 |  7.0
Shop for
JBuilder
JBuilder
Downloads
and reg keys
Report Piracy
Online Manuals
4.0 |  5.0 |  6.0
7.0
Borland
DevSupport's
Bug/RFE Form

Quality Central Client
JB Patches &
Updates
JBuilder FAQs TIs
JBuilder
Newsgroups
Tamaracka's
News Archive
Mr. Haki's
JBuilder Machine
JGuru's
JBuilder FAQ
Sun's Bug
Parade
Netring Home - About - Privacy
The
JBuilder Netring Logo
The Borland JBuilder Netring by JBuilder FAQ-O-Matic
[ Join Now | List Sites | Random | << Prev | Next >> ]
[ Previous 5 Sites | Skip Previous | Skip Next | Next 5 Sites ]