Skip to main content
summaryrefslogtreecommitdiffstats
path: root/demos
diff options
context:
space:
mode:
authorTom Schindl2014-12-27 10:17:13 -0500
committerTom Schindl2014-12-27 10:17:13 -0500
commit3eb21c1491be59cb23439ecd911a0b93a93e19e6 (patch)
tree12f39b4851965a9d708ff7397727036f7752a385 /demos
parent9491e69d2058df805d47f063686e652652627f16 (diff)
downloadorg.eclipse.efxclipse-3eb21c1491be59cb23439ecd911a0b93a93e19e6.tar.gz
org.eclipse.efxclipse-3eb21c1491be59cb23439ecd911a0b93a93e19e6.tar.xz
org.eclipse.efxclipse-3eb21c1491be59cb23439ecd911a0b93a93e19e6.zip
Bug 452812 - Add a StyledString API
Diffstat (limited to 'demos')
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/.classpath8
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/.gitignore1
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/.project23
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/.settings/org.eclipse.jdt.core.prefs11
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/StyledTextSample.java38
-rw-r--r--demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/test.css7
6 files changed, 88 insertions, 0 deletions
diff --git a/demos/org.eclipse.fx.ui.controls.sample/.classpath b/demos/org.eclipse.fx.ui.controls.sample/.classpath
new file mode 100644
index 000000000..17cd0ee70
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/Java SE 8 [1.8.0]"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/org.eclipse.fx.ui.controls"/>
+ <classpathentry kind="con" path="org.eclipse.fx.ide.jdt.core.JAVAFX_CONTAINER"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/demos/org.eclipse.fx.ui.controls.sample/.gitignore b/demos/org.eclipse.fx.ui.controls.sample/.gitignore
new file mode 100644
index 000000000..ae3c17260
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/demos/org.eclipse.fx.ui.controls.sample/.project b/demos/org.eclipse.fx.ui.controls.sample/.project
new file mode 100644
index 000000000..02c08c36d
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/.project
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.fx.ui.controls.sample</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.xtext.ui.shared.xtextBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.xtext.ui.shared.xtextNature</nature>
+ </natures>
+</projectDescription>
diff --git a/demos/org.eclipse.fx.ui.controls.sample/.settings/org.eclipse.jdt.core.prefs b/demos/org.eclipse.fx.ui.controls.sample/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 000000000..3a2153707
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,11 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.8
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.8
diff --git a/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/StyledTextSample.java b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/StyledTextSample.java
new file mode 100644
index 000000000..7c9dd7c8f
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/StyledTextSample.java
@@ -0,0 +1,38 @@
+package org.eclipse.fx.ui.controls.sample;
+
+import org.eclipse.fx.ui.controls.styledtext.StyleRange;
+import org.eclipse.fx.ui.controls.styledtext.StyledTextArea;
+
+import javafx.application.Application;
+import javafx.scene.Scene;
+import javafx.scene.layout.BorderPane;
+import javafx.stage.Stage;
+
+public class StyledTextSample extends Application {
+
+ @Override
+ public void start(Stage primaryStage) throws Exception {
+ BorderPane p = new BorderPane();
+ StyledTextArea t = new StyledTextArea();
+ t.getStylesheets().add(getClass().getResource("test.css").toExternalForm());
+ t.getContent().setText("This is a styled text!\nThis is the 2nd line with data\nBlaBla");
+ t.setStyleRanges(
+ new StyleRange[] {
+ new StyleRange("text-highlight",0,30,null,null)
+ ,
+ new StyleRange("text-highlight",34,5,null,null)
+// ,
+// new StyleRange("text-highlight",10,12,null,null)
+ });
+ p.setCenter(t);
+
+ Scene scene = new Scene(p,800,600);
+
+ primaryStage.setScene(scene);
+ primaryStage.show();
+ }
+
+ public static void main(String[] args) {
+ launch(args);
+ }
+}
diff --git a/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/test.css b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/test.css
new file mode 100644
index 000000000..f107017b5
--- /dev/null
+++ b/demos/org.eclipse.fx.ui.controls.sample/src/org/eclipse/fx/ui/controls/sample/test.css
@@ -0,0 +1,7 @@
+.text-normal {
+
+}
+
+.text-highlight {
+ -styled-text-color: #ff0000;
+} \ No newline at end of file

Back to the top