From: Astrid S. <ast...@us...> - 2007-09-30 07:57:35
|
Update of /cvsroot/arianne/stendhal/src/games/stendhal/client/gui In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv31404/src/games/stendhal/client/gui Modified Files: CreditsDialog.java CreateAccountDialog.java OutfitDialog.java Log Message: code format Index: OutfitDialog.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/gui/OutfitDialog.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** OutfitDialog.java 30 Sep 2007 07:52:49 -0000 1.59 --- OutfitDialog.java 30 Sep 2007 07:57:32 -0000 1.60 *************** *** 516,520 **** /** this is called everytime the user moves the slider */ ! private void jsliderDirectionStateChanged(ChangeEvent evt) {// GEN-FIRST:event_jsliderDirectionStateChanged direction = jsliderDirection.getValue(); --- 516,520 ---- /** this is called everytime the user moves the slider */ ! private void jsliderDirectionStateChanged(ChangeEvent evt) { // GEN-FIRST:event_jsliderDirectionStateChanged direction = jsliderDirection.getValue(); *************** *** 524,537 **** redrawBase(bodies_index, jlblBodies.getGraphics()); redrawDress(clothes_index, jlblClothes.getGraphics()); ! }// GEN-LAST:event_jsliderDirectionStateChanged /** when user closes this window */ ! private void formWindowClosing(WindowEvent evt) {// GEN-FIRST:event_formWindowClosing timer.cancel(); this.dispose(); ! }// GEN-LAST:event_formWindowClosing /** Clothes Right button */ ! private void jbtRightClothesActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtRightClothesActionPerformed if (clothes_index < clothes.length - 1) { clothes_index++; --- 524,537 ---- redrawBase(bodies_index, jlblBodies.getGraphics()); redrawDress(clothes_index, jlblClothes.getGraphics()); ! } // GEN-LAST:event_jsliderDirectionStateChanged /** when user closes this window */ ! private void formWindowClosing(WindowEvent evt) { // GEN-FIRST:event_formWindowClosing timer.cancel(); this.dispose(); ! } // GEN-LAST:event_formWindowClosing /** Clothes Right button */ ! private void jbtRightClothesActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtRightClothesActionPerformed if (clothes_index < clothes.length - 1) { clothes_index++; *************** *** 542,549 **** redrawDress(clothes_index, jlblClothes.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtRightClothesActionPerformed /** Clothes Left button */ ! private void jbtLeftClothesActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtLeftClothesActionPerformed if (clothes_index > 0) { clothes_index--; --- 542,549 ---- redrawDress(clothes_index, jlblClothes.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtRightClothesActionPerformed /** Clothes Left button */ ! private void jbtLeftClothesActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtLeftClothesActionPerformed if (clothes_index > 0) { clothes_index--; *************** *** 554,561 **** redrawDress(clothes_index, jlblClothes.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtLeftClothesActionPerformed /** Bodies Right button */ ! private void jbtRightBodiesActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtRightBodiesActionPerformed if (bodies_index < bodies.length - 1) { bodies_index++; --- 554,561 ---- redrawDress(clothes_index, jlblClothes.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtLeftClothesActionPerformed /** Bodies Right button */ ! private void jbtRightBodiesActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtRightBodiesActionPerformed if (bodies_index < bodies.length - 1) { bodies_index++; *************** *** 566,573 **** redrawBase(bodies_index, jlblBodies.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtRightBodiesActionPerformed /** Bodies Left button */ ! private void jbtLeftBodiesActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtLeftBodiesActionPerformed if (bodies_index > 0) { bodies_index--; --- 566,573 ---- redrawBase(bodies_index, jlblBodies.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtRightBodiesActionPerformed /** Bodies Left button */ ! private void jbtLeftBodiesActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtLeftBodiesActionPerformed if (bodies_index > 0) { bodies_index--; *************** *** 578,585 **** redrawBase(bodies_index, jlblBodies.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtLeftBodiesActionPerformed /** Heads Right button */ ! private void jbtRightHeadsActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtRightHeadsActionPerformed if (heads_index < heads.length - 1) { heads_index++; --- 578,585 ---- redrawBase(bodies_index, jlblBodies.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtLeftBodiesActionPerformed /** Heads Right button */ ! private void jbtRightHeadsActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtRightHeadsActionPerformed if (heads_index < heads.length - 1) { heads_index++; *************** *** 590,597 **** redrawHead(heads_index, jlblHeads.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtRightHeadsActionPerformed /** Heads Left button */ ! private void jbtLeftHeadsActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtLeftHeadsActionPerformed if (heads_index > 0) { heads_index--; --- 590,597 ---- redrawHead(heads_index, jlblHeads.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtRightHeadsActionPerformed /** Heads Left button */ ! private void jbtLeftHeadsActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtLeftHeadsActionPerformed if (heads_index > 0) { heads_index--; *************** *** 602,609 **** redrawHead(heads_index, jlblHeads.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtLeftHeadsActionPerformed /** Hairs Right button */ ! private void jbtRightHairsActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtRightHairsActionPerformed if (hairs_index < hairs.length - 1) { hairs_index++; --- 602,609 ---- redrawHead(heads_index, jlblHeads.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtLeftHeadsActionPerformed /** Hairs Right button */ ! private void jbtRightHairsActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtRightHairsActionPerformed if (hairs_index < hairs.length - 1) { hairs_index++; *************** *** 614,621 **** redrawHair(hairs_index, jlblHairs.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtRightHairsActionPerformed /** Hairs Left button */ ! private void jbtLeftHairsActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtLeftHairsActionPerformed if (hairs_index > 0) { hairs_index--; --- 614,621 ---- redrawHair(hairs_index, jlblHairs.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtRightHairsActionPerformed /** Hairs Left button */ ! private void jbtLeftHairsActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtLeftHairsActionPerformed if (hairs_index > 0) { hairs_index--; *************** *** 626,638 **** redrawHair(hairs_index, jlblHairs.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! }// GEN-LAST:event_jbtLeftHairsActionPerformed /** Button OK action */ ! private void jbtOKActionPerformed(ActionEvent evt) {// GEN-FIRST:event_jbtOKActionPerformed sendAction(); timer.cancel(); this.dispose(); ! }// GEN-LAST:event_jbtOKActionPerformed private void sendAction() { --- 626,638 ---- redrawHair(hairs_index, jlblHairs.getGraphics()); redrawFinalPlayer(jlblFinalResult.getGraphics()); ! } // GEN-LAST:event_jbtLeftHairsActionPerformed /** Button OK action */ ! private void jbtOKActionPerformed(ActionEvent evt) { // GEN-FIRST:event_jbtOKActionPerformed sendAction(); timer.cancel(); this.dispose(); ! } // GEN-LAST:event_jbtOKActionPerformed private void sendAction() { Index: CreateAccountDialog.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/gui/CreateAccountDialog.java,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** CreateAccountDialog.java 11 Aug 2007 20:08:00 -0000 1.25 --- CreateAccountDialog.java 30 Sep 2007 07:57:32 -0000 1.26 *************** *** 54,59 **** private static final long serialVersionUID = 4436228792112530975L; - private static final Logger logger = Log4J.getLogger(CreateAccountDialog.class); // Variables declaration --- 54,59 ---- private static final long serialVersionUID = 4436228792112530975L; + private static final Logger logger = Log4J.getLogger(CreateAccountDialog.class); // Variables declaration *************** *** 110,117 **** private void initializeComponent() { serverLabel = new JLabel("Server name"); ! serverField = new JTextField(ClientGameConfiguration.get("DEFAULT_SERVER")); serverField.setEditable(true); serverPortLabel = new JLabel("Server port"); ! serverPortField = new JTextField(ClientGameConfiguration.get("DEFAULT_PORT")); usernameLabel = new JLabel("Choose a username"); --- 110,119 ---- private void initializeComponent() { serverLabel = new JLabel("Server name"); ! serverField = new JTextField( ! ClientGameConfiguration.get("DEFAULT_SERVER")); serverField.setEditable(true); serverPortLabel = new JLabel("Server port"); ! serverPortField = new JTextField( ! ClientGameConfiguration.get("DEFAULT_PORT")); usernameLabel = new JLabel("Choose a username"); *************** *** 131,135 **** contentPane = (JPanel) this.getContentPane(); - // createAccountButton // --- 133,136 ---- *************** *** 147,159 **** // contentPane.setLayout(new GridBagLayout()); ! contentPane.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); GridBagConstraints c = new GridBagConstraints(); ! //row 0 c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); ! c.gridx = 0;//column ! c.gridy = 0;//row c.fill = GridBagConstraints.NONE; contentPane.add(serverLabel, c); --- 148,161 ---- // contentPane.setLayout(new GridBagLayout()); ! contentPane.setBorder(BorderFactory.createCompoundBorder( ! BorderFactory.createEtchedBorder(), BorderFactory.createEmptyBorder(5, 5, 5, 5))); GridBagConstraints c = new GridBagConstraints(); ! // row 0 c.anchor = GridBagConstraints.LINE_START; c.insets = new Insets(4, 4, 4, 4); ! c.gridx = 0; // column ! c.gridy = 0; // row c.fill = GridBagConstraints.NONE; contentPane.add(serverLabel, c); *************** *** 163,167 **** contentPane.add(serverField, c); ! //row 1 c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; --- 165,169 ---- contentPane.add(serverField, c); ! // row 1 c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; *************** *** 175,179 **** contentPane.add(serverPortField, c); ! //row 2 c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; --- 177,181 ---- contentPane.add(serverPortField, c); ! // row 2 c.insets = new Insets(4, 4, 4, 4); c.gridx = 0; *************** *** 187,191 **** usernameField.requestFocusInWindow(); ! //row 3 c.gridx = 0; c.gridy = 3; --- 189,193 ---- usernameField.requestFocusInWindow(); ! // row 3 c.gridx = 0; c.gridy = 3; *************** *** 197,201 **** contentPane.add(passwordField, c); ! //row 4 c.gridx = 0; c.gridy = 4; --- 199,203 ---- contentPane.add(passwordField, c); ! // row 4 c.gridx = 0; c.gridy = 4; *************** *** 207,211 **** contentPane.add(passwordretypeField, c); ! //row 5 c.gridx = 0; c.gridy = 5; --- 209,213 ---- contentPane.add(passwordretypeField, c); ! // row 5 c.gridx = 0; c.gridy = 5; *************** *** 217,221 **** contentPane.add(emailField, c); ! //row 6 c.gridx = 1; c.gridy = 6; --- 219,223 ---- contentPane.add(emailField, c); ! // row 6 c.gridx = 1; c.gridy = 6; *************** *** 232,239 **** } ! private void createAccountButton_actionPerformed(ActionEvent e, boolean saveLoginBoxStatus) { final String accountUsername = usernameField.getText(); final String password = new String(passwordField.getPassword()); ! final String passwordretype = new String(passwordretypeField.getPassword()); // If this window isn't enabled, we shouldn't act. --- 234,243 ---- } ! private void createAccountButton_actionPerformed(ActionEvent e, ! boolean saveLoginBoxStatus) { final String accountUsername = usernameField.getText(); final String password = new String(passwordField.getPassword()); ! final String passwordretype = new String( ! passwordretypeField.getPassword()); // If this window isn't enabled, we shouldn't act. *************** *** 241,248 **** return; } ! if (!password.equals(passwordretype)) { ! JOptionPane.showMessageDialog(owner, "The passwords do not match. Please retype both.", ! "Password Mismatch", JOptionPane.WARNING_MESSAGE); return; } --- 245,253 ---- return; } ! if (!password.equals(passwordretype)) { ! JOptionPane.showMessageDialog(owner, ! "The passwords do not match. Please retype both.", ! "Password Mismatch", JOptionPane.WARNING_MESSAGE); return; } *************** *** 252,256 **** int port = 32160; ! final int finalPort;//port couldnt be accessed from inner class final ProgressBar progressBar = new ProgressBar(owner); --- 257,261 ---- int port = 32160; ! final int finalPort; // port couldnt be accessed from inner class final ProgressBar progressBar = new ProgressBar(owner); *************** *** 258,285 **** port = Integer.parseInt(serverPortField.getText()); } catch (Exception ex) { ! JOptionPane.showMessageDialog(owner, "That is not a valid port number. Please try again.", "Invalid Port", ! JOptionPane.WARNING_MESSAGE); return; } finalPort = port; ! /*seprate thread for connection proccess added by TheGeneral*/ ! //run the connection procces in separate thread Thread m_connectionThread = new Thread() { @Override public void run() { ! progressBar.start();//intialize progress bar ! setEnabled(false);//disable this screen when attempting to connect try { client.connect(server, finalPort); ! progressBar.step();//for each major connection milestone call step() } catch (Exception ex) { ! progressBar.cancel();//if something goes horribly just cancel the progressbar setEnabled(true); ! JOptionPane.showMessageDialog(owner, ! "Stendhal cannot connect to the Internet. Please check that your connection is set up and active, then try again."); ! logger.error(ex, ex); --- 263,295 ---- port = Integer.parseInt(serverPortField.getText()); } catch (Exception ex) { ! JOptionPane.showMessageDialog(owner, ! "That is not a valid port number. Please try again.", ! "Invalid Port", JOptionPane.WARNING_MESSAGE); return; } finalPort = port; ! /* seprate thread for connection proccess added by TheGeneral */ ! // run the connection procces in separate thread Thread m_connectionThread = new Thread() { @Override public void run() { ! progressBar.start(); // intialize progress bar ! setEnabled(false); // disable this screen when attempting to ! // connect try { client.connect(server, finalPort); ! progressBar.step(); // for each major connection milestone ! // call step() } catch (Exception ex) { ! progressBar.cancel(); // if something goes horribly just ! // cancel the progressbar setEnabled(true); ! JOptionPane.showMessageDialog( ! owner, ! "Stendhal cannot connect to the Internet. Please check that your connection is set up and active, then try again."); ! logger.error(ex, ex); *************** *** 288,307 **** try { ! AccountResult result = client.createAccount(accountUsername, password, email); ! if (result.failed()) { ! /* ! * If the account can't be created, show an error message and don't continue. ! */ progressBar.cancel(); ! setEnabled(true); ! JOptionPane.showMessageDialog(owner, ! result.getResult().getText(), ! "Create account failed", ! JOptionPane.ERROR_MESSAGE); } else { /* ! * Print username returned by server, as server can modify it at will ! * to match account names rules. */ --- 298,319 ---- try { ! AccountResult result = client.createAccount( ! accountUsername, password, email); ! if (result.failed()) { ! /* ! * If the account can't be created, show an error ! * message and don't continue. ! */ progressBar.cancel(); ! setEnabled(true); ! JOptionPane.showMessageDialog(owner, ! result.getResult().getText(), ! "Create account failed", ! JOptionPane.ERROR_MESSAGE); } else { /* ! * Print username returned by server, as server can ! * modify it at will to match account names rules. */ *************** *** 309,313 **** progressBar.finish(); ! // TODO: Check mental conflict bewteen username and account name. // Be sure to fix all the variable names. client.setAccountUsername(accountUsername); --- 321,326 ---- progressBar.finish(); ! // TODO: Check mental conflict bewteen username and ! // account name. // Be sure to fix all the variable names. client.setAccountUsername(accountUsername); *************** *** 325,357 **** stendhal.doLogin = true; } ! } catch (TimeoutException e) { progressBar.cancel(); setEnabled(true); JOptionPane.showMessageDialog( ! owner, ! "Unable to connect to server to create your account. The server may be down or, if you are using a custom server, you may have entered its name and port number incorrectly.", ! "Error Creating Account", ! JOptionPane.ERROR_MESSAGE); ! } catch (InvalidVersionException e) { progressBar.cancel(); setEnabled(true); ! JOptionPane.showMessageDialog(owner, ! "You are running an incompatible version of Stendhal. Please update", ! "Invalid version", ! JOptionPane.ERROR_MESSAGE); ! } catch (BannedAddressException e) { progressBar.cancel(); setEnabled(true); ! JOptionPane.showMessageDialog(owner, "You IP is banned. If you think this is not right. Please send a Support request to http://sourceforge.net/tracker/?func=add&group_id=1111&atid=201111", ! "IP Banned", ! JOptionPane.ERROR_MESSAGE); ! } catch(LoginFailedException e) { progressBar.cancel(); setEnabled(true); ! JOptionPane.showMessageDialog(owner, ! e.getMessage(), ! "Login failed", ! JOptionPane.INFORMATION_MESSAGE); } } --- 338,367 ---- stendhal.doLogin = true; } ! } catch (TimeoutException e) { progressBar.cancel(); setEnabled(true); JOptionPane.showMessageDialog( ! owner, ! "Unable to connect to server to create your account. The server may be down or, if you are using a custom server, you may have entered its name and port number incorrectly.", ! "Error Creating Account", JOptionPane.ERROR_MESSAGE); ! } catch (InvalidVersionException e) { progressBar.cancel(); setEnabled(true); ! JOptionPane.showMessageDialog( ! owner, ! "You are running an incompatible version of Stendhal. Please update", ! "Invalid version", JOptionPane.ERROR_MESSAGE); ! } catch (BannedAddressException e) { progressBar.cancel(); setEnabled(true); ! JOptionPane.showMessageDialog( ! owner, "You IP is banned. If you think this is not right. Please send a Support request to http://sourceforge.net/tracker/?func=add&group_id=1111&atid=201111", ! "IP Banned", JOptionPane.ERROR_MESSAGE); ! } catch (LoginFailedException e) { progressBar.cancel(); setEnabled(true); ! JOptionPane.showMessageDialog(owner, e.getMessage(), ! "Login failed", JOptionPane.INFORMATION_MESSAGE); } } *************** *** 364,371 **** @Override ! public void insertString(int offs, String str, AttributeSet a) throws BadLocationException { String lower = str.toLowerCase(); boolean ok = true; ! for(int i = lower.length() - 1; i >= 0; i--) { char chr = lower.charAt(i); if ((chr < 'a' || chr > 'z') && (chr < '0' || chr > '9')) { --- 374,382 ---- @Override ! public void insertString(int offs, String str, AttributeSet a) ! throws BadLocationException { String lower = str.toLowerCase(); boolean ok = true; ! for (int i = lower.length() - 1; i >= 0; i--) { char chr = lower.charAt(i); if ((chr < 'a' || chr > 'z') && (chr < '0' || chr > '9')) { Index: CreditsDialog.java =================================================================== RCS file: /cvsroot/arianne/stendhal/src/games/stendhal/client/gui/CreditsDialog.java,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CreditsDialog.java 5 Aug 2007 19:58:13 -0000 1.20 --- CreditsDialog.java 30 Sep 2007 07:57:32 -0000 1.21 *************** *** 60,64 **** * creates a new credits dialog * ! * @param owner owner window */ public CreditsDialog(Frame owner) { --- 60,65 ---- * creates a new credits dialog * ! * @param owner ! * owner window */ public CreditsDialog(Frame owner) { *************** *** 70,77 **** this.setTitle("Stendhal Credits"); ! // this.setResizable(false); ! // this.pack(); if (owner != null) { ! this.setLocation(owner.getX()+25, owner.getY()+25); this.setSize(owner.getSize()); } else { --- 71,78 ---- this.setTitle("Stendhal Credits"); ! // this.setResizable(false); ! // this.pack(); if (owner != null) { ! this.setLocation(owner.getX() + 25, owner.getY() + 25); this.setSize(owner.getSize()); } else { *************** *** 86,93 **** this.getContentPane().setBackground(backgroundColor); ! // read the credits from an external file because code format gets it unreadable if inlined List<String> creditsList = readCredits(); String[] credits = creditsList.toArray(new String[creditsList.size()]); ! sp = new ScrollerPanel(credits, textFont, 0, textColor, backgroundColor, 20); buttonPane.setOpaque(false); --- 87,96 ---- this.getContentPane().setBackground(backgroundColor); ! // read the credits from an external file because code format gets it ! // unreadable if inlined List<String> creditsList = readCredits(); String[] credits = creditsList.toArray(new String[creditsList.size()]); ! sp = new ScrollerPanel(credits, textFont, 0, textColor, ! backgroundColor, 20); buttonPane.setOpaque(false); *************** *** 104,111 **** */ private List<String> readCredits() { ! URL url = SpriteStore.get().getResourceURL("games/stendhal/client/gui/credits.txt"); List<String> res = new LinkedList<String>(); try { ! BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream())); String line = br.readLine(); while (line != null) { --- 107,116 ---- */ private List<String> readCredits() { ! URL url = SpriteStore.get().getResourceURL( ! "games/stendhal/client/gui/credits.txt"); List<String> res = new LinkedList<String>(); try { ! BufferedReader br = new BufferedReader(new InputStreamReader( ! url.openStream())); String line = br.readLine(); while (line != null) { |