Package javafx.scene.control

Examples of javafx.scene.control.Labeled


    {
        checkArgument( node instanceof Labeled || node instanceof TextInputControl || node instanceof Text, "Target node must be Labeled or TextInputControl or Text, was ("+node.getClass().getName()+")." );

        if( node instanceof Labeled )
        {
            Labeled labeled = ( Labeled )node;
            actualText = labeled.getText();
        }
        else if(node instanceof TextInputControl)
        {
            TextInputControl textInput = ( TextInputControl )node;
            actualText = textInput.getText();
View Full Code Here


  }

  @Override
  public void handle(ActionEvent event) {
    Object source = event.getSource();
    Labeled labeled = null;
    if (source instanceof Labeled) {
      labeled = (Labeled) source;
    }
    if (labeled != null) {
      // check CSS styles, see RPN.fxml

      // the inputTextButton style is for buttons that append text to the input text field, e.g. digits
      String text = labeled.getText();
      if (labeled.getStyleClass().contains("inputTextButton")) {
        input = (input == null ? String.valueOf(text) : input + text);
        updateValueText();
      }
      // the inputTextEditButton style is for buttons that (somehow) edit the input text field, e.g. backspace
      if (labeled.getStyleClass().contains("inputTextEditButton")) {
        if (text.equals("backspace")) {
          if (input == null || input.length() == 0) {
            input = String.valueOf(rpn.pop(0.0));
          }
          input = input.substring(0, input.length() - 1);
        }
        updateValueText();
      }
      // the operatorButton style is for operator buttons, e.g. +
      if (labeled.getStyleClass().contains("operatorButton")) {
        char op = text.charAt(0);
        // push existing input
        if (input != null) {
          rpn.push(Double.valueOf(input));
          input = null;
        }
        rpn.performOperation(op);
        updateValueText();
      }
      // the actionButton style is for buttons that otherwise modify the calculator stack, e.g. push
      if (labeled.getStyleClass().contains("actionButton")) {
        performAction(text);
      }
    }
  }
View Full Code Here

TOP

Related Classes of javafx.scene.control.Labeled

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.