how to make black borders around my applet??
and if i have TextField 4 example "Name" and a visitor is forbidden to put there more than 10 letters, how to do that?
Is implementation of KeyListener essential?
To draw the black box, couldn't you just obtain the height and width of the applet and then draw a black box from 0,0 to those coordinates (maybe offset by 1, I'm not sure)?
it works, i have another question.
A hava a field AGE (Wiek) and the visitor shouldn't have a possibility to input more than 3 numbers, i did it , it works, but the fourth number alway appears for a while.
Could u take a look at it? I wrote a special class for my TextField :
class FieldAge extends TextField implements KeyListener {
boolean Sluchaj(){
addKeyListener(this);
return true;
}
public void keyReleased(KeyEvent evt)
{
String Rob = new String();
int ile;
try
{
Rob=this.getText();
}
catch (Exception e) {
}
ile=Rob.length();
if (ile>3){
this.setText(Rob.substring(0,3));
this.setCaretPosition(3);
return ;
}
char znak = evt.getKeyChar();
int kod = evt.getKeyCode();
String nazwa = evt.getKeyText(kod);
}
public void keyPressed(KeyEvent evt)
{
return;
}
public void keyTyped(KeyEvent evt)
{
return;
/*char znak = evt.getKeyChar();
int kod = evt.getKeyCode();
String nazwa = evt.getKeyText(kod);*/
}
FieldAge(){
it works, i have another question.
A hava a field AGE (Wiek) and the visitor shouldn't have a possibility to input more than 3 numbers, i did it , it works, but the fourth number alway appears for a while.
Could u take a look at it? I wrote a special class for my TextField :
class FieldAge extends TextField implements KeyListener {
boolean Sluchaj(){
addKeyListener(this);
return true;
}
public void keyReleased(KeyEvent evt)
{
String Rob = new String();
int ile;
try
{
Rob=this.getText();
}
catch (Exception e) {
}
ile=Rob.length();
if (ile>3){
this.setText(Rob.substring(0,3));
this.setCaretPosition(3);
return ;
}
char znak = evt.getKeyChar();
int kod = evt.getKeyCode();
String nazwa = evt.getKeyText(kod);
}
public void keyPressed(KeyEvent evt)
{
return;
}
public void keyTyped(KeyEvent evt)
{
return;
/*char znak = evt.getKeyChar();
int kod = evt.getKeyCode();
String nazwa = evt.getKeyText(kod);*/
}
FieldAge(){
Bookmarks