CATEGORII DOCUMENTE |
Asp | Autocad | C | Dot net | Excel | Fox pro | Html | Java |
Linux | Mathcad | Photoshop | Php | Sql | Visual studio | Windows | Xml |
A TextArea is like a TextField except that it can have multiple lines and has significantly more functionality. In addition to what you can do with a TextField, you can append text and insert or replace text at a given location. It seems like this functionality could be useful for TextField as well, so it's a little confusing to try to detect how the distinction is made. You might think that if you want TextArea functionality everywhere you can simply use a one line TextArea in places where you would otherwise use a TextField. In Java 1.0, you also got scroll bars with a TextArea even when they weren't appropriate; that is, you got both vertical and horizontal scroll bars for a one line TextArea. In Java 1.1 this was remedied with an extra constructor that allows you to select which scroll bars (if any) are present. The following example shows only the Java 1.0 behavior, in which the scrollbars are always on. Later in the chapter you'll see an example that demonstrates Java 1.1 TextAreas.
//: TextArea1.java
// Using the text area control
import java.awt.*;
import java.applet.*;
public class TextArea1 extends Applet
public boolean action (Event evt, Object arg)
else if(evt.target.equals(b3))
else if(evt.target.equals(b4))
t2.insertText(' Inserted ', 10);
// Let the base class handle it:
else
return super.action(evt, arg);
return true; // We've handled it here
}
} ///:~
There are several different TextArea constructors, but the one shown here gives a starting string and the number of rows and columns. The different buttons show getting, appending, replacing, and inserting text.
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 566
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved