Jonathan Giles has announced the release of the JavaFX Menubar that he created for the JFXtras project. To demonstrate how to use it, I've added a menu to the BandmatesFX program that I've been developing in this series of blog posts.
By the way, my grand scheme for the BandmatesFX program is for it to become what I'm calling an image-based knowledge navigation facility. It's going to be an open-source JFXtras example, where Sten Anderson (JavaFX Coding Challenge winner) and others will collaborate with me in its continued design and development. A baby step in that direction has been to add the ability to reference space mission information so that users can interact with astronauts and missions in the same way they can now interact with musicians and bands. Here's a screenshot of the program with the JFXtras menu:
As you can see from the screenshot, there are a couple of items in the View menu, enabling the user to toggle the following states:
- The Google Map menu item controls whether the map shown above is visible.
- The Topics with No Image menu item controls whether topics (e.g. astronauts, missions, musicians, and bands) that don't have an associated image in the Freebase database) will be displayed.
Go ahead and launch the application using the Java Web Start Launch button below, consulting past articles such as this one in the series for instructions on how to use it. Note: Now that there is a Help menu, it'd probably be a good idea for me to put the instructions in a help facility :-P
Here's the menu-related code in this program:
var menubar: MenuBar;
menubar = MenuBar {
width: bind sceneRef.width;
menus: [
// View Menu
Menu {
text: "View"
items: [
CheckedMenuItem {
text: "Google Map"
checked: bind showLocationMap with inverse
graphic: bind if (showLocationMap) {
ImageView {
image: Image {
url: "{__DIR__}images/lightbulb_on.png";
}
}
}
else {
ImageView {
image: Image {
url: "{__DIR__}images/lightbulb.png";
}
}
}
},
CheckedMenuItem {
text: "Topics with No Image"
checked: bind showTopicsThatHaveNoImage with inverse
action: function() {
obtainGroupsForArtist(artistToSearch);
}
graphic: bind if (showTopicsThatHaveNoImage) {
ImageView {
image: Image {
url: "{__DIR__}images/lightbulb_on.png";
}
}
}
else {
ImageView {
image: Image {
url: "{__DIR__}images/lightbulb.png";
}
}
}
}
]
},
// Help Menu
Menu {
text: "Help"
items: [
MenuItem {
text: "About"
action: function() {
Alert.inform("About BandmatesFX",
"Developed by Jim Weaver/JFXtras team to "
"demonstrate JFXtras (and Freebase) features.");
}
graphic: ImageView {
image: Image {
url: "{__DIR__}images/about.png";
}
}
}
]
}
]
}
Jonathan has done a great job in defining a simple API, as well as creating an appearance for these menus that blend well with the Caspian skin in the JavaFX 1.2 UI controls. Thanks Jonathan!
Regards,
Jim Weaver
Your blog is perfect! Very good article gives a person see admire that has a kind of feeling! Xi xi you share!
Posted by: Rerto Jordans | June 28, 2010 at 09:33 PM
The Spanish Plateresque design church opened in 1940 and is meant to hearken back to Toledo’s namesake in Spain. It is the only church of its design in North America.
Posted by: buy kamagra | April 27, 2010 at 01:15 PM