From: Ken C. <ke...@us...> - 2008-06-30 03:49:52
|
Update of /cvsroot/jmri/jmri/jmrit/throttle In directory sc8-pr-cvs17.sourceforge.net:/tmp/cvs-serv25455/src/jmri/jmrit/throttle Modified Files: ControlPanel.java Log Message: Added internationalization. Made throttle frame title and optional mix of text and loco address. Index: ControlPanel.java =================================================================== RCS file: /cvsroot/jmri/jmri/jmrit/throttle/ControlPanel.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** ControlPanel.java 30 Jun 2008 01:26:17 -0000 1.59 --- ControlPanel.java 30 Jun 2008 03:49:49 -0000 1.60 *************** *** 4,7 **** --- 4,8 ---- import jmri.util.SwingUtil; import jmri.util.JSpinnerUtil; + import java.util.ResourceBundle; import jmri.util.MouseInputAdapterInstaller; *************** *** 49,52 **** --- 50,54 ---- * @author glen Copyright (C) 2002 * @author Bob Jacobsen Copyright (C) 2007 + * @author Ken Cameron Copyright (C) 2008 * * @version $Revision$ *************** *** 54,57 **** --- 56,61 ---- public class ControlPanel extends JInternalFrame implements java.beans.PropertyChangeListener,ActionListener { + ResourceBundle rb = ResourceBundle.getBundle("jmri.jmrit.throttle.ThrottleBundle"); + private DccThrottle throttle; *************** *** 144,154 **** speedSpinner = null; } ! SpeedStep128Button = new JRadioButton("128 SS"); ! SpeedStep28Button = new JRadioButton("28 SS"); ! SpeedStep27Button = new JRadioButton("27 SS"); ! SpeedStep14Button= new JRadioButton("14 SS"); ! forwardButton = new JRadioButton("Forward"); ! reverseButton = new JRadioButton("Reverse"); propertiesPopup = new JPopupMenu(); --- 148,158 ---- speedSpinner = null; } ! SpeedStep128Button = new JRadioButton(rb.getString("Button128SS")); ! SpeedStep28Button = new JRadioButton(rb.getString("Button28SS")); ! SpeedStep27Button = new JRadioButton(rb.getString("Button27SS")); ! SpeedStep14Button= new JRadioButton(rb.getString("Button14SS")); ! forwardButton = new JRadioButton(rb.getString("ButtonForward")); ! reverseButton = new JRadioButton(rb.getString("ButtonReverse")); propertiesPopup = new JPopupMenu(); *************** *** 286,290 **** labelTable.put(new Integer(MAX_SPEED/2), new JLabel("50%")); labelTable.put(new Integer(MAX_SPEED), new JLabel("100%")); ! labelTable.put(new Integer(0), new JLabel("Stop")); speedSlider.setLabelTable(labelTable); speedSlider.setPaintTicks(true); --- 290,294 ---- labelTable.put(new Integer(MAX_SPEED/2), new JLabel("50%")); labelTable.put(new Integer(MAX_SPEED), new JLabel("100%")); ! labelTable.put(new Integer(0), new JLabel(rb.getString("LabelStop"))); speedSlider.setLabelTable(labelTable); speedSlider.setPaintTicks(true); *************** *** 429,433 **** labelTable.put(new Integer(MAX_SPEED/2), new JLabel("50%")); labelTable.put(new Integer(MAX_SPEED), new JLabel("100%")); ! labelTable.put(new Integer(0), new JLabel("Stop")); speedSlider.setLabelTable(labelTable); speedSlider.setPaintTicks(true); --- 433,437 ---- labelTable.put(new Integer(MAX_SPEED/2), new JLabel("50%")); labelTable.put(new Integer(MAX_SPEED), new JLabel("100%")); ! labelTable.put(new Integer(0), new JLabel(rb.getString("LabelStop"))); speedSlider.setLabelTable(labelTable); speedSlider.setPaintTicks(true); *************** *** 450,454 **** if (doIt) { float newSpeed = (speedSlider.getValue() / ( MAX_SPEED * 1.0f ) ) ; ! log.debug( "stateChanged: slider pos: " + speedSlider.getValue() + " speed: " + newSpeed ); throttle.setSpeedSetting( newSpeed ); if(speedSpinner!=null) --- 454,458 ---- if (doIt) { float newSpeed = (speedSlider.getValue() / ( MAX_SPEED * 1.0f ) ) ; ! if (log.isDebugEnabled()) {log.debug( "stateChanged: slider pos: " + speedSlider.getValue() + " speed: " + newSpeed );} throttle.setSpeedSetting( newSpeed ); if(speedSpinner!=null) *************** *** 479,483 **** //{ float newSpeed = ((Integer)JSpinnerUtil.getValue(speedSpinner)).floatValue() / ( MAX_SPEED * 1.0f ); ! log.debug( "stateChanged: spinner pos: " + JSpinnerUtil.getValue(speedSpinner) + " speed: " + newSpeed ); if (throttle != null) { throttle.setSpeedSetting( newSpeed ); --- 483,487 ---- //{ float newSpeed = ((Integer)JSpinnerUtil.getValue(speedSpinner)).floatValue() / ( MAX_SPEED * 1.0f ); ! if (log.isDebugEnabled()) {log.debug( "stateChanged: spinner pos: " + JSpinnerUtil.getValue(speedSpinner) + " speed: " + newSpeed );} if (throttle != null) { throttle.setSpeedSetting( newSpeed ); *************** *** 605,609 **** }); ! idleButton = new JButton("Idle"); constraints.gridy = 4; buttonPanel.add(idleButton, constraints); --- 609,613 ---- }); ! idleButton = new JButton(rb.getString("ButtonIdle")); constraints.gridy = 4; buttonPanel.add(idleButton, constraints); *************** *** 807,811 **** //slider setting. int newSliderSetting = java.lang.Math.round(speed * MAX_SPEED) ; ! log.debug( "propertyChange: new speed float: " + speed + " slider pos: " + newSliderSetting ) ; speedSlider.setValue( newSliderSetting ); if(speedSpinner!=null) --- 811,815 ---- //slider setting. int newSliderSetting = java.lang.Math.round(speed * MAX_SPEED) ; ! if (log.isDebugEnabled()) {log.debug( "propertyChange: new speed float: " + speed + " slider pos: " + newSliderSetting ) ;} speedSlider.setValue( newSliderSetting ); if(speedSpinner!=null) |