Esempio n. 1
0
 public static ImageIcon getImageIcon(String name) {
   if (name != null) {
     return IconsFactory.getImageIcon(DesignerIconsFactory.class, name);
   } else {
     return null;
   }
 }
  @Override
  protected AbstractGadget createGadget(String key) {
    AbstractGadget dashboardElement =
        new AbstractGadget(
            key,
            IconsFactory.getImageIcon(
                DockableFrameDashboardDemo.class, "icons/" + key.toLowerCase() + "_32x32.png"),
            IconsFactory.getImageIcon(
                DockableFrameDashboardDemo.class, "icons/" + key.toLowerCase() + "_64x64.png")) {
          public GadgetComponent createGadgetComponent() {
            final DockableFrameGadget gadget = new DockableFrameGadget(this);
            if (getKey().startsWith("Calculator")) {
              gadget.getContentPane().add(GadgetFactory.createCalculator());
            } else if (getKey().startsWith("Call")) {
              gadget.getContentPane().add(GadgetFactory.createCalendar());
            } else if (getKey().startsWith("Notes")) {
              gadget.getContentPane().add(GadgetFactory.createNotes());
            } else if (getKey().startsWith("Find")) {
              gadget.getContentPane().add(GadgetFactory.createFind());
            } else if (getKey().startsWith("News")) {
              gadget.getContentPane().add(GadgetFactory.createNews());
            } else if (getKey().startsWith("Chart")) {
              gadget.getContentPane().add(GadgetFactory.createChart());
            } else if (getKey().startsWith("Clock")) {
              gadget.getContentPane().add(GadgetFactory.createClock());
            } else {
              gadget.setPreferredSize(new Dimension(200, 100 + (int) (Math.random() * 100)));
            }
            return gadget;
          }

          public void disposeGadgetComponent(GadgetComponent component) {
            // do nothing in this case as we didn't allocate any resource in createGadgetComponent.
          }
        };
    dashboardElement.setDescription("Description is " + key);
    return dashboardElement;
  }
Esempio n. 3
0
 public static void main(String[] argv) {
   IconsFactory.generateHTML(DesignerIconsFactory.class);
 }