In JavaFX 2.1 button image is not shown - javafx-2

JavaFX 2.1:
My button with image works fine in JavaFX 2.0. Upgrade to JavaFX 2.1, the image disappeared.
Here is the code:
Button aButton = new Button("Test");
String iconPath = "/com/abc/res/toolbar/Help.gif";
Image aIcon = new Image(
getClass().getResourceAsStream(iconPath), 18, 18, false, false);
aButton.setGraphic(new ImageView(aIcon));
This works under JavaFX 2.0. It doesn't work under JavaFX 2.1. To make the graphic shows up, I have to remove the re-size function.
Image aIcon = new Image(getClass().getResourceAsStream(iconPath));
Any suggestion?

The button graphic not showing up for the resized image would appear to be a regression - to get it fixed, file a bug to http://javafx-jira.kenai.com with your sample code and sample image.
As a workaround, load the Image without resizing it in the constructor and resize the loaded image in an ImageView via imageView.fitWidth() and imageView.fitHeight().

Related

Adding paintcode stylekit images to storyboard not showing preview

I'm following the instructions for adding stylekit images to storyboards by adding an object, setting it's class to stylekit and then right click dragging to the UIImage from the stylekit object - however I'm not seeing the images show up in UIImageView preview in the storyboard. The image is there when I run the code however.
Is there a different series of steps I need to take? I'm using ios9 xcode 7.
Interface Builder doesn’t allow previewing this kind of connections. To see the image in IB, you will need to subclass the view, mark it as #IBDesignable and override drawRect method, where you call the StyleKit drawing method.

how to remove default graphic assigned to a control (like buttons and checkboxes) before setting new graphic to that control in java fx scene builder?

i am making a java desktop application using javafx. For gui building i am using scene builder 2.0.
Everything is just perfect as expected just 1 thing. I want to customize the buttons. i want to assign a custom graphic to a button.
When i use [button.setgraphic(node)] , this statement set the new graphic to the button but default graphic of button also remains present as well.
I just want to remove the default graphic and then want to assign the new (custom) garaphic to a control like buttons and radio buttons in javafx. 1 thing again i must tell that i am using scene builder for building gui.
How can i achieve this ?
thanks in advance....
Below is the screen-shot of current occuring situation, .....
Here i have made a button using javafx scene builder , and then in the controller of the fxml file (.java file) i am trying to set the image (shown in orange box in snapshot) to that button by using setGraphics property of button ..... i just need that button to be of following shape ...
You'd better customize your button via CSS. Here goes tutorial. What you are trying to do is to modify button picture (which is empty by default). I guess this wasn't your exact purpose.
button.setGraphic(null)
// worked for me.

JavaFX 2.2: Applying color effect on ImageView resizes back to image dimensions

I create an imageView and resize it. After applying a color effect it gets resized back to original dimensions.
Envi: Oracle JDK 7 (1.7.0_51-b13) and Oracle JDK 8 (8b124-0~webupd8~0)
final ImageView imageView = new ImageView(image);
imageView.setPreserveRatio(true);
imageView.setFitHeight(image.getHeight() * imageViewScale);
imageView.setFitWidth(image.getWidth() * imageViewScale);
Resizing works fine until now. But colorizing it resizes back to embedded image dimensions.
final Blend effect = new Blend(BlendMode.SRC_ATOP, new ImageInput(imageView.getImage()), new ColorInput(0, 0, imageView.getImage().getWidth(), imageView.getImage().getHeight(), color));
imageView.setEffect(effect);
Even a later resetting does not work
imageView.setFitHeight(height);
imageView.setFitWidth(width);
I already tried the approach of the ImageViewPane in https://javafx-jira.kenai.com/browse/RT-21337 but it could not handle the case as well.
Any ideas?

UITabbar in ios7 for monotouch

I am changing tabar to work in ios7 I am having one image for selected as well as unselected tabbarItem image.And as SetFinishedImages() has deprecated in ios7.So how should I apply one image for selected as well as unselected tabaritem.Which method should I use in xamarin for this.And how to differentiate that tabbaritem is selected/unselected as I am using one image.
You should use Appearance:
UITabBar.Appearance.BackgroundImage = UIImage...
UITabBar.Appearance.SelectoinIndicatorImage = UIImage...

Setting background to GroupTableViewBackgroundColor

I have a UIViewController in my Monotouch iPhone application and I want to set the background to what you have in a UITableViewStyle.Grouped. However when I use the code below it returns a black screen.
this.View.BackgroundColor = UIColor.GroupTableViewBackgroundColor; // Black screen
this.View.BackgroundColor = UIColor.Red; // Works
I call these in the ViewWillAppear method. If I comment out the GroupTable then the background gets set to Red. When I comment out the second line all I get is a black screen.
Does anyone know why this is? Can you not call UIColor.GroupTableViewBackgroundColor if your not in a UITableViewController?
Thanks
Mike
i have used this on my current project & it works fine i have xcode 4.0 & simulator 4.3
i have found on net that it is deprecated on ios 6
i have used like this
[self.tableview setBackgroundColor:[UIColor groupTableViewBackgroundColor]];
just have look at this link is groupTableViewBackgroundColor deprecated on iOS 6?
for alternative you can find out same image as UItableview Grouped style background on internet.

Resources