Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package titlescreenbeta;
- import java.awt.Dimension;
- import java.awt.Insets;
- import javax.swing.Box;
- import javax.swing.BoxLayout;
- import javax.swing.ButtonGroup;
- import javax.swing.ImageIcon;
- import javax.swing.JButton;
- import javax.swing.JFrame;
- import javax.swing.JLabel;
- import javax.swing.JPanel;
- import javax.swing.JRadioButton;
- import javax.swing.SwingUtilities;
- import javax.swing.UIManager;
- import javax.swing.border.EmptyBorder;
- public class TitleScreenBeta extends JFrame {
- public TitleScreenBeta() {
- initUI();
- }
- public final void initUI() {
- try {
- UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
- } catch (Exception e) {
- }
- JPanel panel = new JPanel();
- panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS));
- panel.setBorder(new EmptyBorder(new Insets(90, 155, 40, 60)));
- JButton NewGame = new JButton ("New Game!");
- JButton Highscore = new JButton("Highscore");
- JButton Credits = new JButton ("Credits");
- JButton Website = new JButton ("Website");
- JButton Exit = new JButton ("Exit");
- panel.add(NewGame);
- panel.add(Box.createRigidArea(new Dimension(0, 5)));
- panel.add(Highscore);
- panel.add(Box.createRigidArea(new Dimension(0, 5)));
- panel.add(Credits);
- panel.add(Box.createRigidArea(new Dimension(0, 5)));
- panel.add(Website);
- panel.add(Box.createRigidArea(new Dimension(0, 5)));
- panel.add(Exit);
- final ButtonGroup entreeGroup = new ButtonGroup();
- JRadioButton radioButton;
- panel.add(radioButton = new JRadioButton("Music1"));
- radioButton.setActionCommand("Music1");
- entreeGroup.add(radioButton);
- panel.add(radioButton = new JRadioButton("Music2"));
- radioButton.setActionCommand("Music2");
- entreeGroup.add(radioButton);
- panel.add(radioButton = new JRadioButton("No Music", true));
- radioButton.setActionCommand("No Music");
- entreeGroup.add(radioButton);
- add(panel);
- pack();
- setTitle("Title");
- JLabel background = new JLabel(new ImageIcon("background.png"));
- add(background);
- setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- setLocationRelativeTo(null);
- setResizable(false);
- setSize(400, 400);
- }
- public static void main(String[] args) {
- SwingUtilities.invokeLater(new Runnable() {
- public void run() {
- TitleScreenBeta ex = new TitleScreenBeta();
- ex.setVisible(true);
- }
- });
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement