I wanted to use PNG for my buttons but considering that I suck when it comes to graphics, and I do not have the time to surf and learn how to make one with normal and pressed button states, I was lucky to chance upon the Android Button Maker website.

Now, if you only are into those simple and minimalistic styled buttons, this website will help you easily create buttons without using images. Yes, only XML code is needed.

What’s more, when you want to set something like choosing a color, the results are shown in real time. Even the source code too!

The developer did a very good job with this. There are detailed instructions on how to use the XML files in the layout which can also help developers new to Android.

So I would like to say kudos to his work. The developer who made this definitely helped save me quite a lot of time. If there is some easier and quicker way to make a simple button, why make an image, right? It will only add up to memory consumption too ;).

Visit http://angrytools.com/android/button/

Adding a Button node inside a ListView in Java FX 2 is pretty easy. Create a custom class that extends ListCell and integrate your object within it. See my sample class code.

Then use the class in the ListView object by doing it like this:

That’s it! Easy, right?

In Swing, an image button is possible by setting the background color of the JButton to transparent and the image will still show its pressed and normal state effect when clicked.

In Java FX 2 however, when you add an image to the Button control and set the background to transparent using -fx-background-color: transparent, you are left with a static image that does not move whenever you click on it.

There is no ready made class in Java FX 2 that does this so the only solution left is to make one. What I did is extend from Button class and simulate the pressed and released effect by changing the padding values whenever a mouse event occurs.

That’s it! It is as simple as that.

Related Posts Plugin for WordPress, Blogger...