List of usage examples for java.lang Number intValue
public abstract int intValue();
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); scene.setFill(Color.ALICEBLUE); stage.setScene(scene);//from w ww . j av a 2 s .co m stage.show(); stage.setTitle("ChoiceBox Sample"); stage.setWidth(300); stage.setHeight(200); label.setStyle("-fx-font: 25 arial;"); label.setLayoutX(40); rect.setArcHeight(8); rect.setArcWidth(8); rect.setStroke(Color.BLUE); rect.setStrokeWidth(3); rect.setFill(Color.WHITE); final String[] greetings = new String[] { "Hello", "Hola", "??????", "?", "?????" }; final ChoiceBox cb = new ChoiceBox( FXCollections.observableArrayList("English", "Espaol", "???????", "????", "???")); cb.getSelectionModel().selectedIndexProperty().addListener(new ChangeListener<Number>() { public void changed(ObservableValue ov, Number value, Number new_value) { label.setText(greetings[new_value.intValue()]); } }); cb.setTooltip(new Tooltip("Select the language")); cb.setValue("English"); HBox hb = new HBox(); hb.getChildren().addAll(cb, label); hb.setSpacing(30); hb.setAlignment(Pos.CENTER); hb.setPadding(new Insets(10, 0, 0, 10)); ((Group) scene.getRoot()).getChildren().add(hb); }
From source file:io.coala.random.impl.RandomNumberStreamFactoryJDK.java
@Override public RandomNumberStream create(final RandomNumberStreamID id, final Number seed) { final RandomGenerator rng = new JDKRandomGenerator(); rng.setSeed(seed.intValue()); return RandomNumberStream.Util.asStream(id, rng); }
From source file:com.anrisoftware.sscontrol.httpd.phpldapadmin.LdapServer.java
private void setPort(Object object) { if (object instanceof Number) { Number number = (Number) object; setPort(number.intValue()); } else {/*from www . j a v a 2s . com*/ setPort(ServicePort.valueOf(object.toString()).getPort()); } }
From source file:de.crowdcode.bitemporal.example.AddressRepository.java
public Integer getAmount() { Query query = em.createQuery("select count(c.id) from AddressImpl c"); Number amount = (Number) query.getSingleResult(); return amount.intValue(); }
From source file:griffon.swing.editors.ColorPropertyEditor.java
private int parse(Number val) { return val.intValue() & 0xFF; }
From source file:com.github.jknack.handlebars.helper.NumberHelper.java
/** * Apply the helper to the context.//w w w . j a va2s. com * * @param value * The number value. * @return true is even, false is odd */ protected boolean isEven(final Number value) { return value.intValue() % 2 == 0; }
From source file:au.com.onegeek.lambda.core.provider.WebDriverBackedSeleniumProvider.java
public void sleep(String wait) throws InterruptedException, ParseException { NumberFormat format = NumberFormat.getInstance(Locale.ENGLISH); Number number = format.parse(wait); this.sleep(number.intValue()); }
From source file:com.flexive.shared.FxFormatUtils.java
/** * Convert a String to Integer/* ww w. ja v a 2s . c o m*/ * * @param value value to convert * @return Integer */ public static Integer toInteger(String value) { if (StringUtils.isBlank(value)) return null; final ParsePosition pos = new ParsePosition(0); final String _value = value.trim(); try { final Number parse = FxValueRendererFactory.getNumberFormatInstance().parse(unquote(_value), pos); if (pos.getErrorIndex() >= 0 || pos.getIndex() != _value.length() || parse.doubleValue() != (double) parse.intValue() /*truncation*/) throw new FxConversionException("ex.conversion.value.error", FxNumber.class.getCanonicalName(), value, "Failed to parse " + value).asRuntimeException(); return parse.intValue(); } catch (NumberFormatException e) { throw new FxConversionException("ex.conversion.value.error", FxLargeNumber.class.getCanonicalName(), value, "Failed to parse [" + value + "] using dec.sep. [" + FxContext.get().getDecimalSeparator() + "] and grouping sep. [" + FxContext.get().getDecimalSeparator() + "]") .asRuntimeException(); } }
From source file:org.fornax.cartridges.sculptor.framework.test.AbstractDbUnitJpaTests.java
/** * Using a separate JDBC connection causes locking problems with different rdbms * (hsqldb 2.x introduced a new transaction, locking and isolation level handling) *//*from w w w .j av a2s.c o m*/ @Override protected int countRowsInTable(String tableName, String additionalCondition) { flush(); clear(); Query query = entityManager .createNativeQuery("select count(*) from " + tableName + " " + additionalCondition); Number rowCount = (Number) query.getSingleResult(); return rowCount.intValue(); }
From source file:com.ruihu.easyshop.user.dao.UserDao.java
/** * check user list/*from www .j a v a2 s. c om*/ * @param loginname */ public boolean ajaxValidateLoginname(String loginname) throws SQLException { String sql = "select count(1) from t_user where loginname=?"; Number number = (Number) qr.query(sql, new ScalarHandler(), loginname); return number.intValue() == 0; }