Skip to main content
Version: Deprecated Pages

system.gui.moveComponent

Deprecated

As of 7.8.1. See system.gui.transform() instead.

Description

Alters a component's position to a new pair of coordinates, (x,y), a point relative to the upper-left corner of the component's parent. Note that when using relative layout, these coordinates are evaluated as if the component's size was the same size as the last time the component was saved in the Designer. This effectively means that your argument coordinates will automatically scale with relative layout.

Syntax

system.gui.moveComponent(component, x, y)

  • Parameters

    • JComponent component - The component to move.
    • int x - The x-coordinate to move to, relative to the upper-left corner of the component's parent container.
    • int y - The y-coordinate to move to, relative to the upper-left corner of the component's parent container.
  • Returns

    • Nothing
  • Scope

    • Client

Code Examples

Code Snippet
#This code would go in a Timer's propertyChange script for animation.

if event.propertyName == "value":
newX = event.newValue;
rect = event.source.parent.getComponent("Rectangle")
system.gui.moveComponent(rect, newX, 250)