J++ AWT Button setSize() funktioniert nicht

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • J++ AWT Button setSize() funktioniert nicht

    Hi

    also ich habe folgendes, das folgende Programm habe ich programmiert und da da wollte ich fragen, welche möglichkeiten es gibt, den Button kleiner zu machen!
    bitte um Rat! und Codehilfe! danke!

    Hier der Code:

    Quellcode

    1. import java.awt.*;
    2. import java.awt.event.*;
    3. public class clsMain extends Frame implements ActionListener {
    4. public class WindowHandler extends WindowAdapter {
    5. public void windowClosing(WindowEvent we) {
    6. System.exit(0);
    7. }
    8. }
    9. WindowHandler WH = new WindowHandler();
    10. TextField tfPasswort = new TextField();
    11. TextArea taEingabe = new TextArea();
    12. Panel pnSouth = new Panel();
    13. Button btOk = new Button("OK");
    14. Label lbInfo = new Label();
    15. int intEingabe;
    16. String strPasswort = new String();
    17. clsMain() {
    18. this.setSize(400, 400);
    19. this.addWindowListener(WH);
    20. this.add("North", tfPasswort);
    21. this.add("Center", taEingabe);
    22. this.add("South", pnSouth);
    23. pnSouth.setLayout(new GridLayout(1, 2));
    24. pnSouth.add(btOk);
    25. pnSouth.add(lbInfo);
    26. tfPasswort.setEchoChar('*');
    27. taEingabe.setEditable(false);
    28. taEingabe.setBackground(Color.blue);
    29. btOk.addActionListener(this);
    30. intEingabe = 0;
    31. strPasswort = "Passwort";
    32. }
    33. public void actionPerformed(ActionEvent ae) {
    34. if (ae.getActionCommand().toString() == "OK") {
    35. if (tfPasswort.getText().equals(strPasswort)) {
    36. taEingabe.setEditable(true);
    37. taEingabe.setBackground(Color.white);
    38. btOk.setVisible(false);
    39. lbInfo.setVisible(false);
    40. taEingabe.requestFocus();
    41. } else {
    42. intEingabe++;
    43. lbInfo.setText("Falsches Kennwort");
    44. tfPasswort.requestFocus();
    45. tfPasswort.setSelectionStart(0);
    46. tfPasswort.setSelectionEnd(tfPasswort.getText().length());
    47. if (intEingabe == 3) {
    48. System.exit(0);
    49. }
    50. }
    51. }
    52. }
    53. public static void main(String[] args) {
    54. new clsMain().show();
    55. }
    56. }
    Alles anzeigen