Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- *
- * @author Gostkowski Jakub S12660
- *
- */
- package zad1;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Font;
- import javax.swing.BorderFactory;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- public class Main {
- public static void main(String[] args) {
- JFrame k = new JFrame();
- JLabel k1 = new JLabel("Góra");
- JLabel k2 = new JLabel("Dolna");
- JLabel k3 = new JLabel("Lewa");
- JLabel k4 = new JLabel("Prawa");
- JLabel k5 = new JLabel("Srodek");
- k1.setBackground(Color.BLACK);
- k1.setForeground(Color.BLUE);
- k1.setFont(new Font(Font.MONOSPACED,Font.BOLD,10));
- k1.setToolTipText("pierwsza");
- k1.setBorder(BorderFactory.createLineBorder(Color.PINK));
- k1.add(k1,BorderLayout.WEST);
- k2.setBackground(Color.WHITE);
- k2.setForeground(Color.PINK);
- k2.setFont(new Font(Font.MONOSPACED,Font.BOLD,12));
- k2.setToolTipText("druga");
- k2.setBorder(BorderFactory.createMatteBorder(5, 10, 5, 15, Color.BLUE));
- k2.add(k2,BorderLayout.NORTH);
- k3.setBackground(Color.BLUE);
- k3.setForeground(Color.WHITE);
- k3.setFont(new Font(Font.MONOSPACED,Font.BOLD,14));
- k3.setToolTipText("trzecia");
- k3.setBorder(BorderFactory.createEtchedBorder(Color.RED, Color.GREEN));
- k3.add(k3,BorderLayout.EAST);
- k4.setBackground(Color.WHITE);
- k4.setForeground(Color.BLACK);
- k4.setFont(new Font(Font.MONOSPACED,Font.BOLD,16));
- k4.setToolTipText("czwarta");
- k4.setBorder(BorderFactory.createTitledBorder("Tytuł"));
- k4.add(k4,BorderLayout.SOUTH);
- k5.setBackground(Color.YELLOW);
- k5.setForeground(Color.GREEN);
- k5.setFont(new Font(Font.MONOSPACED,Font.BOLD,18));
- k5.setToolTipText("piata");
- k5.setBorder(BorderFactory.createEmptyBorder());
- k5.add(k5,BorderLayout.CENTER);
- k.pack();
- k.setVisible(true);
- k.setLocationRelativeTo(null);
- k.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement