<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!-- NewPage --> <html lang="en"> <head> <!-- Generated by javadoc (1.8.0_77) on Fri Apr 22 13:46:26 UTC 2016 --> <title>BackgroundSize (JavaFX 8)</title> <meta name="date" content="2016-04-22"> <link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style"> <script type="text/javascript" src="../../../script.js"></script> </head> <body> <script type="text/javascript"><!-- try { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="BackgroundSize (JavaFX 8)"; } } catch(err) { } //--> var methods = {"i0":10,"i1":10,"i2":10,"i3":10,"i4":10,"i5":10,"i6":10,"i7":10}; var tabs = {65535:["t0","All Methods"],2:["t2","Instance Methods"],8:["t4","Concrete Methods"]}; var altColor = "altColor"; var rowColor = "rowColor"; var tableTab = "tableTab"; var activeTableTab = "activeTableTab"; </script> <noscript> <div>JavaScript is disabled on your browser.</div> </noscript> <!-- ========= START OF TOP NAVBAR ======= --> <div class="topNav"><a name="navbar.top"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.top.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/BackgroundSize.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">JavaFX 8</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../javafx/scene/layout/BackgroundRepeat.html" title="enum in javafx.scene.layout"><span class="typeNameLink">Prev Class</span></a></li> <li><a href="../../../javafx/scene/layout/Border.html" title="class in javafx.scene.layout"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?javafx/scene/layout/BackgroundSize.html" target="_top">Frames</a></li> <li><a href="BackgroundSize.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_top"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_top"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field.summary">Field</a> | </li> <li><a href="#constructor.summary">Constr</a> | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field.detail">Field</a> | </li> <li><a href="#constructor.detail">Constr</a> | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.top"> <!-- --> </a></div> <!-- ========= END OF TOP NAVBAR ========= --> <!-- ======== START OF CLASS DATA ======== --> <div class="header"> <div class="subTitle">javafx.scene.layout</div> <h2 title="Class BackgroundSize" class="title">Class BackgroundSize</h2> </div> <div class="contentContainer"> <ul class="inheritance"> <li><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">java.lang.Object</a></li> <li> <ul class="inheritance"> <li>javafx.scene.layout.BackgroundSize</li> </ul> </li> </ul> <div class="description"> <ul class="blockList"> <li class="blockList"> <hr> <br> <pre>public final class <span class="typeNameLabel">BackgroundSize</span> extends <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></pre> <div class="block">Defines the size of the area that a BackgroundImage should fill relative to the Region it is styling. There are several properties who's values take precedence over the others. In particular there are 4 key properties, <code>width</code>, <code>height</code>, <code>contain</code>, and <code>cover</code>. Both width and height are independent of each other, however both interact with contain and cover. <p> From the CSS Specification, <code>cover</code> is defined to: <blockquote> Scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area. </blockquote> <code>contain</code> is defined to: <blockquote> Scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area. </blockquote> And width and height both specify (in absolute values or percentages) the size to use. These two properties only apply if both cover and contain are false. If both cover and contain are true, then <code>cover</code> will be used. <p> The width and height may also be set to <code>AUTO</code>, indicating that the area should be sized so as to use the image's intrinsic size, or if it cannot be determined, 100%.</div> <dl> <dt><span class="simpleTagLabel">Since:</span></dt> <dd>JavaFX 8.0</dd> </dl> </li> </ul> </div> <div class="summary"> <ul class="blockList"> <li class="blockList"> <!-- =========== FIELD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="field.summary"> <!-- --> </a> <h3>Field Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Field Summary table, listing fields, and an explanation"> <caption><span>Fields</span><span class="tabEnd"> </span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Field and Description</th> </tr> <tr class="altColor"> <td class="colFirst"><code>static double</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#AUTO">AUTO</a></span></code> <div class="block">From the CSS Specification: An "auto" value for one dimension is resolved by using the image's intrinsic ratio and the size of the other dimension, or failing that, using the image's intrinsic size, or failing that, treating it as 100%.</div> </td> </tr> <tr class="rowColor"> <td class="colFirst"><code>static <a href="../../../javafx/scene/layout/BackgroundSize.html" title="class in javafx.scene.layout">BackgroundSize</a></code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#DEFAULT">DEFAULT</a></span></code> <div class="block">The default BackgroundSize used by BackgroundImages when an explicit size is not defined.</div> </td> </tr> </table> </li> </ul> <!-- ======== CONSTRUCTOR SUMMARY ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.summary"> <!-- --> </a> <h3>Constructor Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Constructor Summary table, listing constructors, and an explanation"> <caption><span>Constructors</span><span class="tabEnd"> </span></caption> <tr> <th class="colOne" scope="col">Constructor and Description</th> </tr> <tr class="altColor"> <td class="colOne"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#BackgroundSize-double-double-boolean-boolean-boolean-boolean-">BackgroundSize</a></span>(double width, double height, boolean widthAsPercentage, boolean heightAsPercentage, boolean contain, boolean cover)</code> <div class="block">Create a new BackgroundSize.</div> </td> </tr> </table> </li> </ul> <!-- ========== METHOD SUMMARY =========== --> <ul class="blockList"> <li class="blockList"><a name="method.summary"> <!-- --> </a> <h3>Method Summary</h3> <table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation"> <caption><span id="t0" class="activeTableTab"><span>All Methods</span><span class="tabEnd"> </span></span><span id="t2" class="tableTab"><span><a href="javascript:show(2);">Instance Methods</a></span><span class="tabEnd"> </span></span><span id="t4" class="tableTab"><span><a href="javascript:show(8);">Concrete Methods</a></span><span class="tabEnd"> </span></span></caption> <tr> <th class="colFirst" scope="col">Modifier and Type</th> <th class="colLast" scope="col">Method and Description</th> </tr> <tr id="i0" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#equals-java.lang.Object-">equals</a></span>(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</code> </td> </tr> <tr id="i1" class="rowColor"> <td class="colFirst"><code>double</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#getHeight--">getHeight</a></span>()</code> <div class="block">The height of the area within the Region where the associated BackgroundImage should render.</div> </td> </tr> <tr id="i2" class="altColor"> <td class="colFirst"><code>double</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#getWidth--">getWidth</a></span>()</code> <div class="block">The width of the area within the Region where the associated BackgroundImage should render.</div> </td> </tr> <tr id="i3" class="rowColor"> <td class="colFirst"><code>int</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#hashCode--">hashCode</a></span>()</code> </td> </tr> <tr id="i4" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#isContain--">isContain</a></span>()</code> <div class="block">If true, scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.</div> </td> </tr> <tr id="i5" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#isCover--">isCover</a></span>()</code> <div class="block">If true, scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.</div> </td> </tr> <tr id="i6" class="altColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#isHeightAsPercentage--">isHeightAsPercentage</a></span>()</code> <div class="block">Specifies whether the value contained in <code>height</code> should be interpreted as a percentage or as a normal value.</div> </td> </tr> <tr id="i7" class="rowColor"> <td class="colFirst"><code>boolean</code></td> <td class="colLast"><code><span class="memberNameLink"><a href="../../../javafx/scene/layout/BackgroundSize.html#isWidthAsPercentage--">isWidthAsPercentage</a></span>()</code> <div class="block">Specifies whether the value contained in <code>width</code> should be interpreted as a percentage or as a normal value.</div> </td> </tr> </table> <ul class="blockList"> <li class="blockList"><a name="methods.inherited.from.class.java.lang.Object"> <!-- --> </a> <h3>Methods inherited from class java.lang.<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></h3> <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#clone--" title="class or interface in java.lang">clone</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#finalize--" title="class or interface in java.lang">finalize</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#getClass--" title="class or interface in java.lang">getClass</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notify--" title="class or interface in java.lang">notify</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#notifyAll--" title="class or interface in java.lang">notifyAll</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#toString--" title="class or interface in java.lang">toString</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait--" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-" title="class or interface in java.lang">wait</a>, <a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#wait-long-int-" title="class or interface in java.lang">wait</a></code></li> </ul> </li> </ul> </li> </ul> </div> <div class="details"> <ul class="blockList"> <li class="blockList"> <!-- ============ FIELD DETAIL =========== --> <ul class="blockList"> <li class="blockList"><a name="field.detail"> <!-- --> </a> <h3>Field Detail</h3> <a name="AUTO"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>AUTO</h4> <pre>public static final double AUTO</pre> <div class="block">From the CSS Specification: <blockquote> An "auto" value for one dimension is resolved by using the image's intrinsic ratio and the size of the other dimension, or failing that, using the image's intrinsic size, or failing that, treating it as 100%. <p> If both values are "auto" then the intrinsic width and/or height of the image should be used, if any, the missing dimension (if any) behaving as "auto" as described above. If the image has neither an intrinsic width nor an intrinsic height, its size is determined as for "contain". </blockquote> When set to AUTO, the values for widthAsPercentage and heightAsPercentage are ignored.</div> <dl> <dt><span class="seeLabel">See Also:</span></dt> <dd><a href="../../../constant-values.html#javafx.scene.layout.BackgroundSize.AUTO">Constant Field Values</a></dd> </dl> </li> </ul> <a name="DEFAULT"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>DEFAULT</h4> <pre>public static final <a href="../../../javafx/scene/layout/BackgroundSize.html" title="class in javafx.scene.layout">BackgroundSize</a> DEFAULT</pre> <div class="block">The default BackgroundSize used by BackgroundImages when an explicit size is not defined. By default, the BackgroundSize is AUTO, AUTO for the width and height, and is neither cover nor contain.</div> </li> </ul> </li> </ul> <!-- ========= CONSTRUCTOR DETAIL ======== --> <ul class="blockList"> <li class="blockList"><a name="constructor.detail"> <!-- --> </a> <h3>Constructor Detail</h3> <a name="BackgroundSize-double-double-boolean-boolean-boolean-boolean-"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>BackgroundSize</h4> <pre>public BackgroundSize(double width, double height, boolean widthAsPercentage, boolean heightAsPercentage, boolean contain, boolean cover)</pre> <div class="block">Create a new BackgroundSize.</div> <dl> <dt><span class="paramLabel">Parameters:</span></dt> <dd><code>width</code> - The width. Cannot be less than 0, except for the value of AUTO.</dd> <dd><code>height</code> - The height. Cannot be less than 0, except for the value of AUTO.</dd> <dd><code>widthAsPercentage</code> - Whether the width is to be interpreted as a percentage</dd> <dd><code>heightAsPercentage</code> - Whether the height is to be interpreted as a percentage</dd> <dd><code>contain</code> - Whether the image should be sized to fit within the Region maximally</dd> <dd><code>cover</code> - Whether the image should be sized to "cover" the Region</dd> </dl> </li> </ul> </li> </ul> <!-- ============ METHOD DETAIL ========== --> <ul class="blockList"> <li class="blockList"><a name="method.detail"> <!-- --> </a> <h3>Method Detail</h3> <a name="getWidth--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getWidth</h4> <pre>public final double getWidth()</pre> <div class="block">The width of the area within the Region where the associated BackgroundImage should render. If set to AUTO, then <code>widthAsPercentage</code> is ignored. This value has no meaning if either <code>contain</code> or <code>cover</code> are specified. This value cannot be negative, except when set to the value of AUTO.</div> </li> </ul> <a name="getHeight--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>getHeight</h4> <pre>public final double getHeight()</pre> <div class="block">The height of the area within the Region where the associated BackgroundImage should render. If set to AUTO, then <code>heightAsPercentage</code> is ignored. This value has no meaning if either <code>contain</code> or <code>cover</code> are specified. This value cannot be negative, except when set to the value of AUTO.</div> </li> </ul> <a name="isWidthAsPercentage--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isWidthAsPercentage</h4> <pre>public final boolean isWidthAsPercentage()</pre> <div class="block">Specifies whether the value contained in <code>width</code> should be interpreted as a percentage or as a normal value.</div> </li> </ul> <a name="isHeightAsPercentage--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isHeightAsPercentage</h4> <pre>public final boolean isHeightAsPercentage()</pre> <div class="block">Specifies whether the value contained in <code>height</code> should be interpreted as a percentage or as a normal value.</div> </li> </ul> <a name="isContain--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isContain</h4> <pre>public final boolean isContain()</pre> <div class="block">If true, scale the image, while preserving its intrinsic aspect ratio (if any), to the largest size such that both its width and its height can fit inside the background positioning area.</div> </li> </ul> <a name="isCover--"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>isCover</h4> <pre>public final boolean isCover()</pre> <div class="block">If true, scale the image, while preserving its intrinsic aspect ratio (if any), to the smallest size such that both its width and its height can completely cover the background positioning area.</div> </li> </ul> <a name="equals-java.lang.Object-"> <!-- --> </a> <ul class="blockList"> <li class="blockList"> <h4>equals</h4> <pre>public boolean equals(<a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a> o)</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#equals-java.lang.Object-" title="class or interface in java.lang">equals</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> </dl> </li> </ul> <a name="hashCode--"> <!-- --> </a> <ul class="blockListLast"> <li class="blockList"> <h4>hashCode</h4> <pre>public int hashCode()</pre> <dl> <dt><span class="overrideSpecifyLabel">Overrides:</span></dt> <dd><code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true#hashCode--" title="class or interface in java.lang">hashCode</a></code> in class <code><a href="https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></dd> </dl> </li> </ul> </li> </ul> </li> </ul> </div> </div> <!-- ========= END OF CLASS DATA ========= --> <!-- ======= START OF BOTTOM NAVBAR ====== --> <div class="bottomNav"><a name="navbar.bottom"> <!-- --> </a> <div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div> <a name="navbar.bottom.firstrow"> <!-- --> </a> <ul class="navList" title="Navigation"> <li><a href="../../../overview-summary.html">Overview</a></li> <li><a href="package-summary.html">Package</a></li> <li class="navBarCell1Rev">Class</li> <li><a href="class-use/BackgroundSize.html">Use</a></li> <li><a href="package-tree.html">Tree</a></li> <li><a href="../../../deprecated-list.html">Deprecated</a></li> <li><a href="../../../index-all.html">Index</a></li> <li><a href="../../../help-doc.html">Help</a></li> </ul> <div class="aboutLanguage">JavaFX 8</div> </div> <div class="subNav"> <ul class="navList"> <li><a href="../../../javafx/scene/layout/BackgroundRepeat.html" title="enum in javafx.scene.layout"><span class="typeNameLink">Prev Class</span></a></li> <li><a href="../../../javafx/scene/layout/Border.html" title="class in javafx.scene.layout"><span class="typeNameLink">Next Class</span></a></li> </ul> <ul class="navList"> <li><a href="../../../index.html?javafx/scene/layout/BackgroundSize.html" target="_top">Frames</a></li> <li><a href="BackgroundSize.html" target="_top">No Frames</a></li> </ul> <ul class="navList" id="allclasses_navbar_bottom"> <li><a href="../../../allclasses-noframe.html">All Classes</a></li> </ul> <div> <script type="text/javascript"><!-- allClassesLink = document.getElementById("allclasses_navbar_bottom"); if(window==top) { allClassesLink.style.display = "block"; } else { allClassesLink.style.display = "none"; } //--> </script> </div> <div> <ul class="subNavList"> <li>Summary: </li> <li>Nested | </li> <li><a href="#field.summary">Field</a> | </li> <li><a href="#constructor.summary">Constr</a> | </li> <li><a href="#method.summary">Method</a></li> </ul> <ul class="subNavList"> <li>Detail: </li> <li><a href="#field.detail">Field</a> | </li> <li><a href="#constructor.detail">Constr</a> | </li> <li><a href="#method.detail">Method</a></li> </ul> </div> <a name="skip.navbar.bottom"> <!-- --> </a></div> <!-- ======== END OF BOTTOM NAVBAR ======= --> <p class="legalCopy"><small><small><a href="https://docs.oracle.com/javase/8/docs/legal/cpyr.html">Copyright</a> (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.</small></small></p> </body> </html>