NetBeans Shisha Integration

One of the top 10 features of Egypt is, of course, the shisha (more specifically, the contents thereof). Here is me last night outside a cafe in Cairo with Hamada, Amr, and Khaled, applying the default shisha usecase:

The discussion obviously turned to the need for tight integration between shisha and NetBeans IDE. Initial brainstorms around powering NetBeans IDE via a shisha were briefly assessed and then rejected as brilliant but impractical. Then, as if out of thin air, the concept of a NetBeans plugin for shishas was born. Here is a first implementation—shisha cursor:

package org.netbeans.shisha;

import java.awt.Cursor;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import org.openide.modules.ModuleInstall;
import org.openide.windows.WindowManager;

public class Installer extends ModuleInstall {

    @Override
    public void restored() {
        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                //Create the cursor:
                Toolkit tk = Toolkit.getDefaultToolkit();
                ImageIcon shishaImageIcon = new javax.swing.ImageIcon(getClass().getResource("/org/netbeans/shisha/shisha.png"));
                Image shishaImage = shishaImageIcon.getImage();
                Cursor shishaCursor= tk.createCustomCursor(shishaImage, new Point(10,10), "Shisha");
                //Use the cursor in the main window:
                JFrame frame = (JFrame) WindowManager.getDefault().getMainWindow();
                frame.setCursor(shishaCursor);
            }
        });
    }

}

And this is how the source structure looks, together with the shisha cursor installed into the IDE:

Even tighter integration can be achieved by setting the shisha cursor in the editor too, by changing the caret to use the same icon. Further steps could involve extending the Options window with a selection of different shishas from which the user can select their preferred model. In this case, unfortunately, the content thereof is irrelevant.

Comments:

Lol :D

Posted by N, Varun on January 06, 2009 at 01:51 AM PST #

It is greet that you came to egypt and make a beautiful session in MUFIX
but shisha is bad for your health :D:D
I hope u spent agood time in egypt

Posted by Nour-MUFIX on January 06, 2009 at 04:30 AM PST #

loooooool :D

Posted by guest on January 06, 2009 at 08:24 AM PST #

Use
ImageUtilities.image2Icon(ImageUtilities.loadImage(...))

it is more effective as it does a bit of caching. Also it allows easy conversions between Image and Icon as one object implements both the Image and Icon types.

Posted by Jaroslav Tulach on January 06, 2009 at 03:55 PM PST #

:D, nice pics :)

I was invited to come, but urgent matters prevented me :(

anyway I am sure you are enjoying your visit to Egypt, hope you enjoy much more :)

Posted by Anwer Matter on January 06, 2009 at 05:16 PM PST #

:D I was one of the people who have see this plugin in action

Posted by Ahned Gaber on January 07, 2009 at 02:45 AM PST #

Thank u Mr Greetjan for meeting us (i'm and Ahmed Gaber ).
And I was joke about second book but i think u understond this .
thanks again , and we all waits u for meeting in cairo again and give u a shisha .

Posted by Mahmoud Heshmat on January 07, 2009 at 03:01 AM PST #

and here another Shisha Integeration Module for NetBeans, I've told Mr Geertjan that I'll make my own and blog about it

http://aigdonia.blogspot.com/2009/01/my-first-netbeans-module-forwarded-to.html

I hope you Enjoy your time in Egypt Sir,

Posted by Ahmed Gaber on January 09, 2009 at 06:30 PM PST #

Doesn't look POSIX-compliant to me.

Posted by Mark on January 10, 2009 at 06:06 AM PST #

that's pretty sweet, good work on that netbeans shisha! we need more creative programming libraries that have hookah references

Posted by Mr. Hookah on February 08, 2010 at 04:00 PM PST #

What creative programming! Hows Egypt now after the revolution? And what about shisha are people finding it safe to sit in cafe's and smoke shisha?

Posted by shisha on May 22, 2011 at 05:05 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today