Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.*;
- import java.awt.event.*;
- import javax.swing.*;
- import javax.swing.event.*;
- public class MyPanel extends JPanel {
- private JComboBox skillJedna;
- private JComboBox skillDva;
- private JComboBox skillTri;
- private JComboBox skillCtyri;
- private JComboBox skillPet;
- private JComboBox skillSest;
- private JComboBox skillSedm;
- private JComboBox skillOsm;
- private JComboBox skillDevet;
- private JComboBox skillDeset;
- private JComboBox skillJedenact;
- private JComboBox skillDvanact;
- private JComboBox skillTrinact;
- private JComboBox skillCtrnact;
- private JTextField nameText;
- private JComboBox role;
- private JTextField secondName;
- private JTextField gameNick;
- private JTextField dbUsername;
- private JLabel dbPassText;
- private JTextField dbPass;
- private JLabel user;
- private JTextField dbURL;
- private JLabel urlDb;
- private JTextField dbName;
- private JLabel urlDbText;
- private JLabel userName;
- private JLabel secondNameText;
- private JLabel gameNickText;
- private JButton jcomp30;
- private JButton jcomp31;
- private JButton clearButton;
- private JButton jcomp33;
- public MyPanel() {
- //construct preComponents
- String[] skillJednaItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillDvaItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillTriItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillCtyriItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillPetItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillSestItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillSedmItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillOsmItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillDevetItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillDesetItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillJedenactItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillDvanactItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillTrinactItems = {"Item 1", "Item 2", "Item 3"};
- String[] skillCtrnactItems = {"Item 1", "Item 2", "Item 3"};
- String[] roleItems = {"Item 1", "Item 2", "Item 3"};
- //construct components
- skillJedna = new JComboBox (skillJednaItems);
- skillDva = new JComboBox (skillDvaItems);
- skillTri = new JComboBox (skillTriItems);
- skillCtyri = new JComboBox (skillCtyriItems);
- skillPet = new JComboBox (skillPetItems);
- skillSest = new JComboBox (skillSestItems);
- skillSedm = new JComboBox (skillSedmItems);
- skillOsm = new JComboBox (skillOsmItems);
- skillDevet = new JComboBox (skillDevetItems);
- skillDeset = new JComboBox (skillDesetItems);
- skillJedenact = new JComboBox (skillJedenactItems);
- skillDvanact = new JComboBox (skillDvanactItems);
- skillTrinact = new JComboBox (skillTrinactItems);
- skillCtrnact = new JComboBox (skillCtrnactItems);
- nameText = new JTextField (4);
- role = new JComboBox (roleItems);
- secondName = new JTextField (5);
- gameNick = new JTextField (5);
- dbUsername = new JTextField (5);
- dbPassText = new JLabel ("Heslo od Databaze");
- dbPass = new JTextField (5);
- user = new JLabel ("Přihlašovací jméno ");
- dbURL = new JTextField (5);
- urlDb = new JLabel ("URL databáze");
- dbName = new JTextField (5);
- urlDbText = new JLabel ("Název Databáze");
- userName = new JLabel ("Jméno hráče");
- secondNameText = new JLabel ("Příijmení");
- gameNickText = new JLabel ("Herní jméno");
- jcomp30 = new JButton ("Uložit do DB");
- jcomp31 = new JButton ("Ulozit do XML");
- clearButton = new JButton ("Vycistit");
- jcomp33 = new JButton ("Uložit do PDF");
- //adjust size and set layout
- setPreferredSize (new Dimension (667, 367));
- setLayout (null);
- //add components
- add (skillJedna);
- add (skillDva);
- add (skillTri);
- add (skillCtyri);
- add (skillPet);
- add (skillSest);
- add (skillSedm);
- add (skillOsm);
- add (skillDevet);
- add (skillDeset);
- add (skillJedenact);
- add (skillDvanact);
- add (skillTrinact);
- add (skillCtrnact);
- add (nameText);
- add (role);
- add (secondName);
- add (gameNick);
- add (dbUsername);
- add (dbPassText);
- add (dbPass);
- add (user);
- add (dbURL);
- add (urlDb);
- add (dbName);
- add (urlDbText);
- add (userName);
- add (secondNameText);
- add (gameNickText);
- add (jcomp30);
- add (jcomp31);
- add (clearButton);
- add (jcomp33);
- //set component bounds (only needed by Absolute Positioning)
- skillJedna.setBounds (5, 10, 220, 20);
- skillDva.setBounds (5, 35, 220, 20);
- skillTri.setBounds (5, 60, 220, 20);
- skillCtyri.setBounds (5, 85, 220, 20);
- skillPet.setBounds (5, 110, 220, 20);
- skillSest.setBounds (5, 135, 220, 20);
- skillSedm.setBounds (5, 160, 220, 20);
- skillOsm.setBounds (5, 185, 220, 20);
- skillDevet.setBounds (5, 210, 220, 20);
- skillDeset.setBounds (5, 235, 220, 20);
- skillJedenact.setBounds (5, 260, 220, 20);
- skillDvanact.setBounds (5, 285, 220, 20);
- skillTrinact.setBounds (5, 310, 220, 20);
- skillCtrnact.setBounds (5, 335, 220, 20);
- nameText.setBounds (390, 15, 245, 25);
- role.setBounds (390, 125, 245, 25);
- secondName.setBounds (390, 55, 245, 25);
- gameNick.setBounds (390, 95, 245, 25);
- dbUsername.setBounds (395, 300, 235, 25);
- dbPassText.setBounds (395, 320, 110, 20);
- dbPass.setBounds (395, 340, 235, 25);
- user.setBounds (395, 280, 165, 25);
- dbURL.setBounds (395, 260, 235, 25);
- urlDb.setBounds (395, 240, 235, 25);
- dbName.setBounds (395, 220, 235, 25);
- urlDbText.setBounds (395, 200, 235, 25);
- userName.setBounds (390, 0, 245, 15);
- secondNameText.setBounds (390, 35, 245, 20);
- gameNickText.setBounds (390, 75, 240, 25);
- jcomp30.setBounds (255, 330, 115, 25);
- jcomp31.setBounds (255, 300, 115, 25);
- clearButton.setBounds (255, 15, 115, 25);
- jcomp33.setBounds (255, 270, 115, 25);
- }
- public static void main (String[] args) {
- JFrame frame = new JFrame ("MyPanel");
- frame.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE);
- frame.getContentPane().add (new MyPanel());
- frame.pack();
- frame.setVisible (true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement