How can I design a progress bar in SceneBuilder? - java

Here a simple question I'd like to ask.
I'm making a videogame (with NO graphics) and for that I'm using SceneBuilder. So here is the state of my HP bar :
HP BAR
Now I want to reshape it in order to obtain a heartshape :
HP BAR wanted
Thus, anyone know if it's possible to do it using SceneBuilder with the settings?
Thank you everyone, have a wonderful day.

One simple way, providing the background of the panel is simple, would be to overlay an ImageView over the top of the progress bar. If you use a PNG with a "hole" of transparency, you'd effectively hide the areas of the square that you're not interested in seeing.
In this example, the black pixels would be the same colour as the background colour (in your case grey) and the white pixels would be fully transparent.
The downside to this is that if the panel changes colour then you'll need to recreate your PNG in the new colour.

Related

Custom Vertical ProgressBar in LibGDX

I want to create Custom vertical progress bar with non linear background
In previous implementation I used skin composer , but as I know it works perfect with simple regular shapes (the knob part resize on the all background image so it looks bad in my example ). I also try to hack using several layer behind the progress bar, but for this case the background behind progress bar is transparent.
I suppose this solution can solve my issue but unfortunately I dont understand how can I implemented that solution.
I also try to crop the inside part (that reference), whenever the progress is changed but I dont think that is the best solution (also the increase/decrase animation cannot be simple enabled )
Could you draw the full red progress bar and then load peices of it until it fills up the whole thing?
Here is a way to get pixels from a png image and you could wirrite your own parser:
How do I read pixels from a PNG file?
Or you could search Google for how to get peices of a png or bitmap.

Dimensions of an Android Image

I am creating a reference app which has a navigation bar at the top and the information, in the form of an ImageView, below it surrounded by a ScrollView. I have worked out how to change the image when the next button is pressed. I noticed this being implemented on the below app. I am able to get all the programming working, but I am not to keen on visual editing.
http://media1.android-apps.com/images/pname/com.ninjacoders.mcanary/image1.png
What should the dimensions of the Image be in Gimp?
How would I go about creating customs home screen buttons, and what dimensions should I use for them?
Any further advice on how I should do this would be greatly appreciated.
From within GIMP, you should zoom enough your image - and work with the "pencil" tool, and the "pixel" brush (the one brush right after the pepper brush - they are sorted alphabetically) - this will allow you to proper edit pixel-art images.
You can use teh colorpicker and create a new palette resort to let it easier to pick the few grey tones you are using.
To get to know the exact dimensions, one of the tools in GIMP's toolbox is the "measure" tool - use it to get to know which icon size you need.
As a final tip: do your work on this larger image, and draw the icons you want in separate layers - whenever an icon is done, crop its layer using the crop tool, with the option "crop layers" on (else it will crop the whole image) - and then drage the thumbnail for the image layer containing your icon from the layers dialog into the toolbox - this will create a new image consisting of the icon alone (and is a quite faster workflow than copy + paste as new image).

Creating an Icon with a Tranparent Background

I'm using ImageIcons that I downloaded from a free icon site in my JButtons. Two of them have white backgrounds, and the other one has a black background. I would prefer not to have a background color clash, so I want to make all the backgrounds transparent. I've seen ways to make image backgrounds transparent, but I thought it was kinda roundabout to turn my ImageIcons into Images and back again. Is there a way to make the backgrounds of ImageIcons transparent without converting to Images?
This isn't a Java-solution, but it's a solution I use frequently nonetheless. Download/install Paint.NET and follow this discussion on how to make the background of images transparent. And then use the resulting image for the ImageIcon.
Another non java solution: with photoshop you can select a small white rectangle of the background part, and then menu "Select" > "Similar" if you want to delete all white pixels, or "Grow" if you want to delete all white pixels touching your existing selection.

Draw background for each cell in ObjectListField

I am creating a blackberry apllication which pre-dominantly uses ObjectListFields..All i need now is to draw an image as a background for each cell. I know this is quiet possible but i am not getting hold of the procedure. if i draw bitmap in drawlistrow() function the bluehighlight gets into the background and the cell highlight becomes very hard to read......can anybody help me with a code snippet to get through this problem ....thanks...
As far as i know ObjectListFields focus fills the background of the element blue and alters the foreground color (text) to white.
If you really need to draw an image on the background, you should at least change the foreground color to a high contrast or at make the background image transparent.
Check the style of the graphics in drawListRow with
graphics.isDrawingStyleSet(Graphics.DRAWSTYLE_FOCUS)and set different colors for them.

how do I specify a transparent background colour on a draw2d Figure?

I'm writing an eclipse plugin, and I'm layering some simple figures (i.e. view elements) together to create diagrams.
A simple component looks like this
A simple component with rendering issues http://img115.yfrog.com/img115/4946/componentwithopacity.jpg
The drum icon on the right is part of a tiny widget drawer.
And the incomplete line underneath it is trying to represent multiplicity, but it's being blocked by the widget drawer.
I tried really hard to get a transparent background on the Figure, but the SWT colour class has no way to specify an alpha or transparent colour.
has anyone run into this problem before? How can I make my draw2d Figure background transparent so I can see stuff behind it.
This a small example of various other opacity related issues I've encountered. Solving this would fix a wide range of visual issues.
Any help is greatly appreciated.
CV
So IFigure.setOpaque(false) doesn't do it?
Simply set the alpha from 0 to 255 to your liking. See Graphics#setAlpha(int) during your paint event or see Shape - I think setAlpha(int) exists there too.

Categories

Resources