Java InputMismatchException.printStackTrace方法代码示例

本文整理汇总了Java中java.util.InputMismatchException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java InputMismatchException.printStackTrace方法的具体用法?Java InputMismatchException.printStackTrace怎么用?Java InputMismatchException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.util.InputMismatchException的用法示例。


Java InputMismatchException.printStackTrace方法代码示例

在下文中一共展示了InputMismatchException.printStackTrace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import java.util.InputMismatchException; //导入方法依赖的package包/类
public boolean load(String filename, boolean eraseOld) {
	try {
		Scanner s = new Scanner(new BufferedReader(new FileReader(filename)));
		if (eraseOld) deleteFullGraph();
		
		graph.load(s);
		if (TextureEditor.GL_ENABLED) TextureEditor.INSTANCE.m_OpenGLPreviewPanel.load(s);
		repaint();
		
		return true;
	} catch (FileNotFoundException e) {
		Logger.logError(this, "Could not load " + filename);
		return false;
	} catch (InputMismatchException ime) {
		ime.printStackTrace();
		Logger.logError(this, "Could not load " + filename);
		return false;
	}
	
} 
开发者ID:Erkaman,项目名称:NeoTextureEdit2,代码行数:21,代码来源:TextureGraphEditorPanel.java

示例2: main

import java.util.InputMismatchException; //导入方法依赖的package包/类
public static void main(String[] args)
{
  new cSuper();
  Scanner question = new Scanner(System.in);
  
  {
    Person eu = new Person("Jozadaque", 21);
    
    System.out.println("My name is: msg = " + "[ msg = " + eu.getName() + " ]");      
  }
  
  /* Gives me an error, because the object eu was destroyed =D
  * eu.getMessage();
   */
  
  try {
  
    System.out.print("Choose a number between 0 - 10: ");
    System.out.println(questionReview(question.nextInt()));
  
  } catch(InputMismatchException e) {
  
    e.printStackTrace();
    System.err.println("\n*Motivo: Voce entrou com um valor não numérico!");
  
  }
} 
开发者ID:jozadaquebatista,项目名称:JAVA-Overview,代码行数:28,代码来源:cSuper.java

示例3: MultiPolygon

import java.util.InputMismatchException; //导入方法依赖的package包/类
/**
 * constructor reads file to create a multiPolygon
 * @param file the file of the multipolygon
 * @throws FileNotFoundException when the file is not found
 */
public MultiPolygon(File file) throws FileNotFoundException {

	input = new Scanner(file);
	try{

		nHoles = input.nextInt();
		int nPoints = input.nextInt();// number of points of the polygon that is
										// currently being read (this value
										// changes when holes are read too)
		// used for autoscaling in drawtool
		double readX;
		double readY;

		outerPolygon = new Coordinate[nPoints];
		holes = new Coordinate[nHoles][];

		for (int i = 0; i < nPoints; i++) {

			readX = input.nextDouble();
			readY = input.nextDouble();
			outerPolygon[i] = new Coordinate(readX, readY);
			
			//-----------------------------------------------------
			//values used for scaling in gui
			if (readX > biggestX)
				biggestX = readX;
			else if(readX < smallestX)smallestX = readX;
			if (readY > biggestY)
				biggestY = readY;
			else if(readY < smallestY)smallestY = readY;
			
			//-----------------------------------------------------	
		}
	
		if(checkClockwise(outerPolygon)){
			
			changeClockOrientation(outerPolygon);

		}

		for (int i = 0; i < nHoles; i++) {

			nPoints = input.nextInt();
			holes[i] = new Coordinate[nPoints];

			for (int j = 0; j < nPoints; j++) {
				holes[i][j] = new Coordinate(input.nextDouble(), input.nextDouble());
			}
			
			if(!checkClockwise(holes[i])){
				changeClockOrientation(holes[i]);
			}
		}
		input.close();

		// now we will make the edge arrays
		// this array contains the same information but in pairs of coordinates
		// to allow an easier way to use edges
		createEdges();
	}catch(InputMismatchException e){
		System.err.println("the input file is not correct");
		e.printStackTrace();
	}
} 
开发者ID:TonyWauters,项目名称:JNFP,代码行数:70,代码来源:MultiPolygon.java

本文标签属性:

示例:示例英语

代码:代码零九

java:java游戏

上一篇:Java UIComponent.getChildren方法代码示例
下一篇:Python lib.Event类代码示例

为您推荐