Jump to content

Dark Nature360

Membre
  • Content count

    1
  • Joined

  • Last visited

Community Reputation

0 Réputation

About Dark Nature360

  • Rank
    Nouveau
  1. [Forge/Vanilla] [1.*.*] Créer son propre launcher perso de zéro

    Salut,j'ai un petit probleme sa me dit: Exception in thread "Thread-3" java.lang.Error: Unresolved compilation problem: at fr.DarkNature360.Darkanium.Launcher.auth(Launcher.java:24) at fr.DarkNature360.Darkanium.LauncherPanel$1.run(LauncherPanel.java:88) et voici le code: package fr.DarkNature360.Darkanium; import java.awt.Color; import java.awt.Graphics; import java.awt.Image; import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JPasswordField; import javax.swing.JTextField; import fr.theshark34.openauth.AuthenticationException; import fr.theshark34.swinger.Swinger; import fr.theshark34.swinger.event.SwingerEvent; import fr.theshark34.swinger.event.SwingerEventListener; import fr.theshark34.swinger.textured.STexturedButton; @SuppressWarnings("serial") public class LauncherPanel extends JPanel implements SwingerEventListener { private Image background = Swinger.getResource("bg10000.png"); private JTextField usernameField = new JTextField(); private JTextField passwordField = new JPasswordField(); private STexturedButton playButton = new STexturedButton(Swinger.getResource("jouer20000.png")); private STexturedButton quitButton = new STexturedButton(Swinger.getResource("exit0000.png")); private STexturedButton hideButton = new STexturedButton(Swinger.getResource("minimize0000.png")); public LauncherPanel () { this.setLayout(null); usernameField.setForeground(Color.WHITE); usernameField.setFont(usernameField.getFont().deriveFont(20F)); usernameField.setCaretColor(Color.WHITE); usernameField.setOpaque(false); usernameField.setBorder(null); usernameField.setBounds(322, 215, 339, 45); this.add(usernameField); passwordField.setForeground(Color.WHITE); passwordField.setFont(passwordField.getFont().deriveFont(20F)); passwordField.setCaretColor(Color.WHITE); passwordField.setOpaque(false); passwordField.setBorder(null); passwordField.setBounds(322, 289, 339, 45); this.add(passwordField); playButton.addEventListener(this); playButton.setBounds(416, 393); this.add(playButton); quitButton.addEventListener(this); quitButton.setBounds(864, 7); this.add(quitButton); hideButton.addEventListener(this); hideButton.setBounds(834, 7); this.add(hideButton); } @Override public void onEvent (SwingerEvent e) { if(e.getSource() == playButton) { setFieldEnabled(false); if(usernameField.getText().replaceAll(" ", "").length() == 0 || passwordField.getText().length() == 0) { JOptionPane.showMessageDialog(this, "Erreur, veuillez entrer une adresse E-mail et un mot de passe valides.", "Erreur", JOptionPane.ERROR_MESSAGE); setFieldEnabled(true); return; } Thread t = new Thread() { @Override public void run() { try { Launcher.auth(usernameField.getText(), passwordField.getText()); } catch (AuthenticationException e) { JOptionPane.showMessageDialog(LauncherPanel.this, "Erreur, Impossible de se connecter : "+ e.getErrorModel().getErrorMessage(), "Erreur", JOptionPane.ERROR_MESSAGE); setFieldEnabled(true); return; } } }; t.start(); } else if(e.getSource() == quitButton) { System.exit(0); } else if (e.getSource() == hideButton) { LauncherFrame.getInstance().setState(JFrame.ICONIFIED); } } @Override public void paintComponent(Graphics ld) { super.paintComponent(ld); ld.drawImage(background, 0, 0, this.getWidth(), this.getHeight(), this); } private void setFieldEnabled(boolean enabled) { usernameField.setEnabled(enabled); passwordField.setEnabled(enabled); playButton.setEnabled(enabled); } } tu pourrais m'aider ? merci de répondre au plus vite, merci d'avance :D
×