Friday 27 March 2009

Getting JFXtras to run on a Mac

Many people have encountered problems getting JFXtras to run on a Mac and a number of solutions have been proferred.

This simple solution worked for me:

1 - Close Netbeans
2 - Open a terminal window
3 - cd /System/Library/Frameworks/JavaVM.framework/Versions
4 - rm -f CurrentJDK (this is just a symlink to version you are using)
5 - ln -s 1.6 CurrentJDK
6 - close terminal window
7 - start Netbeans

Just to test it, I threw together the following code (copied and paste from various resources, so nothing original here)


/*
* Main.fx
*
* Created on Mar 27, 2009, 7:34:38 AM
*/

package test;

import javafx.ext.swing.SwingButton;
import javafx.lang.FX;
import javafx.scene.layout.HBox;
import javafx.scene.Scene;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;

/**
* @author johndunning
*/
var stage:Stage;

stage = Stage {
title: "Application title"
width: 250
height: 80
scene: Scene {
content: [ Text {
font : Font {
size : 16
}
x: 10, y: 30
content: "Application content"
},
HBox {
content: [

SwingButton {
text:"Click Me"
action:function()
{
var help:Help = Help{}
help.showHelp(stage);
}
},
SwingButton {
text:"Exit"
action:function()
{
FX.exit();
}

}
]
}


];
}
}



package test;

import javafx.ext.swing.SwingButton;
import javafx.ext.swing.SwingLabel;
import javafx.scene.Scene;
import javafx.stage.Stage;
import org.jfxtras.scene.layout.Cell;
import org.jfxtras.scene.layout.Grid;
import org.jfxtras.scene.layout.GridConstraints;
import org.jfxtras.scene.layout.Row;
import org.jfxtras.stage.JFXDialog;

package class Help
{
package function showHelp (owner: Stage): Void
{
def helpText = ""
"Welcome to Text Search!

"
"Enter the search text in the text field.
"
"Click Search to initiate the search.
"
"Click Stop to interrupt a search.
"
"Click Help to display this help.
"
"
"
"The paths of all files that contain
"
"the search text appear in the list."
"";

var dialogRef: JFXDialog;
dialogRef = JFXDialog
{
title: "Text Search Help"

owner: owner
modal: true
packed: true
resizable: false

scene: Scene
{
content: Grid
{
border: 15

rows:
[
Row
{
cells: SwingLabel
{
text: helpText
}
}
Row
{
cells: Cell
{
content: SwingButton
{
action: function (): Void
{
dialogRef.close ()
}

text: "OK"
}

horizontalAlignment: GridConstraints.CENTER
}
}
]

vgap: 10
}
}
}
}
}

Thursday 2 October 2008

How to Make a Script Clickable

if you're running leopard, then simply

chmod +x (script)

Tuesday 12 August 2008

Installing a Western Digital My Book

Ok, if you decide to go with one of these - for now forget the network drive. I couldn't get that to work with a Mac at all.

Instead, go with the USB version. I went with the 1TB My Book Essential usb.

Don't try anything clever like formatting it to a Journaled Mac Volume because it won't work. Simply reformat it as a Dos volume and rename it to whatever you want the drive to be called. Then start Time Machine, point Time Machine at the drive and let Time Machine format it for you.

Runs like a dream after that.

Saturday 12 July 2008

Accessing Shared Folders from Vista in VirtualBox

Name your shared folder in VirtualBox - e.g. 'Shared1'.

In Windows Map a network drive to: \\vboxsvr\Shared1.

Anybody running Vista in VirtualBox on a Mac may have problems seeing shared folders.

There are a number of blogs and threads around describing tips and tricks to resolve the problem.

In my case the problem was quite simple - Windows Live OneCare was configured with my Wifi Network as Public which meant it blocked local networking. Just change it to Private, or Home and the problem is resolved.

Monday 7 July 2008

Netbeans Fails to Open Projects after installing Plug-ins

This one is a beauty. I finally resolved it by adding plug-ins in in groups and isolating the actual plug-in that causes the problem.

The openoffice api (developer) causes a null pointer exception and stops any or all projects being opened/created and displayed in the project dialog.