List of usage examples for javafx.scene.control TextField equals
public boolean equals(Object obj)
From source file:dsfixgui.view.DSFGraphicsPane.java
private void recheckTextInput(TextField field) { String newText = field.getText(); if (field.equals(renderWidthField)) { if (!NumberUtils.isParsable(newText) || (NumberUtils.isParsable(newText) && Integer.parseInt(newText) < 1)) { renderWidthField.pseudoClassStateChanged(INVALID_INPUT, true); renderWidthField.setTooltip(new Tooltip(POSITIVE_INTEGER)); } else if (Integer.parseInt(newText) >= 1280) { if (NumberUtils.isParsable(presentWidthField.getText()) && (Integer.parseInt(newText) == Integer.parseInt(presentWidthField.getText()))) { renderWidthField.pseudoClassStateChanged(INVALID_INPUT, true); renderWidthField.setTooltip(new Tooltip(SAME_RESOLUTIONS)); } else { renderWidthField.pseudoClassStateChanged(INVALID_INPUT, false); renderWidthField.setTooltip(new Tooltip("")); config.setRenderWidth(Integer.parseInt(newText)); if (config.disableDOF) { config.setPresentWidth(Integer.parseInt(newText)); }// w w w . j a v a 2s .co m } //If input is a positive integer that is less than 1280, present width comes into play } else if (NumberUtils.isParsable(presentWidthField.getText()) && Integer.parseInt(presentWidthField.getText()) >= 1280) { renderWidthField.pseudoClassStateChanged(INVALID_INPUT, false); renderWidthField.setTooltip(new Tooltip("")); config.setRenderWidth(Integer.parseInt(newText)); } else { renderWidthField.pseudoClassStateChanged(INVALID_INPUT, true); renderWidthField.setTooltip(new Tooltip(PRES_WIDTH_TOO_LOW)); } } else if (field.equals(renderHeightField)) { if (!NumberUtils.isParsable(newText) || (NumberUtils.isParsable(newText) && Integer.parseInt(newText) < 1)) { renderHeightField.pseudoClassStateChanged(INVALID_INPUT, true); renderHeightField.setTooltip(new Tooltip(POSITIVE_INTEGER)); } else if (Integer.parseInt(newText) >= 720) { if (NumberUtils.isParsable(presentHeightField.getText()) && (Integer.parseInt(newText) == Integer.parseInt(presentHeightField.getText()))) { renderHeightField.pseudoClassStateChanged(INVALID_INPUT, true); renderHeightField.setTooltip(new Tooltip(SAME_RESOLUTIONS)); } else { renderHeightField.pseudoClassStateChanged(INVALID_INPUT, false); renderHeightField.setTooltip(new Tooltip("")); config.setRenderHeight(Integer.parseInt(newText)); if (config.disableDOF) { config.setPresentHeight(Integer.parseInt(newText)); config.setDOFOverride(Integer.parseInt(newText)); } } //If input is a positive integer that is less than 720, present height comes into play } else if (NumberUtils.isParsable(presentHeightField.getText()) && Integer.parseInt(presentHeightField.getText()) >= 720) { renderHeightField.pseudoClassStateChanged(INVALID_INPUT, false); renderHeightField.setTooltip(new Tooltip("")); config.setRenderHeight(Integer.parseInt(newText)); } else { renderHeightField.pseudoClassStateChanged(INVALID_INPUT, true); renderHeightField.setTooltip(new Tooltip(PRES_HEIGHT_TOO_LOW)); } } else if (field.equals(presentWidthField) && !presentWidthField.isDisabled()) { if (!NumberUtils.isParsable(newText) || (NumberUtils.isParsable(newText) && Integer.parseInt(newText) < 1)) { presentWidthField.pseudoClassStateChanged(INVALID_INPUT, true); presentWidthField.setTooltip(new Tooltip(POSITIVE_INTEGER)); } else if (Integer.parseInt(newText) < 1280) { presentWidthField.pseudoClassStateChanged(INVALID_INPUT, true); presentWidthField.setTooltip(new Tooltip(INPUT_GREATER_THAN + 1280)); } else if (Integer.parseInt(newText) >= 1280) { if (NumberUtils.isParsable(renderWidthField.getText()) && (Integer.parseInt(newText) == Integer.parseInt(renderWidthField.getText()))) { presentWidthField.pseudoClassStateChanged(INVALID_INPUT, true); presentWidthField.setTooltip(new Tooltip(SAME_RESOLUTIONS)); } else { presentWidthField.pseudoClassStateChanged(INVALID_INPUT, false); presentWidthField.setTooltip(null); config.setPresentWidth(Integer.parseInt(newText)); } } } else if (field.equals(presentWidthField) && presentWidthField.isDisabled()) { presentWidthField.pseudoClassStateChanged(INVALID_INPUT, false); presentWidthField.setTooltip(null); } else if (field.equals(presentHeightField) && !presentHeightField.isDisabled()) { if (!NumberUtils.isParsable(newText) || (NumberUtils.isParsable(newText) && Integer.parseInt(newText) < 1)) { presentHeightField.pseudoClassStateChanged(INVALID_INPUT, true); presentHeightField.setTooltip(new Tooltip(POSITIVE_INTEGER)); } else if (Integer.parseInt(newText) < 720) { presentHeightField.pseudoClassStateChanged(INVALID_INPUT, true); presentHeightField.setTooltip(new Tooltip(INPUT_GREATER_THAN + 720)); } else if (Integer.parseInt(newText) >= 720) { if (NumberUtils.isParsable(renderHeightField.getText()) && (Integer.parseInt(newText) == Integer.parseInt(renderHeightField.getText()))) { presentHeightField.pseudoClassStateChanged(INVALID_INPUT, true); presentHeightField.setTooltip(new Tooltip(SAME_RESOLUTIONS)); } else { presentHeightField.pseudoClassStateChanged(INVALID_INPUT, false); presentHeightField.setTooltip(null); config.setPresentHeight(Integer.parseInt(newText)); } } } else if (field.equals(presentHeightField) && presentHeightField.isDisabled()) { presentHeightField.pseudoClassStateChanged(INVALID_INPUT, false); presentHeightField.setTooltip(null); } else if (field.equals(fpsLimitField) && !fpsLimitField.isDisabled()) { if (!NumberUtils.isParsable(newText) || Integer.parseInt(newText) < 1) { fpsLimitField.pseudoClassStateChanged(INVALID_INPUT, true); fpsLimitField.setTooltip(new Tooltip(POSITIVE_INTEGER)); } else if (Integer.parseInt(newText) > 70) { fpsLimitField.pseudoClassStateChanged(INVALID_INPUT, true); fpsLimitField.setTooltip(new Tooltip(INPUT_FPS_TOO_HIGH)); } else { fpsLimitField.pseudoClassStateChanged(INVALID_INPUT, false); fpsLimitField.setTooltip(new Tooltip(FPS_LIMIT_LABEL.substring(0, FPS_LIMIT_LABEL.length() - 2))); config.FPSlimit.set(Integer.parseInt(newText)); } } else if (field.equals(fpsLimitField) && fpsLimitField.isDisabled()) { fpsLimitField.pseudoClassStateChanged(INVALID_INPUT, false); fpsLimitField.setTooltip(new Tooltip("")); } }