Tuesday, January 6, 2009

NetBeans Shisha Integration

By: Geertjan Wielenga | Product Manager
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.

Join the discussion

Comments ( 11 )
  • N, Varun Tuesday, January 6, 2009

    Lol :D


  • Nour-MUFIX Tuesday, January 6, 2009

    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


  • guest Tuesday, January 6, 2009

    loooooool :D


  • Jaroslav Tulach Tuesday, January 6, 2009

    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.


  • Anwer Matter Wednesday, January 7, 2009

    :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 :)


  • Ahned Gaber Wednesday, January 7, 2009

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


  • Mahmoud Heshmat Wednesday, January 7, 2009

    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 .


  • Ahmed Gaber Saturday, January 10, 2009

    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,


  • Mark Saturday, January 10, 2009

    Doesn't look POSIX-compliant to me.


  • Mr. Hookah Tuesday, February 9, 2010

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


  • shisha Sunday, May 22, 2011
    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?
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.Captcha
 

Visit the Oracle Blog

 

Contact Us

Oracle

Integrated Cloud Applications & Platform Services