I've been maintaining FX Experience for a really long time now, and I love hearing from people who enjoy my weekly links roundup. One thing I've noticed recently is that maintaining two sites (FX Experience and JonathanGiles.net) takes more time than ideal, and splits the audience up. Therefore, FX Experience will become read-only for new blog posts, but weekly posts will continue to be published on JonathanGiles.net. If you follow @FXExperience on Twitter, I suggest you also follow @JonathanGiles. This is not the end - just a consolidation of my online presence to make my life a little easier!
After seeing a twitter message today asking whether it was possible to create a rectangle in JavaFX which was a mixed rounded and normal rectangle, I thought I’d post how I did this a few months back.
The code below will draw a rounded rectangle in the top-right, bottom-right, and bottom-left corners. The top-left corner is a square point. You can change this by editing the four parameters, and of course trivially modify this code to be a function taking four arguments.
The reason why I have the test for if (topRightCurve > 0) is because when I was writing this code there was a known issue with drawing arcs with a zero radius. I know this has been fixed, but I’m not sure when it was fixed (it may be in 1.2, but most certainly it’s fixed in 1.3).
[jfx]
public var topLeftCurve:Number = 0;
public var topRightCurve:Number = 0;
public var bottomLeftCurve:Number = 0;
public var bottomRightCurve:Number = 0;
Path {
fill: color
stroke: stroke
strokeWidth: 1
elements: bind [
// starting just past the top-left curve
MoveTo { x:topLeftCurve, y:0 },
// draw line to where top-right curve should start
HLineTo { x:menuWidth – topRightCurve },
// arc around to just below the top-right curve
if (topRightCurve > 0) {
ArcTo {
x:menuWidth, y:topRightCurve,
radiusX:topRightCurve, radiusY:topRightCurve,
sweepFlag:true
}
} else null,
// go to just above the bottom-right curve
VLineTo { y: menuHeight – bottomRightCurve }
// arc around to just to the left of the bottom-right curve
if (bottomRightCurve > 0) {
ArcTo {
x:menuWidth-bottomRightCurve, y:menuHeight,
radiusX:bottomRightCurve, radiusY:bottomRightCurve,
sweepFlag:true
}
} else null,
// draw line to where bottom-left curve should start
HLineTo { x:bottomLeftCurve },
// arc around to just above the bottom-left curve
if (bottomLeftCurve > 0) {
ArcTo {
x:0, y:menuHeight-bottomLeftCurve,
radiusX:bottomLeftCurve, radiusY:bottomLeftCurve,
sweepFlag:true
}
} else null,
// go to just below the top-left curve
VLineTo { y: topLeftCurve }
// arc around to just above the bottom-left curve
if (topLeftCurve > 0) {
ArcTo {
x:topLeftCurve, y:0,
radiusX:topLeftCurve, radiusY:topLeftCurve,
sweepFlag:true
}
} else null
]
}
[/jfx]
Another week, another bunch of JavaFX links. It was a relatively quiet week this week in the JavaFX-sphere, but there is still a few good links which I’ve included below.
The JavaFX community is a nice tight-knit group of enthusiasts and developers. Whilst we mostly keep in touch via twitter, we all worry about the people who aren’t part of the twitter community, and who may feel lost and isolated when learning JavaFX. Well, now that JavaFX is an Oracle product, we also mingle in Oracle Mix. Join us if you want to ask questions or just discuss JavaFX.
The JavaFX Composer team (a NetBeans plugin developed at Sun/Oracle which makes building JavaFX-based graphical forms easier) have started a new blog to publicise their progress as they work towards a final release. Everything I’ve heard from people using it is that it is a great tool, and very, very useful for building quality JavaFX-based software.
Simon Morris has posted the second tutorial on his website, covering FXD manipulation.
Rakesh Menon has blogged about some recommended performance optimisations when developing JavaFX applications. These are all very good tips, so do take a moment to make sure you’re aware of them. He plans to maintain this post with similar advice for JavaFX 1.3.
I happened upon this website recently, which is just a single (but rather long) page outlining all of the JavaFX Script syntax. It seems like a very good reference for anyone new to the language.
That’s us for another week. Catch you again next week! 🙂
A lot of good links this week in the JavaFX-sphere. It’s interesting to read the fun that people are having with JavaFX, as well as the controversy of people who don’t quite get JavaFX and it’s relevance. Personally, I think people should continue to discuss their thoughts of JavaFX, but by no means should they write it off just yet – 1.3 is going to be a rocking release and really set the foundation for future releases. Also – give JavaFX a chance, posts like Jonathan Merritts recent post are becoming more frequent as people find hidden delights in JavaFX Script and the API’s being developed.
Anyway – on with the news.
As I mentioned, it’s been a funny old week in JavaFX-land, with both negative posts and positive posts. Being a good link reporter, I’ll leave you to make up your own mind.
The Silicon Valley JavaFX Users Group posted the video for Hinkmond Wong’s ‘Mobile Dojo‘ talk, which I’ve posted on FX Experience in a slightly larger size. You can also see just the slides at Stephen Chin’s blog.
Richard Bair posted about text transitions following a recent bout of bug triage, where he encountered a requested feature which he’s putting back out to the community to try and solve. This is something we occassionally encounter – deciding whether we should develop something internally or rely on third-parties to develop functionality.
Details about the JavaFX Composer preview 2 release came online this week. I’m not sure if this coincided with the actual preview 2 release or not. JavaFX Composer is a plugin for NetBeans that makes it easy to build JavaFX-based user interfaces (although it’s intended for developers moreso than designers, who should use the forthcoming Authoring Tool being developed at Oracle).
Jonathan Merritt decided to use the JavaFX Charting API to roughly predict when he believes the JavaFX 1.3 release will be. He notes that it was more of a chance to play with the chart components (and linear regression models) than anything else, and he is not in a position to actually know the release date – so take it for what it is. Also, note that his chart can only report on the public issues in the JavaFX bug tracker.
That’s all folks. Keep on playing/working with JavaFX and, if you have a website, posting about your experiences with JavaFX. As always, I encourage you to email me, or talk to me on Twitter. You can find us at @fxexperience, and personally at @richardbair, @jasperpotts, and @jonathangiles.
Stephen Chin has just announced that the slides for the third Silicon Valley JavaFX Users Group have been posted online. This talk was by Hinkmond Wong and therefore covered mobile aspects of Java and JavaFX. As I have done for both Richard’s and Amy’s talks previously, I have also embedded the video below for your enjoyment. You can flick between video and the slides by clicking in the top-right area of the player below.
The next talk coming up is a joint talk with the Silicon Valley Web JUG, covering Java Store and JFrog Artifactory. This is on March 10th at 6:00PM at the Googleplex, and you can find all other relevant details at the link above. Be sure to RSVP if you plan to attend, virtually or in person. Remember that attending virtually allows for you to watch the presentation live, and interact with both the presenter via Google moderator questions, as well as taking part in chat with others attending virtually. So it’s not much worse than being there in person!
A heap of JavaFX links this week. It’s great to see more and more chatter going on in twitter and other places related to JavaFX. It feels like people are becoming more excited about what is available now, and what is coming up in JavaFX 1.3. Here’s the links for the past week – I hope you enjoy them!
Rakesh Menon has posted about the download service listener feature that was part of the Java 1.6.0_18 release. As he notes, “it allows you to provide a Custom Progress UI using AWT/Swing/Java2D APIs. It has callback methods which will provide information related to download and validation of resources.”
Following my mention of the need for more Keyboard Cat JavaFX applications, Simon Morris (author of the JavaFX in Action book) obliged and posted another demo which will draw ripples over a video when you click the mouse.