Skip to content

Instantly share code, notes, and snippets.

@tomsontom
tomsontom / SkiaFX.java
Created Nov 26, 2020
Hardware Accelerate SkiaCanvas in JavaFX
View SkiaFX.java
package at.bestsolution.skia.example;
import org.jetbrains.skija.Paint;
import org.jetbrains.skija.Path;
import org.jetbrains.skija.Point;
import org.jetbrains.skija.Surface;
import at.bestsolution.skia.SkiaCanvas;
import javafx.application.Application;
import javafx.scene.Scene;
View SampleLayer.java
package bla;
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
import java.nio.file.Path;
import java.util.Set;
public class SampleLayer {
public static void main(String[] args) throws ClassNotFoundException {
Path[] paths = { Path.of("/Users/tomschindl/SDKs/javafx-sdk-11.0.2/lib/javafx.base.jar") };
View ListBox.stories.tsx
/*
* Copyright 2020 Adobe. All rights reserved.
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. You may obtain a copy
* of the License at http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
* OF ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
View demo.xsd
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/demo" xmlns:tns="http://www.example.org/demo" elementFormDefault="qualified">
<complexType name="abstract-element" abstract="true">
<attribute name="attribute" type="string" />
</complexType>
<complexType name="other-element">
<attribute name="attribute" type="string" />
</complexType>
<complexType name="derived-element">
<complexContent>
@tomsontom
tomsontom / SimpleLayerCreation.java
Created Oct 24, 2018
Simple creation of new Java-Module-System-Layer
View SimpleLayerCreation.java
package javamodules;
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
import java.net.URL;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Set;
@tomsontom
tomsontom / FeatureRichLayerCreation.java
Last active Nov 15, 2018
Add exports for dynamic layers
View FeatureRichLayerCreation.java
/*
* For modules on the boot-layer one can add exports using --add-exports but it looks like there's no
* public API to do the same when constructing a custom layer
*/
package javamodules;
import java.lang.ModuleLayer.Controller;
import java.lang.module.Configuration;
import java.lang.module.ModuleFinder;
import java.net.URL;
@tomsontom
tomsontom / MANIFEST.MF
Last active Feb 21, 2017
Generated MANIFEST.MF
View MANIFEST.MF
Manifest-Version: 1.0
Bnd-LastModified: 1487674769039
Bundle-ManifestVersion: 2
Bundle-Name: org.eclipse.fx.core
Bundle-SymbolicName: org.eclipse.fx.core
Bundle-Version: 3.0.0.201702211059
Created-By: 1.8.0_121 (Oracle Corporation)
Export-Package: org.eclipse.fx.core;version="3.0.0",
org.eclipse.fx.core.adapter;version="3.0.0",
org.eclipse.fx.core.app;version="3.0.0",
View gist:45b4a8bb828f69a8c243
package application;
public abstract class BaseClass {
protected void base() {
System.err.println("base");
}
protected final void fbase() {
System.err.println("fbase");
View gist:e3c6c49f55b04450db36
var Transition = Java.type("javafx.animation.Transition");
var Duration = Java.type("javafx.util.Duration");
var PropertyTransition = Java.extend(Transition);
var t = new PropertyTransition() {
interpolate: function(frac) {
print("INTERPOLATE");
},
play: function() {
print("Starting play");