Guest User

Untitled

a guest
Dec 15th, 2019
114
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package gra2;
  2.  
  3. import java.awt.BorderLayout;
  4. import java.awt.Color;
  5. import java.awt.FlowLayout;
  6. import java.awt.GridBagLayout;
  7. import javax.swing.ImageIcon;
  8. import javax.swing.JButton;
  9. import javax.swing.JFrame;
  10. import javax.swing.JPanel;
  11.  
  12. public class Menu2 extends JFrame {
  13.  
  14.  
  15. JButton zdj;
  16. JButton b1;
  17. JButton b2;
  18. JButton b3;
  19. JButton ah;
  20.  
  21. Menu2(String nazwa) {
  22. super();
  23.  
  24. setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  25. setSize(1000, 1000);
  26. setResizable(false);
  27. setLayout(new GridBagLayout());
  28. setLayout(new BorderLayout());
  29. stworzLogo();
  30. stworzwybory();
  31. autorAH();
  32. setVisible(true);
  33.  
  34. }
  35.  
  36. public void stworzLogo() {
  37. JFrame menu = new JFrame();
  38. JPanel logo = new JPanel(new FlowLayout(FlowLayout.CENTER));
  39. zdj = new JButton();
  40. logo.add(zdj);
  41. menu.add(logo, BorderLayout.NORTH);
  42. logo.setBackground(Color.white);
  43. zdj.setOpaque(false);
  44. zdj.setBorderPainted(false);
  45. zdj.setContentAreaFilled(false);
  46. zdj.setBackground(Color.white);
  47. zdj.setFocusPainted(false);
  48. zdj.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\pg.png"));
  49.  
  50. }
  51.  
  52. public void stworzwybory() {
  53. JFrame menu = new JFrame();
  54. JPanel wybory = new JPanel(new GridBagLayout());
  55. b1 = new JButton();
  56. b2 = new JButton();
  57. b3 = new JButton();
  58. b1.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\6.jpg"));
  59. b1.setOpaque(false);
  60. b1.setBorderPainted(false);
  61. b1.setContentAreaFilled(false);
  62. b1.setBackground(Color.white);
  63. b1.setFocusPainted(false);
  64. b2.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\7.jpg"));
  65. b2.setOpaque(false);
  66. b2.setBorderPainted(false);
  67. b2.setContentAreaFilled(false);
  68. b2.setBackground(Color.white);
  69. b2.setFocusPainted(false);
  70. b3.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\8.jpg"));
  71. b3.setOpaque(false);
  72. b3.setBorderPainted(false);
  73. b3.setContentAreaFilled(false);
  74. b3.setBackground(Color.white);
  75. b3.setFocusPainted(false);
  76. wybory.setBackground(Color.white);
  77. wybory.add(b1);
  78. wybory.add(b2);
  79. wybory.add(b3);
  80. menu.add(wybory, BorderLayout.CENTER);
  81.  
  82. }
  83.  
  84. public void autorAH() {
  85. JFrame menu = new JFrame();
  86. JPanel autor = new JPanel(new FlowLayout(FlowLayout.RIGHT));
  87. ah = new JButton();
  88. ah.setOpaque(false);
  89. ah.setBorderPainted(false);
  90. ah.setContentAreaFilled(false);
  91. ah.setBackground(Color.white);
  92. ah.setFocusPainted(false);
  93. autor.setBackground(Color.white);
  94. ah.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\ah.jpg"));
  95. autor.add(ah);
  96. menu.add(autor, BorderLayout.SOUTH);
  97.  
  98. }
  99.  
  100. }
RAW Paste Data