Advertisement
Guest User

Untitled

a guest
Jun 17th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. private static void dialog1() {
  2. g1 = new JDialog();
  3. g1.setUndecorated(true);
  4. g1.getContentPane().setBackground(Color.black);
  5. if(GV.ven==1) {
  6. g1.setSize(GV.pW, GV.pH);
  7. }
  8. else {
  9. g1.setSize(GV.dmw, GV.dmh);
  10. }
  11. g1.setVisible(true);
  12. g1.setLocationRelativeTo(null);
  13. inicio = new Inicio();
  14. g1.add(inicio);
  15. }
  16.  
  17. public Inicio() {
  18. JLabel highscore, playscore;
  19. int phighscore = GV.highs;
  20. this.setLayout(null);
  21. this.setSize(GV.dim(Software.getAplicacion().getWidth(),Software.getAplicacion().getHeight()));
  22. int mH2 = GV.dmh/12-10,
  23. mW2 = GV.dmw/8-10;
  24.  
  25. // PANEL SCORE
  26. p1 = new JPanel(new GridBagLayout());
  27. int p1w = mW2*2,
  28. p1h = (mH2*2-mH2/2);
  29. p1.setBounds(-20, 0, p1w, p1h);
  30. p1.setOpaque(false);
  31. JLabel scoret = new JLabel();
  32. scoret.setFont(Software.getArc().AFont(27, 0));
  33. scoret.setText("SCORE");
  34. scoret.setForeground(Color.red);
  35. playscore = new JLabel();
  36. playscore.setText("000000");
  37. playscore.setFont(scoret.getFont());
  38. playscore.setForeground(Color.white);
  39. GridBagConstraints gbcS = new GridBagConstraints();
  40. gbcS.gridx=0;
  41. gbcS.gridy=0;
  42. p1.add(scoret,gbcS);
  43. gbcS.gridx=0;
  44. gbcS.gridy=1;
  45. p1.add(playscore,gbcS);
  46. this.add(p1);
  47.  
  48. // PANEL HIGHSCORE
  49. p2 = new JPanel(new GridBagLayout());
  50. p2.setBounds(p1.getHeight()+50, 0, mW2*2, mH2*2-mH2/2);
  51. p2.setOpaque(false);
  52. JLabel highscoret = new JLabel();
  53. highscoret.setFont(Software.getArc().AFont(27, 0));
  54. highscoret.setText("HIGHSCORE");
  55. highscoret.setForeground(Color.red);
  56. highscore = new JLabel();
  57. highscore.setText(Integer.toString(phighscore));
  58. highscore.setFont(highscoret.getFont());
  59. highscore.setForeground(Color.white);
  60. GridBagConstraints gbcHS = new GridBagConstraints();
  61. gbcHS.gridx=0;
  62. gbcHS.gridy=0;
  63. p2.add(highscoret,gbcHS);
  64. gbcHS.gridx=0;
  65. gbcHS.gridy=1;
  66. p2.add(highscore,gbcHS);
  67. this.add(p2);
  68.  
  69. // PANEL INSERT COINS
  70. p3 = new JPanel(new GridBagLayout());
  71. p3.setBounds(Software.getAplicacion().getWidth()-mW2*3+15, 0, mW2*3-20, mH2*2-mH2/2);
  72. addImg(this,p3,"/images/coin.png",p3.getWidth(),p3.getHeight());
  73. p3.setOpaque(false);
  74. this.add(p3);
  75.  
  76. // Panel Logo
  77. p4 = new JPanel();
  78. int altura=Software.getAplicacion().getHeight()/2-mH2*9/2+20-(altMod(Software.getAplicacion().getHeight()));
  79. p4.setBounds(Software.getAplicacion().getWidth()/2-mW2*2, altura, mW2*4, mH2*2);
  80. addImg(this,p4,"/images/arkanoid.png",p4.getWidth(),p4.getHeight());
  81. p4.setOpaque(false);
  82. this.add(p4);
  83.  
  84. // Panel Menu de opciones
  85. p5 = new JPanel();
  86. p5.setBounds(Software.getAplicacion().getWidth()/2-mW2*3/2, Software.getAplicacion().getHeight()/2-mH2*3/2+5, mW2*3, mH2*5);
  87. b1 = new JButton("JUGAR");
  88. b2 = new JButton("PUNTAJES");
  89. b2.addMouseListener(new MouseAdapter() {
  90. public void mousePressed(MouseEvent evt) {
  91. if(b2.isEnabled()) {
  92. Software.reComp(3);
  93. Software.adComp(4);
  94. }
  95. }
  96. });
  97. b3 = new JButton("OPCIONES");
  98. b3.addMouseListener(new MouseAdapter() {
  99. public void mousePressed(MouseEvent evt) {
  100. if(b3.isEnabled()) {
  101. Software.reComp(3);
  102. Software.adComp(1);
  103. }
  104. }
  105. });
  106. b4 = new JButton("SALIR");
  107. b4.addMouseListener(new MouseAdapter() {
  108. public void mousePressed(MouseEvent evt) {
  109. if(b4.isEnabled()) {
  110. Software.salir();
  111. }
  112. }
  113. });
  114. addButt(p5,b1);
  115. addButt(p5,b2);
  116. addButt(p5,b3);
  117. addButt(p5,b4);
  118. p5.setOpaque(false);
  119. this.add(p5);
  120.  
  121. // PANEL COPYRIGHT
  122. p6 = new JPanel();
  123. p6.setBounds(10, Software.getAplicacion().getHeight()-mH2*5/2-10, mW2*3, mH2*5/2);
  124. addImg(this,p6,"/images/TAITO.png",p6.getWidth(),p6.getHeight());
  125. p6.setOpaque(false);
  126. this.add(p6);
  127.  
  128. // PANEL COINS
  129. p7 = new JPanel();
  130. p7.setBounds(Software.getAplicacion().getWidth()-mW2*2-5, Software.getAplicacion().getHeight()-mH2+5, mW2*2, mH2*2);
  131. coind = new JLabel();
  132. if(GV.coins<10) {
  133. coind.setText("COINS 0"+Integer.toString(GV.coins));
  134. } else {
  135. coind.setText("COINS "+Integer.toString(GV.coins));
  136. }
  137. coind.setFont(Software.getArc().AFont(36, 0));
  138. coind.setForeground(Color.white);
  139. p7.setOpaque(false);
  140. p7.add(coind);
  141. this.add(p7);
  142.  
  143. this.setOpaque(false);
  144. this.setFocusable(true);
  145. this.requestFocus();
  146. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement