Class GlassPane
The GlassPane creates a layered container with two internal panes:
- Glass pane - A background layer that can be tinted with color and opacity
- Content pane - A foreground layer where child elements are added
This is useful for creating modal dialogs, overlay effects, or frosted glass UI patterns. The glass pane sits behind the content, allowing you to apply semi-transparent colors or background images that show through the content area.
Usage Example:
GlassPane overlay = new GlassPane(50, Color.BLACK);
overlay.addElement(new Paragraph("Content on top of tinted background"));
- Author:
- Marvin P. Warble Jr.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal GlassPaneaddElement(Element child) Adds a child element to this element.protected final voidcreate()Hook method called during element creation.final GlassPaneinsertElement(int index, Element child) Inserts a child element at the specified index.final voidRemoves all child elements from this element.final voidremoveElement(Element child) Removes a child element from this element.final voidremoveElement(String id) Removes a child element by its ID.final StyledElementsetBackground(Color color) Sets the background color of the glass pane layer using a Color object.final StyledElementsetBackground(String color) Sets the background of the glass pane layer using a CSS color string.setBackgroundClip(BackgroundClip attrValue) Sets the background clip of the glass pane layer using a BackgroundClip constant.setBackgroundClip(String attrValue) Sets the background clip of the glass pane layer using a CSS string value.final StyledElementsetBackgroundColor(Color color) Sets the background color of the glass pane layer using a Color object.final StyledElementsetBackgroundColor(String color) Sets the background color of the glass pane layer using a CSS color string.final StyledElementsetBackgroundImage(String url) Sets the background image of the glass pane layer.setBackgroundOrigin(BackgroundOrigin attrValue) Sets the background origin of the glass pane layer using a BackgroundOrigin constant.setBackgroundOrigin(String attrValue) Sets the background origin of the glass pane layer using a CSS string value.final StyledElementSets the background position of the glass pane layer.final StyledElementsetBackgroundRepeat(String repeat) Sets the background repeat behavior of the glass pane layer.setBackgroundSize(int width, int height) Sets the background size of the glass pane layer using pixel width and height values.setBackgroundSize(BackgroundSize attrValue) Sets the background size of the glass pane layer using a BackgroundSize constant.setBackgroundSize(Units width, Units height) Sets the background size of the glass pane layer using Units values for width and height.setBackgroundSize(String attrValue) Sets the background size of the glass pane layer using a CSS string value.setBackgroundSize(String width, String height) Sets the background size of the glass pane layer using CSS string width and height values.final GlassPanesetElement(Element child) Replaces all child elements with a single child element.final StyledElementsetOpacity(int opacity) Sets the opacity of the glass pane layer.Methods inherited from class com.oorian.html.StyledElement
addClass, addStyle, addStyle, addStyleAttribute, addTransition, animate, clearTransitions, getActiveStyle, getCssClass, getDisabledStyle, getFocusStyle, getFocusVisibleStyle, getHoverStyle, getHtml, getStyle, getStyleAttribute, hidden, hide, initialize, isDisplayed, isTransitionForwardActive, onHide, onRemovedFromPage, onShow, removeClass, setActiveStyle, setAlignContent, setAlignContent, setAlignItems, setAlignItems, setAlignSelf, setAlignSelf, setAnimation, setAnimationDelay, setAnimationDelay, setAnimationDelay, setAnimationDirection, setAnimationDirection, setAnimationDuration, setAnimationDuration, setAnimationDuration, setAnimationFillMode, setAnimationFillMode, setAnimationIterationCount, setAnimationIterationCount, setAnimationIterationCount, setAnimationName, setAnimationPlayState, setAnimationPlayState, setAnimationTimingFunction, setAnimationTimingFunction, setAnimationTimingFunction, setAnimationTimingFunction, setBackdropFilter, setBackdropFilter, setBackfaceVisibility, setBackfaceVisibility, setBackgroundAttachment, setBackgroundAttachment, setBackgroundBlendMode, setBackgroundBlendMode, setBackgroundColor, setBackgroundImage, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundPosition, setBackgroundRepeat, setBlur, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorder, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottom, setBorderBottomColor, setBorderBottomColor, setBorderBottomLeftRadius, setBorderBottomLeftRadius, setBorderBottomLeftRadius, setBorderBottomRightRadius, setBorderBottomRightRadius, setBorderBottomRightRadius, setBorderBottomStyle, setBorderBottomStyle, setBorderBottomWidth, setBorderBottomWidth, setBorderBottomWidth, setBorderBottomWidth, setBorderColor, setBorderColor, setBorderColor, setBorderColor, setBorderImage, setBorderImage, setBorderImageOutset, setBorderImageRepeat, setBorderImageSlice, setBorderImageSource, setBorderImageWidth, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeft, setBorderLeftColor, setBorderLeftColor, setBorderLeftStyle, setBorderLeftStyle, setBorderLeftWidth, setBorderLeftWidth, setBorderLeftWidth, setBorderLeftWidth, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRadius, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRight, setBorderRightColor, setBorderRightColor, setBorderRightStyle, setBorderRightStyle, setBorderRightWidth, setBorderRightWidth, setBorderRightWidth, setBorderRightWidth, setBorderStyle, setBorderStyle, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTop, setBorderTopColor, setBorderTopColor, setBorderTopLeftRadius, setBorderTopLeftRadius, setBorderTopLeftRadius, setBorderTopRightRadius, setBorderTopRightRadius, setBorderTopRightRadius, setBorderTopStyle, setBorderTopStyle, setBorderTopWidth, setBorderTopWidth, setBorderTopWidth, setBorderTopWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBorderWidth, setBottom, setBottom, setBottom, setBoxShadow, setBoxShadow, setBoxShadow, setBoxShadow, setBoxShadow, setBoxSizing, setBoxSizing, setBreakAfter, setBreakBefore, setBreakInside, setBrightness, setClass, setClear, setClear, setClip, setClipPath, setClipPath, setColGap, setColGap, setColor, setColor, setColumnCount, setColumnCount, setColumnFill, setColumnFill, setColumnGap, setColumnRule, setColumnRuleColor, setColumnRuleColor, setColumnRuleStyle, setColumnRuleStyle, setColumnRuleWidth, setColumnRuleWidth, setColumns, setColumns, setColumns, setColumnSpan, setColumnWidth, setColumnWidth, setColumnWidth, setContrast, setCounterIncrement, setCounterReset, setCursor, setCursor, setDirection, setDirection, setDisabledStyle, setDisplay, setDisplay, setFilter, setFilter, setFilterOpacity, setFlex, setFlexBasis, setFlexDirection, setFlexDirection, setFlexFlow, setFlexGrow, setFlexGrow, setFlexShrink, setFlexShrink, setFlexWrap, setFlexWrap, setFloat, setFloat, setFocusStyle, setFocusVisibleStyle, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFont, setFontFace, setFontFamily, setFontFamily, setFontFeatureSettings, setFontKerning, setFontLanguageOverride, setFontSize, setFontSize, setFontSize, setFontSizeAdjust, setFontStretch, setFontStretch, setFontStyle, setFontStyle, setFontSynthesis, setFontVariant, setFontVariant, setFontVariantAlternates, setFontVariantCaps, setFontVariantEastAsian, setFontVariantLigatures, setFontVariantNumeric, setFontVariantPosition, setFontWeight, setFontWeight, setGap, setGap, setGap, setGap, setGrayscale, setHangingPunctuation, setHangingPunctuation, setHeight, setHeight, setHeight, setHoverStyle, setHueRotate, setHyphens, setImageOrientation, setImageRendering, setImageResolution, setImeMode, setInvert, setJustifyContent, setJustifyContent, setKeyFrames, setLeft, setLeft, setLeft, setLetterSpacing, setLetterSpacing, setLetterSpacing, setLetterSpacing, setLineBreak, setLineHeight, setLineHeight, setLineHeight, setLineHeight, setMargin, setMargin, setMargin, setMargin, setMargin, setMarginBottom, setMarginBottom, setMarginBottom, setMarginLeft, setMarginLeft, setMarginLeft, setMarginRight, setMarginRight, setMarginRight, setMarginTop, setMarginTop, setMarginTop, setMark, setMarkAfter, setMarkBefore, setMarks, setMarqueeDirection, setMarqueePlayCount, setMarqueeSpeed, setMarqueeStyle, setMask, setMaskType, setMaxHeight, setMaxHeight, setMaxHeight, setMaxHeightToWindowHeight, setMaxWidth, setMaxWidth, setMaxWidth, setMaxWidthToWindowWidth, setMinHeight, setMinHeight, setMinHeight, setMinHeightToWindowHeight, setMinWidth, setMinWidth, setMinWidth, setMinWidthToWindowWidth, setNavDown, setNavIndex, setNavIndex, setNavLeft, setNavRight, setNavUp, setObjectFit, setObjectPosition, setOnClickNavigateBack, setOnClickNavigateBack, setOnClickNavigateBack, setOnClickNavigateForward, setOnClickNavigateForward, setOnClickNavigateForward, setOnClickNavigateTo, setOnDblClick, setOnDblClickChange, setOpacity, setOrder, setOrder, setOrphans, setOutline, setOutline, setOutline, setOutline, setOutlineColor, setOutlineColor, setOutlineOffset, setOutlineOffset, setOutlineOffset, setOutlineStyle, setOutlineStyle, setOutlineWidth, setOutlineWidth, setOutlineWidth, setOutlineWidth, setOverflow, setOverflow, setOverflow, setOverflowWrap, setOverflowX, setOverflowX, setOverflowY, setOverflowY, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPadding, setPaddingBottom, setPaddingBottom, setPaddingBottom, setPaddingLeft, setPaddingLeft, setPaddingLeft, setPaddingRight, setPaddingRight, setPaddingRight, setPaddingTop, setPaddingTop, setPaddingTop, setPageBreakAfter, setPageBreakAfter, setPageBreakBefore, setPageBreakBefore, setPageBreakInside, setPageBreakInside, setPerspective, setPerspective, setPerspective, setPerspectiveOrigin, setPerspectiveOrigin, setPerspectiveOrigin, setPerspectiveOrigin, setPhonemes, setPosition, setPosition, setPosition, setPosition, setPosition, setQuotes, setResize, setResize, setResizeToWindowHeight, setResizeToWindowHeight, setResizeToWindowWidth, setRest, setRestAfter, setRestBefore, setRight, setRight, setRight, setRotate, setRotate, setRowGap, setRowGap, setSaturate, setScale, setScale, setSepia, setShow, setSize, setSize, setSize, setSkewX, setSkewY, setStyle, setStyle, setTabSize, setTabSize, setTabSize, setTabSize, setTextAlign, setTextAlign, setTextAlignLast, setTextAlignLast, setTextCombineUpright, setTextCombineWeight, setTextDecoration, setTextDecoration, setTextDecorationColor, setTextDecorationColor, setTextDecorationLine, setTextDecorationLine, setTextDecorationStyle, setTextDecorationStyle, setTextIndent, setTextIndent, setTextIndent, setTextIndent, setTextJustify, setTextJustify, setTextOrientation, setTextOverflow, setTextOverflow, setTextSelectDisabled, setTextShadow, setTextShadow, setTextShadow, setTextShadow, setTextShadow, setTextTransform, setTextTransform, setTextUnderlinePosition, setTop, setTop, setTop, setTransform, setTransform, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformOrigin, setTransformStyle, setTransformStyle, setTransition, setTransitionDelay, setTransitionDelay, setTransitionDelay, setTransitionDuration, setTransitionDuration, setTransitionDuration, setTransitionProperty, setTransitionTimingFunction, setTransitionTimingFunction, setTransitionTimingFunction, setTransitionTimingFunction, setTranslateX, setTranslateY, setTranslateZ, setUnicodeBidi, setUnicodeBidi, setVerticalAlign, setVerticalAlign, setVisibility, setVisibility, setVoiceBalance, setVoiceDuration, setVoicePitch, setVoicePitchRange, setVoiceRate, setVoiceStress, setVoiceVolume, setWhiteSpace, setWhiteSpace, setWidows, setWidth, setWidth, setWidth, setWordBreak, setWordBreak, setWordSpacing, setWordSpacing, setWordSpacing, setWordSpacing, setWordWrap, setWordWrap, setWritingMode, setZIndex, setZIndex, show, shown, stopAnimation, transitionForward, transitionForward, transitionReverse, transitionReverse, updateStyle, updateStyle, updateStyleIfChangedMethods inherited from class com.oorian.html.VisualElement
clearOnClick, click, disable, enable, getAccessKey, getAutoCapitalize, getEnterKeyHint, getInputMode, getPopover, getRole, getTabIndex, getTitle, isAutoFocus, isContentEditable, isDisabled, isDraggable, isHidden, isInert, isSpellCheck, onDisabled, onEnabled, setAccessKey, setAriaAtomic, setAriaBusy, setAriaChecked, setAriaCheckedMixed, setAriaControls, setAriaCurrent, setAriaDescribedBy, setAriaDisabled, setAriaErrorMessage, setAriaExpanded, setAriaHasPopup, setAriaHasPopup, setAriaHidden, setAriaInvalid, setAriaLabel, setAriaLabelledBy, setAriaLevel, setAriaLive, setAriaModal, setAriaOwns, setAriaPressed, setAriaRequired, setAriaSelected, setAriaValueRange, setAriaValueText, setAutoCapitalize, setAutoFocus, setConsumeEvent, setContentEditable, setDisabled, setDraggable, setDropAllowed, setEnterKeyHint, setFocus, setHidden, setInert, setInputMode, setOnAnimationCancel, setOnAnimationEnd, setOnAnimationIteration, setOnAnimationStart, setOnAuxClick, setOnBeforeInput, setOnBeforeToggle, setOnBlur, setOnChange, setOnClick, setOnClickChange, setOnCompositionEnd, setOnCompositionStart, setOnCompositionUpdate, setOnContextMenu, setOnCopy, setOnCut, setOnDocumentResize, setOnFocus, setOnFocusIn, setOnFocusOut, setOnFormData, setOnGotPointerCapture, setOnInput, setOnInvalid, setOnKeyDown, setOnKeyPressed, setOnKeyUp, setOnLostPointerCapture, setOnMouseDown, setOnMouseEnter, setOnMouseLeave, setOnMouseMove, setOnMouseOut, setOnMouseOutChangeClass, setOnMouseOutChangeStyle, setOnMouseOutChangeStyle, setOnMouseOver, setOnMouseOverChangeClass, setOnMouseOverChangeStyle, setOnMouseOverChangeStyle, setOnMouseOverShow, setOnMouseUp, setOnPageLoad, setOnPaste, setOnPointerCancel, setOnPointerDown, setOnPointerEnter, setOnPointerLeave, setOnPointerMove, setOnPointerOut, setOnPointerOver, setOnPointerUp, setOnResize, setOnScroll, setOnScrollEnd, setOnSelect, setOnSelectionChange, setOnSelectStart, setOnToggle, setOnTouchCancel, setOnTouchEnd, setOnTouchMove, setOnTouchStart, setOnTransitionCancel, setOnTransitionEnd, setOnTransitionRun, setOnTransitionStart, setOnWheel, setOnWindowResize, setPopover, setRole, setRole, setSpellCheck, setTabIndex, setTitle, setTooltipMethods inherited from class com.oorian.html.Element
addAttribute, addAttribute, addAttribute, addAttribute, addLineBreak, addLineOfText, addLineOfText, addLineOfText, addParagraph, addParagraph, addSpacer, addText, addText, addText, addText, assignId, containsElement, containsElement, dispatchEvent, dispatchEvent, dispatchEvent, dispatchEvent, equals, excludeId, executeJs, executeJs, executeJs, getAccept, getAllElements, getAncestor, getAttribute, getAttributes, getComponent, getDir, getElement, getElementById, getElementCount, getElementCount, getElements, getElements, getElementsByComponentName, getElementsByTagName, getHtml, getId, getInnerHtml, getInnerHtml, getIs, getItemId, getItemProp, getItemRef, getItemType, getLang, getNextSibling, getPage, getParent, getPart, getPrevSibling, getSlot, getTagName, getTextContent, getUrl, hasAttribute, hasElements, isChildOf, isClosedTag, isCreated, isDescendantOf, isDescendantOf, isInitialized, isItemScope, isTranslate, onCallback, onCreated, onElementAdded, onElementRemoved, onHashChange, onHidden, onInitialized, onJsReturn, onPageLoaded, onPageUnloaded, onRefresh, onShown, onUpdated, onUserEvent, prewrite, recreate, refresh, refresh, registerAddition, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerListener, registerSubtraction, registerUpdate, removeAttribute, removeAttribute, removeFromParent, requestCallback, requestCallback, requestCallback, requestCallback, resetId, scrollTo, scrollToBottom, scrollToTop, self, sendCommand, sendUpdate, setAccept, setComponent, setDir, setDir, setId, setIs, setItemId, setItemProp, setItemRef, setItemScope, setItemType, setLang, setOnError, setOnLoad, setPage, setParent, setPart, setSlot, setTagName, setText, setText, setText, setText, setTranslate, toString, unregisterListener, update, updateAttributes
-
Constructor Details
-
GlassPane
public GlassPane()Creates a new GlassPane with no tint or opacity applied. -
GlassPane
Creates a new GlassPane with the specified opacity and tint color.- Parameters:
opacity- The opacity of the glass pane (0-100, where 0 is fully transparent).tint- The background tint color for the glass pane.
-
-
Method Details
-
create
protected final void create()Description copied from class:ElementHook method called during element creation.Override this method to configure the element after initialization. This is called after
Element.initialize()and only once during the element's lifecycle. -
addElement
Description copied from class:ElementAdds a child element to this element.The child is removed from its previous parent if it has one, then added to this element's children. If this element is already attached to a page, the child is also attached and registered for DOM addition.
- Overrides:
addElementin classElement<GlassPane>- Parameters:
child- The child element to add.- Returns:
- this element for method chaining
-
setElement
Description copied from class:ElementReplaces all child elements with a single child element.All existing children are removed before adding the new child.
- Overrides:
setElementin classElement<GlassPane>- Parameters:
child- The child element to set as the only child.- Returns:
- This element for method chaining.
-
insertElement
Description copied from class:ElementInserts a child element at the specified index.The child is removed from its previous parent if it has one, then inserted at the specified index in this element's children.
- Overrides:
insertElementin classElement<GlassPane>- Parameters:
index- The index at which to insert the child.child- The child element to insert.- Returns:
- this element for method chaining
-
removeAllElements
public final void removeAllElements()Description copied from class:ElementRemoves all child elements from this element.Each child is unlinked and registered for DOM removal if the element is attached to a page.
- Overrides:
removeAllElementsin classElement<GlassPane>
-
removeElement
Description copied from class:ElementRemoves a child element by its ID.- Overrides:
removeElementin classElement<GlassPane>- Parameters:
id- The ID of the child element to remove.
-
removeElement
Description copied from class:ElementRemoves a child element from this element.The child is unlinked from this parent and registered for DOM removal if the element is attached to a page.
- Overrides:
removeElementin classElement<GlassPane>- Parameters:
child- The child element to remove.
-
setOpacity
Sets the opacity of the glass pane layer.- Overrides:
setOpacityin classStyledElement<GlassPane>- Parameters:
opacity- The opacity value (0-100, where 0 is fully transparent).- Returns:
- The glass pane element.
-
setBackground
Sets the background color of the glass pane layer using a Color object.- Overrides:
setBackgroundin classStyledElement<GlassPane>- Parameters:
color- The background Color.- Returns:
- The glass pane element.
-
setBackground
Sets the background of the glass pane layer using a CSS color string.- Overrides:
setBackgroundin classStyledElement<GlassPane>- Parameters:
color- The CSS background value (e.g., "#000000", "rgba(0,0,0,0.5)").- Returns:
- The glass pane element.
-
setBackgroundColor
Sets the background color of the glass pane layer using a Color object.- Overrides:
setBackgroundColorin classStyledElement<GlassPane>- Parameters:
color- The background Color.- Returns:
- The glass pane element.
-
setBackgroundColor
Sets the background color of the glass pane layer using a CSS color string.- Overrides:
setBackgroundColorin classStyledElement<GlassPane>- Parameters:
color- The CSS color value (e.g., "#ffffff", "rgb(255,255,255)").- Returns:
- The glass pane element.
-
setBackgroundImage
Sets the background image of the glass pane layer.- Overrides:
setBackgroundImagein classStyledElement<GlassPane>- Parameters:
url- The URL of the background image.- Returns:
- The glass pane element.
-
setBackgroundPosition
Sets the background position of the glass pane layer.- Overrides:
setBackgroundPositionin classStyledElement<GlassPane>- Parameters:
pos- The CSS background position value (e.g., "center", "top left", "50% 50%").- Returns:
- The glass pane element.
-
setBackgroundRepeat
Sets the background repeat behavior of the glass pane layer.- Overrides:
setBackgroundRepeatin classStyledElement<GlassPane>- Parameters:
repeat- The CSS background repeat value (e.g., "no-repeat", "repeat-x", "repeat-y").- Returns:
- The glass pane element.
-
setBackgroundClip
Sets the background clip of the glass pane layer using a CSS string value.- Overrides:
setBackgroundClipin classStyledElement<GlassPane>- Parameters:
attrValue- The CSS background-clip value (e.g., "border-box", "padding-box", "content-box").- Returns:
- The glass pane element.
-
setBackgroundClip
Sets the background clip of the glass pane layer using a BackgroundClip constant.- Overrides:
setBackgroundClipin classStyledElement<GlassPane>- Parameters:
attrValue- The BackgroundClip constant.- Returns:
- The glass pane element.
-
setBackgroundOrigin
Sets the background origin of the glass pane layer using a CSS string value.- Overrides:
setBackgroundOriginin classStyledElement<GlassPane>- Parameters:
attrValue- The CSS background-origin value (e.g., "border-box", "padding-box", "content-box").- Returns:
- The glass pane element.
-
setBackgroundOrigin
Sets the background origin of the glass pane layer using a BackgroundOrigin constant.- Overrides:
setBackgroundOriginin classStyledElement<GlassPane>- Parameters:
attrValue- The BackgroundOrigin constant.- Returns:
- The glass pane element.
-
setBackgroundSize
Sets the background size of the glass pane layer using a CSS string value.- Overrides:
setBackgroundSizein classStyledElement<GlassPane>- Parameters:
attrValue- The CSS background-size value (e.g., "cover", "contain", "100px 200px").- Returns:
- The glass pane element.
-
setBackgroundSize
Sets the background size of the glass pane layer using a BackgroundSize constant.- Overrides:
setBackgroundSizein classStyledElement<GlassPane>- Parameters:
attrValue- The BackgroundSize constant.- Returns:
- The glass pane element.
-
setBackgroundSize
Sets the background size of the glass pane layer using CSS string width and height values.- Overrides:
setBackgroundSizein classStyledElement<GlassPane>- Parameters:
width- The CSS width value.height- The CSS height value.- Returns:
- The glass pane element.
-
setBackgroundSize
Sets the background size of the glass pane layer using pixel width and height values.- Overrides:
setBackgroundSizein classStyledElement<GlassPane>- Parameters:
width- The width in pixels.height- The height in pixels.- Returns:
- The glass pane element.
-
setBackgroundSize
Sets the background size of the glass pane layer using Units values for width and height.- Overrides:
setBackgroundSizein classStyledElement<GlassPane>- Parameters:
width- The width as a Units value.height- The height as a Units value.- Returns:
- The glass pane element.
-