本文整理匯總了Java中com.google.gwt.user.client.ui.TextArea.setVisibleLines方法的典型用法代碼示例。如果您正苦於以下問題:Java TextArea.setVisibleLines方法的具體用法?Java TextArea.setVisibleLines怎麽用?Java TextArea.setVisibleLines使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.google.gwt.user.client.ui.TextArea
的用法示例。
在下文中一共展示了TextArea.setVisibleLines方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: showDebugMsgBox
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
public static void showDebugMsgBox(final String msg) {
if (_debugMsgBoxPopup == null) {
_debugMsgBox = new TextArea();
ScrollPanel wrapper = new ScrollPanel(_debugMsgBox);
wrapper.setSize("300px", "200px");
_debugMsgBoxPopup = new PopupPane("Debug", wrapper, false, false);
_debugMsgBox.setCharacterWidth(2000);
_debugMsgBox.setVisibleLines(10);
}
_debugMsgBox.setText(_debugMsgBox.getText() + "\n" + msg);
if (!_debugMsgBoxPopup.isVisible()) _debugMsgBoxPopup.show();
_debugMsgBox.getElement().setScrollTop(_debugMsgBox.getElement().getScrollHeight());
}
示例2: onModuleLoad
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
public void onModuleLoad() {
// create the widgets
final Button analyseButton = new Button(messages.sendButton());
final Button configureButton = new Button(messages.configureButton());
final TextArea mainTextArea = new TextArea();
mainTextArea.setCharacterWidth(80);
mainTextArea.setVisibleLines(15);
final Label errorLabel = new Label();
final CellTable<SnomedConcept> resultsTable = new CellTable<>();
// add them to the root panel
RootPanel.get("mainTextArea").add(mainTextArea);
RootPanel.get("analyseButton").add(analyseButton);
RootPanel.get("configureButton").add(configureButton);
RootPanel.get("status").add(errorLabel);
RootPanel.get("snomedCodes").add(resultsTable);
// set the focus to the text area
mainTextArea.setFocus(true);
// initialise the SNOMED code results table
final List<SnomedConcept> conceptList = configSnomedTable(resultsTable);
// add the handlers
final List<SemanticType> types = new ArrayList<>();
final Map<String, String> typeCodeToDescription = new HashMap<>();
analyseButton.addClickHandler(
new AnalyseHandler(mainTextArea, errorLabel, conceptList, types, typeCodeToDescription));
configureButton.addClickHandler(new ConfigureHandler(types, typeCodeToDescription));
}
示例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: TextAreaExample
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
public TextAreaExample() {
super("Text Area");
TextArea text = new TextArea();
text.setCharacterWidth(30);
text.setVisibleLines(5);
add(text);
RichTextArea rich = new RichTextArea();
rich.setHTML("Rich <i>text</i> <b>area</b>");
add(rich);
}
示例5: 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);
}
示例6: 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;
}
示例7: onInitialize
import com.google.gwt.user.client.ui.TextArea; //導入方法依賴的package包/類
/**
* Initialize this example.
*/
@ShowcaseSource
@Override
public Widget onInitialize() {
// Create a panel to layout the widgets
VerticalPanel vpanel = new VerticalPanel();
vpanel.setSpacing(5);
// Add a normal and disabled text box
TextBox normalText = new TextBox();
normalText.ensureDebugId("cwBasicText-textbox");
// Set the normal text box to automatically adjust its direction according
// to the input text. Use the Any-RTL heuristic, which sets an RTL direction
// iff the text contains at least one RTL character.
normalText.setDirectionEstimator(AnyRtlDirectionEstimator.get());
TextBox disabledText = new TextBox();
disabledText.ensureDebugId("cwBasicText-textbox-disabled");
disabledText.setText(constants.cwBasicTextReadOnly());
disabledText.setEnabled(false);
vpanel.add(new HTML(constants.cwBasicTextNormalLabel()));
vpanel.add(createTextExample(normalText, true));
vpanel.add(createTextExample(disabledText, false));
// Add a normal and disabled password text box
PasswordTextBox normalPassword = new PasswordTextBox();
normalPassword.ensureDebugId("cwBasicText-password");
PasswordTextBox disabledPassword = new PasswordTextBox();
disabledPassword.ensureDebugId("cwBasicText-password-disabled");
disabledPassword.setText(constants.cwBasicTextReadOnly());
disabledPassword.setEnabled(false);
vpanel.add(new HTML("<br><br>" + constants.cwBasicTextPasswordLabel()));
vpanel.add(createTextExample(normalPassword, true));
vpanel.add(createTextExample(disabledPassword, false));
// Add a text area
TextArea textArea = new TextArea();
textArea.ensureDebugId("cwBasicText-textarea");
textArea.setVisibleLines(5);
vpanel.add(new HTML("<br><br>" + constants.cwBasicTextAreaLabel()));
vpanel.add(createTextExample(textArea, true));
// Return the panel
return vpanel;
}