|  |  | @ -1,4 +1,4 @@ | 
			
		
	
		
		
			
				
					
					|  |  |  | package Calculator; |  |  |  | package Calculator.jzzh; | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  | import javafx.application.Application; |  |  |  | import javafx.application.Application; | 
			
		
	
		
		
			
				
					
					|  |  |  | import javafx.geometry.Insets; |  |  |  | import javafx.geometry.Insets; | 
			
		
	
	
		
		
			
				
					|  |  | @ -52,9 +52,15 @@ public class CalculatorAPP extends Application { | 
			
		
	
		
		
			
				
					
					|  |  |  |         // 为按钮添加事件监听器
 |  |  |  |         // 为按钮添加事件监听器
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         convertButton.setOnAction(e -> { |  |  |  |         convertButton.setOnAction(e -> { | 
			
		
	
		
		
			
				
					
					|  |  |  |             try { |  |  |  |             try { | 
			
		
	
		
		
			
				
					
					|  |  |  |                 String num = numberField.getText(); |  |  |  |                 String num = numberField.getText().trim(); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 int fromBase = Integer.parseInt(fromBaseField.getText()); |  |  |  |                 int fromBase = Integer.parseInt(fromBaseField.getText().trim()); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                 int toBase = Integer.parseInt(toBaseField.getText()); |  |  |  |                 int toBase = Integer.parseInt(toBaseField.getText().trim()); | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 // 验证输入的有效性
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (fromBase < 2 || fromBase > 16 || toBase < 2 || toBase > 16) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     resultLabel.setText("进制范围应在2到16之间。"); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     return; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 // 调用转换方法
 |  |  |  |                 // 调用转换方法
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                 String converted = convertBase(num, fromBase, toBase); |  |  |  |                 String converted = convertBase(num, fromBase, toBase); | 
			
		
	
	
		
		
			
				
					|  |  | 
 |