- 浏览: 784556 次
- 性别:
- 来自: 上海
文章分类
- 全部博客 (360)
- Java (101)
- JPA/Hibernate (10)
- Spring (14)
- Flex/BlazeDS (37)
- Database (30)
- Lucene/Solr/Nutch (0)
- Maven/Ant (25)
- CXF/WebService (3)
- RPC/RMI/SOAP/WSDL (1)
- REST (6)
- TDD/BDD/JUnit (1)
- Servlet/JSP (2)
- AI/MachineLearning (3)
- Resource (1)
- 字符编码 (2)
- OOA/OOPS/UML (5)
- DesignPattern (8)
- 算法与数据结构 (11)
- Web&App Server (13)
- 并发&异步&无阻塞 (7)
- Entertainment (4)
- JavaScript/ExtJS (45)
- CodeStyle&Quality (1)
- svn/git/perforce (8)
- JSON (2)
- JavaScriptTesting (4)
- Others (6)
- RegularExpression (2)
- Linux/Windows (12)
- Protocal (2)
- Celebrities (1)
- Interview (1)
- 计算机语言 (1)
- English (2)
- Eclipse (5)
- TimeZone/时区 (1)
- Finance (1)
- 信息安全 (1)
- JMS/MQ (2)
- XSD/XML/DTD (3)
- Android (4)
- 投资 (3)
- Distribution (3)
- Excel (1)
最新评论
-
qdujunjie:
如果把m换成具体的数字,比如4或者5,会让读者更明白
m阶B树中“阶”的含义 -
java-admin:
不错,加油,多写点文章
关于Extjs的mixins和plugin -
xiehuaidong880827:
你好,我用sencha cmd打包完本地工程后,把app.js ...
ExtJS使用Sencha Cmd合并javascript文件为一个文件 -
KIWIFLY:
lwpan 写道inverse = "true&qu ...
Hibernate中什么时候使用inverse=true -
luedipiaofeng:
good
消除IE stop running this script弹出框
AutoResizableTextArea类的定义:
注意事项,如果你是通过MXML的方式使用基本没有什么要注意的,如下方式使用:
但是如果是通过编程方式使用,那么就需要注意了,要保证设置宽度的代码位于加入容器的代码前面,即保证ta.width=500先于this.detailNavigatorContent.addElement(ta)被执行,
要保证设置Text或htmlText的代码位于添加到容器的代码的后面,即要保证this.detailNavigatorContent.addElement(ta)先于ta.htmlText=temp[size=medium][/size]被执行,这样AutoResizableTextArea才会正确工作。
<?xml version="1.0" encoding="utf-8"?> <mx:TextArea xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" wordWrap="true"> <fx:Declarations> <!-- Place non-visual elements (e.g., services, value objects) here --> </fx:Declarations> <fx:Script> <![CDATA[ // auto resize setting private var _autoResizable:Boolean = false; // getter [Bindable(event="changeAutoResize")] public function get autoResize():Boolean { return _autoResizable; } override public function drawFocus( isFocused:Boolean ):void { } // setter public function set autoResize(b:Boolean):void { _autoResizable = b; // if the text field component is created // and is auto resizable // we call the resize method if (this.mx_internal::getTextField() != null && _autoResizable == true) resizeTextArea(); // dispatch event to make the autoResize // property bindable dispatchEvent(new Event("changeAutoResize")); } // setter override override public function set text(value:String):void { // calling super method super.text = value; // if is auto resizable we call // the resize method if (_autoResizable) resizeTextArea(); } override public function set htmlText(value:String):void { super.htmlText = value; if (_autoResizable) resizeTextArea(); } // resize function for the text area private function resizeTextArea():void { // initial height value // if set to 0 scroll bars will // appear to the resized text area var totalHeight:uint = 10; // validating the object this.validateNow(); // find the total number of text lines // in the text area var noOfLines:int = this.mx_internal::getTextField().numLines; // iterating through all lines of // text in the text area for (var i:int = 0; i < noOfLines; i++) { // getting the height of one text line var textLineHeight:int = this.mx_internal::getTextField().getLineMetrics(i).height; // adding the height to the total height totalHeight += textLineHeight; } // setting the new calculated height this.height = totalHeight; } ]]> </fx:Script> </mx:TextArea>
注意事项,如果你是通过MXML的方式使用基本没有什么要注意的,如下方式使用:
<local:AutoResizableTextArea id="txtArea" autoResize="true" width="500"/>
但是如果是通过编程方式使用,那么就需要注意了,要保证设置宽度的代码位于加入容器的代码前面,即保证ta.width=500先于this.detailNavigatorContent.addElement(ta)被执行,
要保证设置Text或htmlText的代码位于添加到容器的代码的后面,即要保证this.detailNavigatorContent.addElement(ta)先于ta.htmlText=temp[size=medium][/size]被执行,这样AutoResizableTextArea才会正确工作。
var ta:AutoResizableTextArea=new AutoResizableTextArea(); ta.addEventListener(MouseEvent.MOUSE_WHEEL,mouseWheelChangeHandler); ta.editable=false; //ta.percentWidth=100; ta.width=500; ta.autoResize=true; this.detailNavigatorContent.addElement(ta); ta.htmlText=temp; ta.setStyle("borderStyle","none"); ta.setStyle("borderAlpha","0"); ta.verticalScrollPolicy=ContainerCreationPolicy.NONE; ta.addEventListener(FlexEvent.CREATION_COMPLETE,onTxtAreaCreationComplete);
发表评论
-
Panel高度为0但里面的组件依旧显示
2013-04-24 14:34 1082解决办法: 把Panel中的内容组件用<s:Scroll ... -
约束布局constraint layout
2013-03-01 14:02 1786约束布局constraint layout要点: 1)只有支持 ... -
根据屏幕分辨率动态调整组件大小
2013-02-22 17:34 1514将代码写在组件的preInitialize事件监听器里面 简化 ... -
设置Flex组件的尺寸大小
2013-02-21 16:17 1530深红色部分标明了需注意的地方 另外要注意组件和容器的生命周 ... -
Flex minWidth minHeight
2013-02-04 16:17 1516minWidth 这个值并不是给组件自己用的,而是给组件的父容 ... -
ActionScript遍历绑定(BindProperty,BindSetter,ChangeWatcher)
2013-02-01 10:11 2444注意: 为防止内存益处,记得调用watcherInstance ... -
Flex程序适应不同屏幕尺寸和分辨率(滚动条)
2013-01-31 15:02 9760FlashBuilder编译后自动生成的xx.html里面定义 ... -
FlexContext, FlexClient,FlexSession
2013-01-15 15:05 2368使用了BlazeDS后,可以从FlexContext中获取一系 ... -
防止RemoteObject批处理AMF消息
2013-01-14 17:01 1254问题描述: 如果你在短时内调用同一个java对象上的两个方法, ... -
自动检测http和https的RemoteObject
2013-01-13 10:30 1729package { import util.Bro ... -
flex浏览器相关辅组类
2012-12-06 13:39 1247package util { import flash. ... -
Flex可变参数带来的问题
2012-12-06 13:34 1486当你在flex的方法中用了可变参数后,你会发现这些参数传到ja ... -
flex如何通过类名称实例化对象
2012-11-30 13:52 2728Getting the class from an objec ... -
flexlib的treeGrid用法
2012-11-30 13:46 1263为了使用treeGrid,通常你需要定义自己的DataDesc ... -
自定义flex tree的DataDescriptor
2012-11-30 13:42 1399public class EnvironmentDataDes ... -
关于Boolean类型在flex与java中间传递的问题
2012-11-30 13:38 1251/** *为简化,只列举两个字段 */ publi ... -
给Flex的Tree赋值方式(XML和ArrayCollection)
2012-11-30 09:33 40181)方式一,mxml内嵌xml数据赋值方式,Embedded ... -
Custom Alert
2012-11-26 19:21 0<?xml version="1.0&qu ... -
Flex服务端分页
2012-11-14 17:00 1046Structure: model event ... -
Flex可携带数据的Aler组件(DataCarriableAlert)
2012-11-14 16:52 1308package component.alert { ...
相关推荐
flex 制作的文本框组件,能够根据加载的字符串长度,自动调整文本框大小。将源码导入Flash builder即可使用。
Textarea Autosize:根据内容的大小自动调整Textarea
基于jQuery的“autoresize”插件自动改变textarea大小!当textarea输入到最后一行,会自动添加一行的大小!也就是把textarea高度改变的增加一行的高度!
Textarea自动调整大小自动将textarea调整为其内容的大小。安装$ npm install @github/textarea-autosize用法必须在<textarea>上显式激活自动调整大小的行为。 import autosize from '@github/textarea-...
自已写了一个可根据内容 自动调整高度的TEXTAREA ,
自动伸缩的textarea,支持输入,支持复制,删除之后会还原,支持IE6.
根据文字的多少自动增高 能够自动伸缩 也可以 ←Backspace 减少字体的同时高度跟着减
NULL 博文链接:https://hanxin0311.iteye.com/blog/1886670
js 特效 html 特效 textarea是否自动换行
解决Flex在非主应用程序中,textarea和input不能输入中文的 方法。
无滚动条Textarea自动适用高度.html Textarea
textarea 自适应大小 兼容Chrome ie等浏览器,自动调整大小
textarea元素在chrome等浏览器下可以被拖拉从而改变大小,对于查看textarea里面的内容来说相当方便,但是有时候,我们为了保持网页的美观,不得不想要禁掉这个功能,禁止用户随意拉动textarea的大小
自动调整大小的textarea </title> <meta charset = “utf-8” /> <style type = “text/css”> .editable{cursor:text; font-size:13px; color:#003366;width:80px;line-height:20px;height:20px;...
根据输入自动调整 textarea 高度 ##在线演示 ##用法 // Enable: $ ( < textarea selector > ).autosize(); // Disable: $( < textarea selector > ).autosize(false); // Handle autosize ...
Textarea-自动调整大小自动调整文本区域的大小步骤1: 在页面底部包含 textarea-autoresize.min.js 第2步: 给要自动调整大小的 textarea(s) 类“textarea-auto-resize” 第 3 步: 利润
用java swing的JTextArea很容易实现自动换行,但用Textarea却很难实现换行,所以发到网上供大家参考,大家一起学习学习!!!
textarea 随内容高度固定,自动增宽;宽度固定,自动增高; 以及 wrap 的几种属性简介。
css textarea textarea 样式