Here you can find the source of validateDPI(int dpi)
Parameter | Description |
---|---|
dpi | the dpi value |
private static int validateDPI(int dpi)
//package com.java2s; /******************************************************************************* * Copyright (c) 2004 Actuate Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w . j av a 2 s . c o m*/ * Actuate Corporation - initial API and implementation *******************************************************************************/ import javax.print.attribute.ResolutionSyntax; public class Main { /** * The default DPI value. */ private static final int DEFAULT_DPI = 96; /** * Validates the dpi value. If the value is invalid, try to use the JVM * defined value and model defined default value. * * @param dpi * the dpi value * @return the validated dpi value */ private static int validateDPI(int dpi) { if (dpi <= 0) // Try to use JVM defined value if the dpi value is invalid. dpi = ResolutionSyntax.DPI; if (dpi <= 0) // Use the default value if the JVM defined is invalid. dpi = DEFAULT_DPI; return dpi; } }