class org.aswing.resizer.ResizerController
ResizerController make manage resizer feature easily.
var button : JButton = new JButton("click"); button.setSize( 100,25 ); button.setLocation( 100, 100 );var label1 : JLabel = new JLabel("avoid resizing"); label1.setSize(100, 25); label1.setLocation( 200, 50 );
var label2 : JLabel = new JLabel("ok for resizing");
label2.setSize(100, 25); label2.setLocation( 50, 50 ); label2.setOpaque( true ); try { // Direct affectation var resizer : ResizerController = ResizerController.init( button ); // Simple call to #init method ResizerController.init( label1 ); ResizerController.init( label2 ); } catch( e : Error ) { // log error message } //We can retreive ResizerController for a specific component like : var labelResizer : ResizerController = ResizerController.getController( label1 ); labelResizer.setResizable( false ); resizer.setResizeDirectly( true ); // content must have a layout set to EmptyLayout to allow correct resizing content.append( button ); content.append( label1 ); content.append( label2 );
Many thanks Romain Ecarnot, this class is based on his ResizerController, and all resizer implement are inspired by him.
@author Romain Ecarnot @author palingClass Fields
static function create(comp:Component, ?resizer:Resizer = null): ResizerController
Create resizing behaviour to passed-in component.
comp | the component which need to be resizable |
resizer | (optional)the resizer, default there will be a default one instance created. |
static function setDefaultResizerClass(cl:Class<Dynamic>): Void
Sets the default resizer class.
cl | the default resizer class. |
Instance Fields
function new(comp:Component, ?resizer:Resizer = null): Void
Constructor.
comp | Component where applying resize behaviour. |
resizer | the resizer, default is null means to create a default one. |
function getResizer(): Resizer
Returns the resizer controller defined in {@link #setResizer}.
@see #setResizer
function isResizable(): Bool
Returns whether this component is resizable by the user.
By default, all components are initially resizable.
@see #setResizable()
function isResizeDirectly(): Bool
Return whether need resize widget directly when drag the resizer arrow.
@see #setResizeDirectly()
function setResizable(b:Bool): Void
Sets whether this component is resizable by the user.
@code true} user can resize the component by drag to scale the component, {@code false} user can't.
@see #isResizable()
b | { |
function setResizeDirectly(b:Bool): Void
Indicate whether need resize widget directly when drag the resizer arrow.
if set to {@code false}, there will be a rectange to represent then size what will be resized to.
if set to {@code true}, the widget will be resize directly when drag, but this
is need more cpu counting.
Default is {@coe false}.
@see org.aswing.Resizer#setResizeDirectly()
function setResizer(r:Resizer): Void
Sets the {@link Resizer} controller.
By default, use {@code Frame.resizer} one.
@link Resizer} instance
@see #getResizer
r | { |