Advertisement
Guest User

Untitled

a guest
Aug 24th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.93 KB | None | 0 0
  1. public LauncherPanel()
  2. {
  3. setLayout(null);
  4. TransparentButton site = new TransparentButton();
  5. TransparentButton forum = new TransparentButton();
  6. TransparentButton discord = new TransparentButton();
  7. JButton ram = new JButton();
  8. if (!this.accountSaver.getEncryptedAccounts().isEmpty())
  9. {
  10. Account a = ((EncryptedAccount)this.accountSaver.getEncryptedAccounts().get(0)).getAccount();
  11. this.pass.setText(a.getPassword());
  12. this.username.setText(a.getEmail());
  13. this.infos.setText("Bonjour " + a.getUsername() + " !");
  14. }
  15. if (!new File(Launcher.PW_DIR.getAbsoluteFile() + File.separator + "Launcher" + File.separator + ".notdelete").exists()) {
  16. new File(Launcher.PW_DIR.getAbsoluteFile() + File.separator + "Launcher" + File.separator + ".notdelete").mkdir();
  17. }
  18. if (this.saver.get("ram") == null) {
  19. this.saver.set("ram", String.valueOf(4294967296L));
  20. }
  21. if (Long.parseLong(this.saver.get("ram")) < 1073741824L) {
  22. this.saver.set("ram", String.valueOf(4294967296L));
  23. }
  24. try
  25. {
  26. Long.parseLong(this.saver.get("ram"));
  27. }
  28. catch (NumberFormatException e)
  29. {
  30. createOption("RAM incorrecte, rectification... Fait", "Erreur", 2);
  31. this.saver.set("ram", String.valueOf(4294967296L));
  32. }
  33. this.username.setBounds(302, 228, 247, 17);
  34. this.username.setBorder(null);
  35. this.username.setOpaque(false);
  36. this.username.setFont(getFont().deriveFont(15.0F));
  37.  
  38. this.pass.setBounds(302, 264, 247, 17);
  39. this.pass.setBorder(null);
  40. this.pass.setOpaque(false);
  41. this.pass.setFont(this.username.getFont());
  42.  
  43. site.setBounds(648, 188, 160, 36);
  44. forum.setBounds(648, 239, 160, 34);
  45. discord.setBounds(648, 290, 160, 36);
  46.  
  47. this.play.setBounds(347, 287, 160, 32);
  48.  
  49. this.infos.setBounds(259, 312, 365, 45);
  50. this.infos.setFont(this.infos.getFont().deriveFont(15.0F));
  51. this.infos.setForeground(Color.BLACK);
  52. this.infos.setHorizontalAlignment(0);
  53. this.infos.setVerticalAlignment(0);
  54.  
  55. this.progress.setBorder(null);
  56. this.progress.setBounds(22, 354, 801, 14);
  57.  
  58. this.saveAccount.setBounds(530, 290, 100, 20);
  59. this.saveAccount.setFont(this.username.getFont().deriveFont(11.0F));
  60. this.saveAccount.setOpaque(false);
  61.  
  62. this.saveAccount.setSelected(Boolean.valueOf(this.saver.get("save")).booleanValue());
  63. this.saveAccount.setToolTipText("Attention ! Le mot de passe sera hache, mais pas de bonne qualite ! Reflechissez avant de le faire !");
  64.  
  65. this.accountsChoice.setBounds(513, 200, 105, 17);
  66. for (EncryptedAccount e : this.accountSaver.getEncryptedAccounts()) {
  67. this.accountsChoice.addItem(e);
  68. }
  69. this.accountsChoice.addItemListener(new ItemListener()
  70. {
  71. public void itemStateChanged(ItemEvent e)
  72. {
  73. if (e.getStateChange() == 1)
  74. {
  75. Account a = ((EncryptedAccount)e.getItem()).getAccount();
  76. LauncherPanel.this.pass.setText(a.getPassword());
  77. LauncherPanel.this.username.setText(a.getEmail());
  78. LauncherPanel.this.infos.setText("Bonjour " + a.getUsername() + " !");
  79. }
  80. }
  81. });
  82. ram.setIcon(new ImageIcon(Swinger.getResource("ram.jpg")));
  83. ram.setBounds(0, 0, 51, 51);
  84.  
  85. add(this.username);
  86. add(this.pass);
  87. add(site);
  88. add(forum);
  89. add(discord);
  90. add(this.play);
  91. add(this.infos);
  92. add(this.progress);
  93. add(this.saveAccount);
  94. add(this.accountsChoice);
  95. add(ram);
  96.  
  97. site.addActionListener(new ActionListener()
  98. {
  99. public void actionPerformed(ActionEvent e)
  100. {
  101. LauncherPanel.this.openURL("http://portal-world-roguelike.livehost.fr/");
  102. }
  103. });
  104. forum.addActionListener(new ActionListener()
  105. {
  106. public void actionPerformed(ActionEvent e)
  107. {
  108. LauncherPanel.this.openURL("http://portal-world-mmorpg.livehost.fr/forum/index.php");
  109. }
  110. });
  111. discord.addActionListener(new ActionListener()
  112. {
  113. public void actionPerformed(ActionEvent e)
  114. {
  115. LauncherPanel.this.openURL("https://discord.gg/k7z2YHq");
  116. }
  117. });
  118. this.play.addActionListener(new ActionListener()
  119. {
  120. public void actionPerformed(ActionEvent e)
  121. {
  122. LauncherPanel.this.onPlay(LauncherPanel.this.username.getText(), String.valueOf(LauncherPanel.this.pass.getPassword()));
  123. }
  124. });
  125. ram.addActionListener(new ActionListener()
  126. {
  127. public void actionPerformed(ActionEvent e)
  128. {
  129. String res = (String)JOptionPane.showInputDialog(LauncherPanel.this, "Maximum de RAM pouvant �tre utilis�e :", "RAM", 3, null, RamSelector.RAM_ARRAY, RamSelector.RAM_ARRAY[3]);
  130. if (res != null)
  131. {
  132. res = res.replaceAll("Go", "");
  133. LauncherPanel.this.saver.set("ram", String.valueOf(Long.parseLong(res) * 1073741824L));
  134. }
  135. }
  136. });
  137. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement