Advertisement
Guest User

Untitled

a guest
May 24th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. import javax.swing.*;
  2. import java.awt.*;
  3.  
  4. public class GUI
  5. {
  6. private JFrame fenster = new JFrame();
  7.  
  8. public GUI() {
  9. fenster.setSize(600, 400);
  10. fenster.setLocation(400, 400);
  11. fenster.getContentPane().setBackground(Color.white);
  12. fenster.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  13. fenster.setVisible(true);
  14. fenster.setTitle("Paul ist dumm");
  15. }
  16.  
  17. public void setzeGröße(int a, int b){
  18. fenster.setSize(a,b);
  19. }
  20.  
  21. public void setBackground(Color color) {
  22. fenster.getContentPane().setBackground(color);
  23. }
  24.  
  25. /*public void setHexBackground(String hexValue) {
  26. Color color = new Color.decode(hexValue);
  27. fenster.getContentPane().setBackground(color);
  28. }*/
  29.  
  30. /*public void setStringBackground(String color) {
  31. Color color = new Color();
  32. switch (color) {
  33. case "black":
  34. color = Color.black;
  35. break;
  36. case "red":
  37. color = Color.red;
  38. break;
  39. case "green":
  40. color = Color.green;
  41. break;
  42. default:
  43. color = Color.white;
  44. break;
  45. }
  46. fenster.getContentPane().setBackground(color);
  47. }*/
  48.  
  49. //public void setzeBackground(char name){
  50. // if ("black".equals(name)) {
  51. // fenster.getContentPane().setBackground(Color.black);}
  52. // if ("white".equals(name)) {
  53. // fenster.getContentPane().setBackground(Color.white);}
  54. // if ("blue".equals(name)) {
  55. //fenster.getContentPane().setBackground(Color.blue);}
  56. //if ("red".equals(name)) {
  57. //fenster.getContentPane().setBackground(Color.red);}
  58. //}
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement