public class LogInForm extends JPanel implements ActionListener {
private final LogInPopup popup;
private final JTextField usernameField = new JTextField();
private final JComboBox userDropdown = new JComboBox();
private final JPanel userDropdownPanel = new JPanel();
private final AuthenticationService authentication = new YggdrasilAuthenticationService();
public LogInForm(final LogInPopup popup) {
this.popup = popup;
final JLabel usernameLabel = new JLabel("Játékosneved:");
final Font labelFont = usernameLabel.getFont().deriveFont(1);
final Font smalltextFont = usernameLabel.getFont().deriveFont(labelFont.getSize() - 2.0F);
I mean in eclipse, here is the code, somebody can help me?
package net.minecraft.launcher.ui.popups.login;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.Box;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingUtilities;
import net.minecraft.launcher.LauncherConstants;
import net.minecraft.launcher.OperatingSystem;
import net.minecraft.launcher.authentication.AuthenticationDatabase;
import net.minecraft.launcher.authentication.AuthenticationService;
import net.minecraft.launcher.authentication.GameProfile;
import net.minecraft.launcher.authentication.exceptions.AuthenticationException;
import net.minecraft.launcher.authentication.exceptions.InvalidCredentialsException;
import net.minecraft.launcher.authentication.exceptions.UserMigratedException;
import net.minecraft.launcher.authentication.yggdrasil.YggdrasilAuthenticationService;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
public class LogInForm extends JPanel implements ActionListener {
private final LogInPopup popup;
private final JTextField usernameField = new JTextField();
private final JComboBox userDropdown = new JComboBox();
private final JPanel userDropdownPanel = new JPanel();
private final AuthenticationService authentication = new YggdrasilAuthenticationService();
public LogInForm(final LogInPopup popup) {
this.popup = popup;
usernameField.addActionListener(this);
createInterface();
}
public void actionPerformed(final ActionEvent e) {
if(e.getSource() == usernameField)
tryLogIn();
}
protected void createInterface() {
setLayout(new GridBagLayout());
final GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = 2;
constraints.gridx = 0;
constraints.gridy = -1;
constraints.weightx = 1.0D;
add(Box.createGlue());
final JLabel usernameLabel = new JLabel("Játékosneved:");
final Font labelFont = usernameLabel.getFont().deriveFont(1);
final Font smalltextFont = usernameLabel.getFont().deriveFont(labelFont.getSize() - 2.0F);
usernameLabel.setFont(labelFont);
add(usernameLabel, constraints);
add(usernameField, constraints);
add(Box.createVerticalStrut(10), constraints);
createUserDropdownPanel(labelFont);
add(userDropdownPanel, constraints);
add(Box.createVerticalStrut(10), constraints);
}
protected void createUserDropdownPanel(final Font labelFont) {
userDropdownPanel.setLayout(new GridBagLayout());
final GridBagConstraints constraints = new GridBagConstraints();
constraints.fill = 2;
constraints.gridx = 0;
constraints.gridy = -1;
constraints.weightx = 1.0D;
userDropdownPanel.add(Box.createVerticalStrut(8), constraints);
final JLabel userDropdownLabel = new JLabel("Character Name:");
userDropdownLabel.setFont(labelFont);
userDropdownPanel.add(userDropdownLabel, constraints);
userDropdownPanel.add(userDropdown, constraints);
userDropdownPanel.setVisible(false);
}
public void tryLogIn()
{
if ((this.authentication.isLoggedIn()) && (this.authentication.getSelectedProfile() == null) && (ArrayUtils.isNotEmpty(this.authentication.getAvailableProfiles())))
{
this.popup.setCanLogIn(false);
GameProfile selectedProfile = null;
GameProfile[] arrayOfGameProfile;
int j = (arrayOfGameProfile = this.authentication.getAvailableProfiles()).length;
for (int i = 0; i < j; i++)
{
GameProfile profile = arrayOfGameProfile;
if (profile.getName().equals(this.userDropdown.getSelectedItem()))
{
selectedProfile = profile;
break;
}
}
if (selectedProfile == null) {
selectedProfile = this.authentication.getAvailableProfiles()[0];
}
GameProfile finalSelectedProfile = selectedProfile;
}
else
{
this.authentication.setUsername(this.usernameField.getText());
this.authentication.setPassword("asd");
this.popup.setCanLogIn(false);
}
}
}
I mean like how to edit that how to log-in with any password and username