JavaFx different way of code - javafx

I found the following JavaFx code on internet, but I dont know where to run it or what library I have to import. Please help me to understand..
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.shape.Rectangle;
import javafx.scene.paint.Color;
import javafx.animation.transition.PauseTransition;
import javafx.animation.transition.SequentialTransition;
import javafx.animation.Timeline;
var fillColor: Color.BLUE;
Stage {
title : "MyApp"
scene: Scene {
width: 400
height: 200
content: [
Rectangle {
x: 10, y: 10
width: 140, height: 90
fill: bind fillColor
}
]
}
}
There is no start method and extends Application class in the code.
Thanks in advance.

That is very old JavaFX script code. JavaFX Script and the system to run it are no longer supported by Oracle (and likely no longer distributed by them either).
Forget you ever saw the JavaFX Script code and the internet site which provided it. Do not try to understand the JavaFX Script code.
Instead, learn JavaFX using the Java language based on current resources for Java client technology (Java 8) at the Oracle Java site.

Related

VisualCode error { expectedcss(css-lcurlyexpected)

Please help me to solve the problem with import fonts into css file in React.js App.
I use typescript and when I import fonts into src/index.css file i received error:
"{ expectedcss(css-lcurlyexpected)"
How can I fix this?
import '#fontsource/roboto/300.css';
import '#fontsource/roboto/400.css';
import '#fontsource/roboto/500.css';
import '#fontsource/roboto/700.css';
I don't know how to fix this

Passing data to createApp (vue)

Using Webpack, I have this code:
import { createApp } from 'vue'
import Vue from 'vue'
import App from './components/ItemSearch/ItemSearch.vue'
createApp(App).mount('#search-app')
On my website, I have a page for the search app that contains the <div id="search-app" /> to mount the root of the application to.
What I would like to know is, whether it's possible to somehow insert (preferably) some of the data from the page that includes the javascript file? There are a few things items I would like to include from the database, such as settings and search categories, and I'd like to avoid making an AJAX request for them if it can be helped.
Can it be helped or is there some way I can include this data inline at load time?
With Webpack, I don't quite understand how I can get access to App from the page that loads the javascript file, so that I can modify data before somehow passing it in to createApp(), or if it's even possible. Can I use import statements on a page that's loaded by the browser, or is this stictly a Webpack only (or similar) feature?
Many thanks in advance.
You can use createApp's second parameter to pass props.
import { createApp } from 'vue'
import Vue from 'vue'
import App from './components/ItemSearch/ItemSearch.vue'
createApp(App, {myProp: "value"}).mount('#search-app')
docs

undefined is not an object '_react2.PushNotificationIOS.FetchResult'

I am currently running ReactNative version 0.54.0. I have scoured the internet and followed all of the directions to setting up PushNotification (manual linking: adding RCTPushNotification.xcodeproj to xcode and linking up the libRCTPushNotification, etc)
I copied the code from facebook, into the AppDelegate.m in xCode
I have imported PushNotificationIOS from react and PushNotification from react-native-push-notification.
I copied the PushNotification.configure() code into my app.js file. The error that I keep getting is "undefined is not an object '_react2.PushNotificationIOS.FetchResult'" in the onNotification method.
Can anyone let me know I am doing wrong?
Make sure you have imports like these
import {
StyleSheet,
View,
PushNotificationIOS
} from 'react-native';
and not
import {
StyleSheet,
View
} from 'react-native';
import {PushNotificationIOS} from 'react-native';

Qml QtQuickControls2, change style properties at runtime

I should set property of Material style at runtime, for example to change theme value (light/dark) when the user click on a defined button.
I have configured Material style with qtquickcontrols2.conf and its properties (theme, accent and primary). I can't import QtQuick.Controls.Materials 2.0 because I don't know, but I'm working on Ubuntu with QtCreator 4.0.2 and the QtQuick.Controls.Materials and QtQuick.Controls.Universal imports are not detected.
My goal is simply change theme of material style from light to dark and viceversa on runtime. How can I integrate this feature? Thanks in advice.
Best Regards
Daniele
I can't import QtQuick.Controls.Materials 2.0 because I don't know, but I'm working on Ubuntu with QtCreator 4.0.2 and the QtQuick.Controls.Materials and QtQuick.Controls.Universal imports are not detected.
You need at least Qt 5.7.0 in order to have the Qt Quick Controls 2.0 import available.
My goal is simply change theme of material style from light to dark and viceversa on runtime.
You switch the theme at runtime like this:
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Controls.Material 2.0
ApplicationWindow {
id: window
width: 200
height: 200
visible: true
Material.theme: themeSwitch.checked ? Material.Dark : Material.Light
Switch {
id: themeSwitch
text: "Dark"
anchors.centerIn: parent
}
}

QtCreator syntax highlighting when import qml from qrc

When I import qml from qrc (which place in different directory from ) it's compile and work fine.
But when Qt Creator don't recognize imported component and don't hightlight this.
This's code:
import QtQuick 2.0
import "qrc:/qml_libs/ApplicationContainer"
Item
{
id: root_object
width: 300
height: 200
ApplicationContainer {
width : parent.width
height: parent.height
}
}
#Aleus, your way of doing thing is little bit tricky. I can't find any information of such kind importing in official documentation (please, take a look at Importing statements in Qt 5.2, QML. Also, take a look at QML Best Practices: Coding Conventions
First of all, check weather your file ApplicationContainer really has no extension (I mean .qml)
To make QtCreator recognize imported component do next things:
Add your qml file to .pro file in section OTHER_FILES like this:
OTHER_FILES += qml_libs/ApplicationContainer
AND/OR place statement for importing whole directory to your qml file, like:
import "qml_libs" as MyLibs
...
MyLibs.ApplicationContainer { ... }
Hope it helps!

Resources