< prev index next >

apps/toys/Hello/src/main/java/a11y/HelloText.java

Print this page


   1 /*
   2  * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 import javafx.scene.control.Label;
  30 import javafx.scene.control.TextArea;
  31 import javafx.scene.control.TextField;
  32 import javafx.scene.layout.HBox;
  33 import javafx.scene.layout.VBox;
  34 import javafx.scene.paint.Color;
  35 import javafx.scene.text.Font;
  36 import javafx.scene.text.Text;
  37 import javafx.stage.Stage;
  38 
  39 public class HelloText extends Application {
  40 
  41 
  42     public static void main(String[] args) {
  43         Application.launch(args);
  44     }
  45 
  46     @Override public void start(Stage stage) {
  47 
  48         final Text text = new Text("01234");
  49         text.impl_selectionFillProperty().set(Color.BLUE);
  50         text.setFont(Font.font(50));
  51 
  52         Label l1 = new Label("name");
  53         TextField tf1 = new TextField("Hello JavaFX Accessiblity");
  54         l1.setLabelFor(tf1);
  55         HBox box1 = new HBox(10, l1, tf1);
  56 
  57         Label l2 = new Label("family");
  58         TextField tf2 = new TextField("james");
  59         tf2.setEditable(false);
  60         l2.setLabelFor(tf2);
  61         HBox box2 = new HBox(10, l2, tf2);
  62 
  63         TextArea ta = new TextArea("TextArea can many lines.\nLine1.\nLine2 is longer very long very long and can wrap. This is sentence belongs to the paragraph.\nLine 3 is not.");
  64         ta.setWrapText(true);
  65 
  66         Scene scene = new Scene(new VBox(text, box1, box2, ta), 300, 300);
  67 //        scene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
  68 //            @Override
  69 //            public void handle(KeyEvent event) {


   1 /*
   2  * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any


  29 import javafx.scene.control.Label;
  30 import javafx.scene.control.TextArea;
  31 import javafx.scene.control.TextField;
  32 import javafx.scene.layout.HBox;
  33 import javafx.scene.layout.VBox;
  34 import javafx.scene.paint.Color;
  35 import javafx.scene.text.Font;
  36 import javafx.scene.text.Text;
  37 import javafx.stage.Stage;
  38 
  39 public class HelloText extends Application {
  40 
  41 
  42     public static void main(String[] args) {
  43         Application.launch(args);
  44     }
  45 
  46     @Override public void start(Stage stage) {
  47 
  48         final Text text = new Text("01234");
  49         text.selectionFillProperty().set(Color.BLUE);
  50         text.setFont(Font.font(50));
  51 
  52         Label l1 = new Label("name");
  53         TextField tf1 = new TextField("Hello JavaFX Accessiblity");
  54         l1.setLabelFor(tf1);
  55         HBox box1 = new HBox(10, l1, tf1);
  56 
  57         Label l2 = new Label("family");
  58         TextField tf2 = new TextField("james");
  59         tf2.setEditable(false);
  60         l2.setLabelFor(tf2);
  61         HBox box2 = new HBox(10, l2, tf2);
  62 
  63         TextArea ta = new TextArea("TextArea can many lines.\nLine1.\nLine2 is longer very long very long and can wrap. This is sentence belongs to the paragraph.\nLine 3 is not.");
  64         ta.setWrapText(true);
  65 
  66         Scene scene = new Scene(new VBox(text, box1, box2, ta), 300, 300);
  67 //        scene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler<KeyEvent>() {
  68 //            @Override
  69 //            public void handle(KeyEvent event) {


< prev index next >