Advertisement
sergAccount

Untitled

Mar 19th, 2016
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.25 KB | None | 0 0
  1.  
  2. import java.awt.Image;
  3. import java.io.File;
  4. import java.io.IOException;
  5. import javax.imageio.ImageIO;
  6. import javax.swing.JOptionPane;
  7.  
  8. /*
  9.  * To change this license header, choose License Headers in Project Properties.
  10.  * To change this template file, choose Tools | Templates
  11.  * and open the template in the editor.
  12.  */
  13.  
  14. /**
  15.  *
  16.  * @author Sergey
  17.  */
  18. public class Game {  
  19.    
  20.     //  
  21.     public static Image loadImage(String fileName){
  22.         //
  23.         try{
  24.             return ImageIO.read(new File(fileName));
  25.         }catch(IOException ex){
  26.             ex.printStackTrace();
  27.         }
  28.         return null;
  29.     }
  30.     //
  31.     public static void main(String[] args){
  32.         //        
  33.         String rez = JOptionPane.showInputDialog(null, "Введите сложность игры от 1 от 7:", "Сложность игры", 1);
  34.         int slogn = rez.charAt(0) - '0';        
  35.         // Проверка что введена цифра от 1 до 7
  36.         if(slogn>=1 && slogn<=7){
  37.             //Okno window = new Okno(slogn);            
  38.         }          
  39.     }    
  40. }
  41.  
  42.       /*
  43.         Image im = loadImage("c:/game/fon.jpg");
  44.         System.out.println("image.h=" + im.getHeight(null));
  45.         */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement