Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package start;
- import java.awt.BorderLayout;
- import java.awt.Color;
- import java.awt.Dimension;
- import java.awt.Font;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JMenuBar;
- public class TopLevelDemo {
- private static void createAndShowGUI(){
- JFrame frame = new JFrame("TopLevel");
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- JMenuBar greenMenuBar = new JMenuBar();
- greenMenuBar.setOpaque(true);
- greenMenuBar.setBackground(new Color(154, 164, 127));
- greenMenuBar.setPreferredSize(new Dimension(200, 20));
- JLabel yellowLabel = new JLabel("Kademika");
- yellowLabel.setOpaque(true);
- yellowLabel.setFont(new Font("Serif", Font.ITALIC, 16));
- yellowLabel.setBackground(new Color(248, 213, 131));
- yellowLabel.setPreferredSize(new Dimension(200, 180));
- frame.setJMenuBar(greenMenuBar);
- frame.getContentPane().add(yellowLabel, BorderLayout.CENTER);
- frame.pack();
- frame.setVisible(true);
- }
- public static void main(String[] args) {
- javax.swing.SwingUtilities.invokeLater(new Runnable() {
- @Override
- public void run() {
- createAndShowGUI();
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement