Friday, December 31, 2010

Wednesday, December 29, 2010

More Pandora Console Videos!

Although the Pandora console people haven't made exactly one video per day, they sure are making lots of them. Here are some more!

Video 29 (NES Emulation):

Video 30 (GameBoy Emulation):

Thursday, December 23, 2010

Creating a SWT Shell that can be opened from another Java Class using WindowBuilder

WindowBuilder (sometimes called WindowBuilder Pro) is an excellent add-on for Eclipse that allows you to visually build GUIs using SWT, Swing, and a variety of other frameworks including GWT. Google acquired Insantiations, the company that made WindowBuilder, in August of 2010 and recently announced that they are donating the source code and IP of the WindowBuilder project to the Eclipse Foundation. This will likely make WindowBuilder the standard visual GUI creator for those that use Java in the Eclipse IDE.

OK, now you know a little bit about the project. You may have discovered that when using the WindowBuilder wizard to create a new shell, the wizard always creates a shell with a main method. This is very useful for quick, one screen projects, but not for projects that require more than one window.

So, do you want to create a Shell that can be called from inside another class (say, in response to a button click)?

Here are the steps that I used to accomplish the task.



  • Use the SWT WindowBuilder Wizard to make a new shell, name it anything you want (NotMain, in the following case) modify the given code as such:



  • Remove from the main method:

Display display = Display.getDefault();
        Test shell = new Test(display);

  • Cut this code out from the main method:

try {
        shell.open();
        shell.layout();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

  • Change it to:

try
        {
            open();
            layout();
            while (!isDisposed()) 
            {
                if (!display.readAndDispatch()) 
                {
                    display.sleep();
                }
            }
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }

  • Place that code directly after

createContents();
in
public NotMain(Display display)
.

  •  Then, completely remove the main method. You should then be able to make all further modifications in the WindowBuilder "Design" window. You can remove the try/catch block, if you feel like it.


You’ll end up with something like this:
import org.eclipse.swt.SWT;
    import org.eclipse.swt.widgets.Display;
    import org.eclipse.swt.widgets.Shell;
    
    public class NotMain extends Shell 
    {
    
        /**
         * Create the shell.
         * @param display
         */
        public NotMain(Display display) 
        {
            super(display, SWT.SHELL_TRIM);
            createContents();
            try
            {
                open();
                layout();
                while (!isDisposed()) 
                {
                    if (!display.readAndDispatch()) 
                    {
                        display.sleep();
                    }
                }
            }
            catch (Exception e)
            {
                e.printStackTrace();
            }
    
        }
    
        /**
         * Create contents of the shell.
         */
        protected void createContents() 
        {
            setText("SWT Application");
            setSize(450, 300);
    
        }
    
        @Override
        protected void checkSubclass() 
        {
            // Disable the check that prevents subclassing of SWT components
        }
    
    }

Then, to call this shell from inside of a different class, write:
btn.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                new NotMain(getDisplay());
             }
        });
(where btn is the name of your SWT button)

To change the shell to be application modal to the calling class, change your superclass call in your new shell from:
super(display, SWT.SHELL_TRIM);
to:
super(display, SWT.APPLICATION_MODAL |SWT.SHELL_TRIM);


There you go. Now, get coding!

Monday, December 13, 2010

Beginning Android Development

This Android development video was published on the O'Reilly Media YouTube Channel in August of 2009, so it isn't the newest video, but it is quite comprehensive. Check it out:

Tuesday, December 7, 2010

Google Wave enters Apache Software Foundation's incubator program.

Google Wave is dead. Long live Apache Wave. The announcement is here.

With this announcement comes a host of technical information and videos on the Wave Summit Talks page.

For example, here is a video about building and running a "Wave-in-a-Box":


This seems like the best possible result for a once-promising Google technology that has since fallen out of favor.

Monday, December 6, 2010

Google Nexus S, Android 2.3 (Gingerbread) announced!

Check it out! Google have introduced the new Nexus S phone along with Android 2.3, codenamed Gingerbread.

Android 2.3 Official video:


NFC (Near Field Communication) and the Nexus S:


Nexus S- Navigation:


Google Goggles:


Check out the Google Nexus Youtube page and the Google Android Developers Page for more.

Bluetooth Android enabled watch accessory announced by Sony Ericsson

Check out the LiveView, a new device from Sony Ericsson that is designed to work as a secondary display and remote control for your Android device:

It should be interesting to see what the Android development community can do with a device like this.

Sunday, December 5, 2010

Zork Typewriter Hack

It looks like someone by the name of Jonathan Guberman has hacked an Electric typewriter to play Zork. That is incredibly impressive.
Check out the video:

A new way to interact with fiction from Jonathan M. Guberman on Vimeo.

Thursday, December 2, 2010

SNES controller modded to run on Android Tablet!

Check out the enterprising mod by Collin Meyer to modify a Super Nintendo game controller to play emulated SNES games on a Dell Streak Android tablet:


He has also provided a HOWTO, for those that are so inclined.

Bravo!

Android 2.2 (Froyo) and Google Marketplace on Archos tablets

Archos has officially made Android 2.2 available for its generation 8 tablets (Archos 28, Archos
32, Archos 43, Archos 70 and Archos 101). The firmware is available here, or you can select Settings->About device->Firmware update.

Once you have upgraded to Android 2.2, you can also install the Android Marketplace, by following the directions in this forum post.

Also, here is a video showing off Android 2.2 and the Android Marketplace: