?? display.java
字號:
package binary;
import javax.swing.*;
public class Display {
public Display() {
}
public int get(){
while(true){
String inputString = JOptionPane.showInputDialog(null,"please enter a valid number");
try{
int number = Integer.parseInt(inputString);
if(number<0){
throw new Exception("number must be a positive number!");
}
return number;
}catch(NumberFormatException e){
JOptionPane.showMessageDialog(null,"invalid number");
}catch(Exception e){
JOptionPane.showMessageDialog(null,"Error:"+e.getMessage());
}
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -