public class IconFactory extends Object implements GraphicFactory<Node>
<icon-location>/<icon-base-name>.<icon-extension>
, then this factory looks for
<icon-location>/<icon-base-name><size>.<icon-extension>
and scales it to the requested size.
E.g.
GraphicFactory graphicFactory = new IconFactory("/somePath/save.png", new ResourceLoader(MyClass.class), false);
Node menuItemGraphic = graphicFactory.createGraphic(16); // will look for "/somePath/save16.png"
Node toolbarButtonGraphic = graphicFactory.createGraphic(24); // will look for "/somePath/save24.png"
Constructor and Description |
---|
IconFactory(String icon,
org.softsmithy.lib.util.ResourceLoader resourceLoader,
boolean smoothIcon)
Creates a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
ImageView |
createGraphic(int size)
Creates a graphic with the specifed size.
|
protected String |
getIconResourcePath(int size)
Gets the resource path of the icon with the specified size.
|
public IconFactory(String icon, org.softsmithy.lib.util.ResourceLoader resourceLoader, boolean smoothIcon)
icon
- the icon name pattern.resourceLoader
- the ResourceLoadersmoothIcon
- the scaling algorithmpublic ImageView createGraphic(int size)
createGraphic
in interface GraphicFactory<Node>
size
- the graphic sizeprotected String getIconResourcePath(int size)
size
- the size of the iconCopyright © 2012–2019 Drombler. All rights reserved.