Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static void dialog1() {
- g1 = new JDialog();
- g1.setUndecorated(true);
- g1.getContentPane().setBackground(Color.black);
- if(GV.ven==1) {
- g1.setSize(GV.pW, GV.pH);
- }
- else {
- g1.setSize(GV.dmw, GV.dmh);
- }
- g1.setVisible(true);
- g1.setLocationRelativeTo(null);
- inicio = new Inicio();
- g1.add(inicio);
- }
- public Inicio() {
- JLabel highscore, playscore;
- int phighscore = GV.highs;
- this.setLayout(null);
- this.setSize(GV.dim(Software.getAplicacion().getWidth(),Software.getAplicacion().getHeight()));
- int mH2 = GV.dmh/12-10,
- mW2 = GV.dmw/8-10;
- // PANEL SCORE
- p1 = new JPanel(new GridBagLayout());
- int p1w = mW2*2,
- p1h = (mH2*2-mH2/2);
- p1.setBounds(-20, 0, p1w, p1h);
- p1.setOpaque(false);
- JLabel scoret = new JLabel();
- scoret.setFont(Software.getArc().AFont(27, 0));
- scoret.setText("SCORE");
- scoret.setForeground(Color.red);
- playscore = new JLabel();
- playscore.setText("000000");
- playscore.setFont(scoret.getFont());
- playscore.setForeground(Color.white);
- GridBagConstraints gbcS = new GridBagConstraints();
- gbcS.gridx=0;
- gbcS.gridy=0;
- p1.add(scoret,gbcS);
- gbcS.gridx=0;
- gbcS.gridy=1;
- p1.add(playscore,gbcS);
- this.add(p1);
- // PANEL HIGHSCORE
- p2 = new JPanel(new GridBagLayout());
- p2.setBounds(p1.getHeight()+50, 0, mW2*2, mH2*2-mH2/2);
- p2.setOpaque(false);
- JLabel highscoret = new JLabel();
- highscoret.setFont(Software.getArc().AFont(27, 0));
- highscoret.setText("HIGHSCORE");
- highscoret.setForeground(Color.red);
- highscore = new JLabel();
- highscore.setText(Integer.toString(phighscore));
- highscore.setFont(highscoret.getFont());
- highscore.setForeground(Color.white);
- GridBagConstraints gbcHS = new GridBagConstraints();
- gbcHS.gridx=0;
- gbcHS.gridy=0;
- p2.add(highscoret,gbcHS);
- gbcHS.gridx=0;
- gbcHS.gridy=1;
- p2.add(highscore,gbcHS);
- this.add(p2);
- // PANEL INSERT COINS
- p3 = new JPanel(new GridBagLayout());
- p3.setBounds(Software.getAplicacion().getWidth()-mW2*3+15, 0, mW2*3-20, mH2*2-mH2/2);
- addImg(this,p3,"/images/coin.png",p3.getWidth(),p3.getHeight());
- p3.setOpaque(false);
- this.add(p3);
- // Panel Logo
- p4 = new JPanel();
- int altura=Software.getAplicacion().getHeight()/2-mH2*9/2+20-(altMod(Software.getAplicacion().getHeight()));
- p4.setBounds(Software.getAplicacion().getWidth()/2-mW2*2, altura, mW2*4, mH2*2);
- addImg(this,p4,"/images/arkanoid.png",p4.getWidth(),p4.getHeight());
- p4.setOpaque(false);
- this.add(p4);
- // Panel Menu de opciones
- p5 = new JPanel();
- p5.setBounds(Software.getAplicacion().getWidth()/2-mW2*3/2, Software.getAplicacion().getHeight()/2-mH2*3/2+5, mW2*3, mH2*5);
- b1 = new JButton("JUGAR");
- b2 = new JButton("PUNTAJES");
- b2.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent evt) {
- if(b2.isEnabled()) {
- Software.reComp(3);
- Software.adComp(4);
- }
- }
- });
- b3 = new JButton("OPCIONES");
- b3.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent evt) {
- if(b3.isEnabled()) {
- Software.reComp(3);
- Software.adComp(1);
- }
- }
- });
- b4 = new JButton("SALIR");
- b4.addMouseListener(new MouseAdapter() {
- public void mousePressed(MouseEvent evt) {
- if(b4.isEnabled()) {
- Software.salir();
- }
- }
- });
- addButt(p5,b1);
- addButt(p5,b2);
- addButt(p5,b3);
- addButt(p5,b4);
- p5.setOpaque(false);
- this.add(p5);
- // PANEL COPYRIGHT
- p6 = new JPanel();
- p6.setBounds(10, Software.getAplicacion().getHeight()-mH2*5/2-10, mW2*3, mH2*5/2);
- addImg(this,p6,"/images/TAITO.png",p6.getWidth(),p6.getHeight());
- p6.setOpaque(false);
- this.add(p6);
- // PANEL COINS
- p7 = new JPanel();
- p7.setBounds(Software.getAplicacion().getWidth()-mW2*2-5, Software.getAplicacion().getHeight()-mH2+5, mW2*2, mH2*2);
- coind = new JLabel();
- if(GV.coins<10) {
- coind.setText("COINS 0"+Integer.toString(GV.coins));
- } else {
- coind.setText("COINS "+Integer.toString(GV.coins));
- }
- coind.setFont(Software.getArc().AFont(36, 0));
- coind.setForeground(Color.white);
- p7.setOpaque(false);
- p7.add(coind);
- this.add(p7);
- this.setOpaque(false);
- this.setFocusable(true);
- this.requestFocus();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement