From: Erik V. <ev...@us...> - 2008-12-03 20:16:42
|
Update of /cvsroot/rails/18xx/rails/ui/swing In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv5014/rails/ui/swing Modified Files: ORWindow.java StockChart.java ReportWindow.java Log Message: Could remove WindowListener methods (mostly unused) by passing WindowAdapter into addWindowListener. Index: ReportWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ReportWindow.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** ReportWindow.java 21 Nov 2008 20:41:47 -0000 1.7 --- ReportWindow.java 3 Dec 2008 20:16:39 -0000 1.8 *************** *** 2,17 **** package rails.ui.swing; - import rails.game.*; - import rails.util.LocalText; - import java.awt.*; - import javax.swing.*; import java.awt.event.*; /** * This is the UI for the LogWindow. It displays logged messages to the user * during the rails.game. */ ! public class ReportWindow extends JFrame implements WindowListener, KeyListener { private static final long serialVersionUID = 1L; --- 2,18 ---- package rails.ui.swing; import java.awt.*; import java.awt.event.*; + import javax.swing.*; + + import rails.game.GameManager; + import rails.game.ReportBuffer; + /** * This is the UI for the LogWindow. It displays logged messages to the user * during the rails.game. */ ! public class ReportWindow extends JFrame implements KeyListener { private static final long serialVersionUID = 1L; *************** *** 50,54 **** setLocation(600, 400); setTitle("Rails: Game log"); ! addWindowListener(this); addKeyListener(this); --- 51,63 ---- setLocation(600, 400); setTitle("Rails: Game log"); ! ! final JFrame frame = this; ! addWindowListener(new WindowAdapter() { ! @Override ! public void windowClosing(WindowEvent e) { ! StatusWindow.uncheckMenuItemBox(StatusWindow.REPORT_CMD); ! frame.dispose(); ! } ! }); addKeyListener(this); *************** *** 67,87 **** } - public void windowActivated(WindowEvent e) {} - - public void windowClosed(WindowEvent e) {} - - public void windowClosing(WindowEvent e) { - StatusWindow.uncheckMenuItemBox(LocalText.getText("REPORT")); - dispose(); - } - - public void windowDeactivated(WindowEvent e) {} - - public void windowDeiconified(WindowEvent e) {} - - public void windowIconified(WindowEvent e) {} - - public void windowOpened(WindowEvent e) {} - public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_F1) { --- 76,79 ---- Index: StockChart.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/StockChart.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** StockChart.java 4 Jun 2008 19:00:33 -0000 1.5 --- StockChart.java 3 Dec 2008 20:16:39 -0000 1.6 *************** *** 4,12 **** import java.awt.*; import java.awt.event.*; import javax.swing.*; import rails.game.*; import rails.ui.swing.elements.GUIStockSpace; - import rails.util.LocalText; /** --- 4,12 ---- import java.awt.*; import java.awt.event.*; + import javax.swing.*; import rails.game.*; import rails.ui.swing.elements.GUIStockSpace; /** *************** *** 14,18 **** */ ! public class StockChart extends JFrame implements WindowListener, KeyListener { private static final long serialVersionUID = 1L; private JPanel stockPanel; --- 14,18 ---- */ ! public class StockChart extends JFrame implements KeyListener { private static final long serialVersionUID = 1L; private JPanel stockPanel; *************** *** 31,35 **** stockPanel.setBackground(Color.LIGHT_GRAY); ! addWindowListener(this); addKeyListener(this); pack(); --- 31,42 ---- stockPanel.setBackground(Color.LIGHT_GRAY); ! final JFrame frame = this; ! addWindowListener(new WindowAdapter() { ! @Override ! public void windowClosing(WindowEvent e) { ! StatusWindow.uncheckMenuItemBox(StatusWindow.MARKET_CMD); ! frame.dispose(); ! } ! }); addKeyListener(this); pack(); *************** *** 97,117 **** } - public void windowActivated(WindowEvent e) {} - - public void windowClosed(WindowEvent e) {} - - public void windowClosing(WindowEvent e) { - StatusWindow.uncheckMenuItemBox(LocalText.getText("MARKET")); - dispose(); - } - - public void windowDeactivated(WindowEvent e) {} - - public void windowDeiconified(WindowEvent e) {} - - public void windowIconified(WindowEvent e) {} - - public void windowOpened(WindowEvent e) {} - public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_F1) { --- 104,107 ---- Index: ORWindow.java =================================================================== RCS file: /cvsroot/rails/18xx/rails/ui/swing/ORWindow.java,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** ORWindow.java 1 Dec 2008 21:31:55 -0000 1.18 --- ORWindow.java 3 Dec 2008 20:16:39 -0000 1.19 *************** *** 2,27 **** package rails.ui.swing; ! import rails.common.Defs; ! import rails.game.*; ! import rails.game.action.LayTile; ! import rails.game.action.LayToken; ! import rails.game.action.PossibleAction; ! import rails.game.action.PossibleActions; ! import rails.util.LocalText; ! import java.util.ArrayList; import java.util.List; ! import java.awt.*; ! import java.awt.event.*; ! import javax.swing.*; import org.apache.log4j.Logger; /** * This Window displays the available operations that may be performed during an * Operating Round. This window also contains the Game Map. */ ! public class ORWindow extends JFrame implements WindowListener, ActionPerformer { private static final long serialVersionUID = 1L; public GameUIManager gameUIManager; --- 2,27 ---- package rails.ui.swing; ! import java.awt.BorderLayout; ! import java.awt.Rectangle; ! import java.awt.event.WindowAdapter; ! import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.List; ! import javax.swing.JFrame; ! import javax.swing.JOptionPane; import org.apache.log4j.Logger; + import rails.common.Defs; + import rails.game.DisplayBuffer; + import rails.game.OperatingRound; + import rails.game.action.*; + /** * This Window displays the available operations that may be performed during an * Operating Round. This window also contains the Game Map. */ ! public class ORWindow extends JFrame implements ActionPerformer { private static final long serialVersionUID = 1L; public GameUIManager gameUIManager; *************** *** 31,35 **** private UpgradesPanel upgradePanel; private MessagePanel messagePanel; ! private Rectangle lastBounds; --- 31,35 ---- private UpgradesPanel upgradePanel; private MessagePanel messagePanel; ! private Rectangle lastBounds; *************** *** 78,82 **** setVisible(false); setSize(800, 600); ! addWindowListener(this); gameUIManager.reportWindow.addLog(); --- 78,90 ---- setVisible(false); setSize(800, 600); ! ! final JFrame frame = this; ! addWindowListener(new WindowAdapter() { ! @Override ! public void windowClosing(WindowEvent e) { ! StatusWindow.uncheckMenuItemBox(StatusWindow.MAP_CMD); ! frame.dispose(); ! } ! }); gameUIManager.reportWindow.addLog(); *************** *** 111,131 **** } - public void windowActivated(WindowEvent e) {} - - public void windowClosed(WindowEvent e) {} - - public void windowClosing(WindowEvent e) { - StatusWindow.uncheckMenuItemBox(LocalText.getText("MAP")); - dispose(); - } - - public void windowDeactivated(WindowEvent e) {} - - public void windowDeiconified(WindowEvent e) {} - - public void windowIconified(WindowEvent e) {} - - public void windowOpened(WindowEvent e) {} - public boolean process(PossibleAction action) { --- 119,122 ---- *************** *** 167,171 **** if (lastBounds != null) { Rectangle newBounds = getBounds(); ! lastBounds.x = newBounds.x; setBounds (lastBounds); } --- 158,162 ---- if (lastBounds != null) { Rectangle newBounds = getBounds(); ! lastBounds.width = newBounds.width; setBounds (lastBounds); } *************** *** 181,185 **** /** * Round-end settings ! * */ public void finish() { --- 172,176 ---- /** * Round-end settings ! * */ public void finish() { |