Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gra2;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.FlowLayout;
- import java.awt.GridBagLayout;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JPanel;
- public class Menu2 extends JFrame {
- JButton zdj;
- JButton b1;
- JButton b2;
- JButton b3;
- JButton ah;
- Menu2(String nazwa) {
- super();
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setSize(1000, 1000);
- setResizable(false);
- setLayout(new GridBagLayout());
- setLayout(new BorderLayout());
- stworzLogo();
- stworzwybory();
- autorAH();
- setVisible(true);
- }
- public void stworzLogo() {
- JFrame menu = new JFrame();
- JPanel logo = new JPanel(new FlowLayout(FlowLayout.CENTER));
- zdj = new JButton();
- logo.add(zdj);
- menu.add(logo, BorderLayout.NORTH);
- logo.setBackground(Color.white);
- zdj.setOpaque(false);
- zdj.setBorderPainted(false);
- zdj.setContentAreaFilled(false);
- zdj.setBackground(Color.white);
- zdj.setFocusPainted(false);
- zdj.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\pg.png"));
- }
- public void stworzwybory() {
- JFrame menu = new JFrame();
- JPanel wybory = new JPanel(new GridBagLayout());
- b1 = new JButton();
- b2 = new JButton();
- b3 = new JButton();
- b1.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\6.jpg"));
- b1.setOpaque(false);
- b1.setBorderPainted(false);
- b1.setContentAreaFilled(false);
- b1.setBackground(Color.white);
- b1.setFocusPainted(false);
- b2.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\7.jpg"));
- b2.setOpaque(false);
- b2.setBorderPainted(false);
- b2.setContentAreaFilled(false);
- b2.setBackground(Color.white);
- b2.setFocusPainted(false);
- b3.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\8.jpg"));
- b3.setOpaque(false);
- b3.setBorderPainted(false);
- b3.setContentAreaFilled(false);
- b3.setBackground(Color.white);
- b3.setFocusPainted(false);
- wybory.setBackground(Color.white);
- wybory.add(b1);
- wybory.add(b2);
- wybory.add(b3);
- menu.add(wybory, BorderLayout.CENTER);
- }
- public void autorAH() {
- JFrame menu = new JFrame();
- JPanel autor = new JPanel(new FlowLayout(FlowLayout.RIGHT));
- ah = new JButton();
- ah.setOpaque(false);
- ah.setBorderPainted(false);
- ah.setContentAreaFilled(false);
- ah.setBackground(Color.white);
- ah.setFocusPainted(false);
- autor.setBackground(Color.white);
- ah.setIcon(new ImageIcon("C:\\Users\\AH\\Desktop\\GRA2\\Gra2\\images\\ah.jpg"));
- autor.add(ah);
- menu.add(autor, BorderLayout.SOUTH);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment