本文整理汇总了Java中com.google.gwt.user.client.ui.TextArea.setReadOnly方法的典型用法代码示例。如果您正苦于以下问题:Java TextArea.setReadOnly方法的具体用法?Java TextArea.setReadOnly怎么用?Java TextArea.setReadOnly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gwt.user.client.ui.TextArea
的用法示例。
在下文中一共展示了TextArea.setReadOnly方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import com.google.gwt.user.client.ui.TextArea; //导入方法依赖的package包/类
protected void init(String msg, String title) {
this.setTitle("stdErr");
this.setGlassEnabled(true);
HTML closeButton = new HTML("X");
closeButton.setSize("10px", "10px");
closeButton.setStyleName("closebtn");
closeButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
StdPanel.this.hide();
}
});
ScrollPanel scvp = new ScrollPanel();
VerticalPanel verticalPanel = new VerticalPanel();
verticalPanel.add(closeButton);
verticalPanel.setCellHeight(closeButton, "30px");
verticalPanel.setStyleName("vpanel");
HTML desc = new HTML(title);
desc.setStyleName("popupTitle");
verticalPanel.add(desc);
verticalPanel.setCellHeight(desc, "30px");
TextArea label = new TextArea();
label.setText(msg);
label.setReadOnly(true);
label.setSize("650px", "400px");
verticalPanel.add(label);
scvp.add(verticalPanel);
this.add(scvp);
this.setStyleName("loading_container");
this.center();
this.show();
}
示例2: ConsoleDialog
import com.google.gwt.user.client.ui.TextArea; //导入方法依赖的package包/类
public ConsoleDialog(ConsoleDialogListener listener) {
super(false, true);
this.listener = listener;
VerticalPanel dialogContents = new VerticalPanel();
dialogContents.setSpacing(4);
setWidget(dialogContents);
console = new TextArea();
console.setReadOnly(true);
int width= Window.getClientWidth();
int height= Window.getClientHeight();
console.setSize(width*2/3 + "px", height*2/3 + "px");
console.addStyleName(Utils.sandboxStyle.consoleArea());
okButton = new Button("Ok");
addButton(okButton);
dialogContents.add(console);
okButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
hide();
if (ConsoleDialog.this.listener != null) {
ConsoleDialog.this.listener.onOk(rpcCallSucceded && consoleSessionSucceded);
}
}
});
okButton.setEnabled(false);
}
示例3: onModuleLoad
import com.google.gwt.user.client.ui.TextArea; //导入方法依赖的package包/类
/**
* This is the entry point method.
*/
@Override
public void onModuleLoad() {
final TextArea log = new TextArea();
RootPanel.get("log-div").add(log);
log.addStyleName("logBox");
log.setVisibleLines(10);
log.setReadOnly(true);
System.setOut(new TextAreaPrintStream(log));
System.setErr(System.out);
final Button runButton = new Button("Run!");
RootPanel.get("btn-div").add(runButton);
runButton.addStyleName("runButton");
runButton.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
log.setValue("");
String code = getSourceCode();
String className = Javac.getClassName(code);
boolean ok = Javac.compile(className + ".java", code);
if (ok) {
System.out.println("Compiled!");
printMagic(fs.readFile(fs.cwd() + className + ".class"));
System.out.println("Output:");
JVM.setClassLoader(new JibClassLoader());
JVM.run(className);
}
}
});
}
示例4: initTextArea
import com.google.gwt.user.client.ui.TextArea; //导入方法依赖的package包/类
/**
* Initialisation code for the TextAreas
*
* @param area text area to initialise
*/
private void initTextArea(TextArea area) {
area.setReadOnly(true);
area.setVisibleLines(40);
area.setCharacterWidth(80);
}
示例5: addFieldLabel
import com.google.gwt.user.client.ui.TextArea; //导入方法依赖的package包/类
/**
* Add a field name/field value label to the bodyGrid
* @param text the text to insert
* @param isName true if the text is the name of the field
* @partam isAlognNameTop true if we need to align the name to the top of the cell
* this parameter only works if isName == true
* @param isLongValue true if it is a long value, then is it
* inserted into TextArea.of width 16 characters
* @param listener the click listener for the hyperlink (user name)
* @return the created widget that is the name of value field
*/
private Widget addFieldLabel(final String text, final boolean isName,
final boolean isAlognNameTop,
final boolean isLongValue,
final ClickHandler listener) {
Widget element = null;
if( isName ){
bodyGrid.insertRow( row );
bodyGrid.insertCell( row, column );
Label lab = new Label( text + FIELD_NAME_VS_VALUE_DELIMITER );
lab.setWordWrap(false);
lab.setStyleName( CommonResourcesContainer.INFO_POPUP_FIELD_NAME_STYLE_NAME );
bodyGrid.setWidget( row, column, lab );
if( isAlognNameTop ) {
bodyGrid.getCellFormatter().setVerticalAlignment( row, column, HasVerticalAlignment.ALIGN_TOP);
}
column += 1;
//Assign the return value
element = lab;
} else {
//The long value is placed into a disabled textarea
if( isLongValue ){
//We will insert the long data on the new row, but place an empty cell for the old position
bodyGrid.insertCell( row, column );
bodyGrid.insertRow( ++row ); column = 0;
bodyGrid.insertCell( row, column++ );
bodyGrid.insertCell( row, column ); column = 0;
TextArea area = new TextArea();
//Set the line length in characters
area.setCharacterWidth( MAX_DESCRIPTION_AREA_WIDTH_SYMB );
area.setReadOnly( true );
final String roomDescText = StringUtils.formatTextWidth( MAX_DESCRIPTION_AREA_WIDTH_SYMB, text, true );
area.setText( roomDescText );
//Set the number of visible lines
area.setVisibleLines( StringUtils.countLines( roomDescText ) );
element = area;
bodyGrid.getFlexCellFormatter().setColSpan( row , column, 2);
} else {
bodyGrid.insertCell( row, column );
element = new Label( text );
}
bodyGrid.getCellFormatter().setHorizontalAlignment( row, column, HasHorizontalAlignment.ALIGN_RIGHT);
if( (listener != null) && ( element instanceof Label ) ){
Label label = (Label) element;
label.setWordWrap(false);
label.addClickHandler( listener );
label.setStyleName( CommonResourcesContainer.INFO_POPUP_VALUE_LINK_STYLE_NAME );
} else {
element.setStyleName( CommonResourcesContainer.INFO_POPUP_VALUE_STYLE_NAME );
}
bodyGrid.setWidget( row, column, element );
row +=1;
column = 0;
}
return element;
}
示例6: setReadOnly
import com.google.gwt.user.client.ui.TextArea; //导入方法依赖的package包/类
@Override
public void setReadOnly(boolean readOnly) {
super.setReadOnly(readOnly);
TextArea textArea = ((TextArea) this.field);
textArea.setReadOnly(readOnly);
}