Informatik/Java/Grafische Oberfläche/GUI/Eingabe Button
Checkbox
Radio
Choice
List
Scrollbar
TextField
TextArea

Button

import java.applet.*;
import java.awt.*;
public class AButton extends Applet {
  Button b1 = new Button("A");
  Button b2;
  public void init() {
    add(b1);
    b2 = new Button("B");
    add(b2);
    add(new Button("C"));
  }
}
      
	  

[Image]

Checkbox

import java.applet.*;
import java.awt.*;
public class ACheckbox extends Applet {
  Checkbox cb1 = new Checkbox("Wahl 1");
  Checkbox cb2;
  public void init() {
    add(cb1);
    cb2 = new Checkbox("Wahl 2");
    add(cb2);
    add(new Checkbox("Wahl 3"));
  }
}
      
	  

[Image]

Radio

import java.applet.*;
import java.awt.*;
public class ARadio extends Applet {
  CheckboxGroup cbg = new CheckboxGroup();
  Checkbox cb1 = new Checkbox("A",cbg,false);
  Checkbox cb2;
  public void init() {
    add(cb1);
    cb2 = new Checkbox("B",cbg,true);
    add(cb2);
    add(new Checkbox("C",cbg,false));
  }
}
      
	  

[Image]

Choice

java.applet.*;
import java.awt.*;
public class AChoice extends Applet {
  Choice c = new Choice();
  public void init() {
    c.addItem("A");
    c.addItem("B");
    c.addItem("C");
    add(c);
  }
}
      
	  

[Image]

List

import java.applet.*;
import java.awt.*;
public class AList extends Applet {
  List l = new List(4,true);
  public void init() {
    l.add("A");
    l.add("B");
    l.add("C");
    l.add("D");
    l.add("E");
    add(l);
  } }

[Image]

Scrollbar

import java.applet.*;
import java.awt.*;
public class AScrollbar extends Applet {
  Scrollbar s1 = new Scrollbar(
  Scrollbar.HORIZONTAL,50,10,0,110);
  Scrollbar s2;
  public void init() {
    add(s1);
    s2 = new Scrollbar(Scrollbar.VERTICAL,50,10,0,110);
    add(s2);
  }
}
      
		

[Image]

TextField

import java.applet.*;
import java.awt.*;
public class ATextField extends Applet {
  TextField t1 = new TextField(20);
  TextField t2;
  public void init() {
    add(t1);
    t1.setEditable(false);
    t1.setText("Ausgabe im Textfeld");
    t2 = new TextField(15);
    t2.setEditable(true);
    t2.setText("Eingabe");
    add(t2);
  }
}
      
		

[Image]

TextArea

import java.applet.*;
import java.awt.*;
  public class ATextArea extends Applet {
    TextArea t1 = new TextArea(
                        "Ausgabe in TextArea",1,20,
                        TextArea.SCROLLBARS_NONE);
    TextArea t2 = new TextArea(
                        "",3,10,TextArea.SCROLLBARS_VERTICAL_ONLY);
  public void init()  {
    add(t1);
    t1.setEditable(false);
    t2.setEditable(true);
    t2.setText("Eingabe");
    add(t2);
  }
}
      
	  

[Image]