本文整理汇总了Scala中javafx.scene.Scene类的典型用法代码示例。如果您正苦于以下问题:Scala Scene类的具体用法?Scala Scene怎么用?Scala Scene使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Scene类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: CurveApp
//设置package包名称以及导入依赖的类
package jp.qilab.aiis.fractal
import javafx.application.Application
import javafx.scene.Scene
import javafx.scene.canvas.Canvas
import javafx.scene.layout.StackPane
import javafx.stage.Stage
object CurveApp {
def main(args: Array[String]): Unit = {
Application.launch(classOf[CurveApp], args: _*)
}
}
class CurveApp extends Application {
val canvas = new Canvas(600, 600)
val g = canvas.getGraphicsContext2D
override def start(stage: Stage): Unit = {
val pane = new StackPane
pane.getChildren.add(canvas)
stage.setScene(new Scene(pane))
stage.show()
draw()
}
def draw(): Unit = {
val c = new Curve(g)
c.move(50, 300)
c.draw(500, 0)
}
}
开发者ID:qilab,项目名称:ml,代码行数:34,代码来源:CurveApp.scala
示例2: BaseController
//设置package包名称以及导入依赖的类
package fhj.swengb.project.courseware.components
import java.net.URL
import java.util.ResourceBundle
import javafx.fxml.{FXMLLoader, Initializable}
import javafx.scene.{Scene, Parent}
import javafx.stage.Stage
class BaseController extends Initializable {
var stage: Stage = null
val cssFilePath = "fhj.swengb.project/style.css"
def setStage(s: Stage) = stage = s
def getStage(): Stage = stage
override def initialize(location: URL, resources: ResourceBundle) = {}
def openWindow(fxmlLoaderPath: String, cssPath: String, controller: BaseController) = {
val fxmlLoader = new FXMLLoader(getClass.getResource(fxmlLoaderPath))
fxmlLoader.load[Parent]()
val scene = new Scene(fxmlLoader.getRoot[Parent])
val stage = new Stage
stage.setTitle("Courseware")
stage.setScene(scene)
stage.getScene.getStylesheets.add(cssPath)
stage.setResizable(false)
stage.show()
controller.setStage(stage)
}
}
开发者ID:McKorleone,项目名称:fhj.swengb.project.courseware,代码行数:36,代码来源:BaseController.scala
示例3: TreeGenerator
//设置package包名称以及导入依赖的类
package at.fitosoft.experiments.procedural.trees
import javafx.application.Application
import javafx.scene.canvas.{Canvas, GraphicsContext}
import javafx.scene.paint.Color
import javafx.scene.{Group, Scene}
import javafx.stage.Stage
import at.fitosoft.experiments.procedural.Seed
object TreeGenerator {
def main(args: Array[String]): Unit = {
Application.launch(classOf[TreeGenerator], args: _*)
}
}
class TreeGenerator extends Application {
val Zoom = 20
override def start(primaryStage: Stage): Unit = {
val tree1 = Tree(Seed(982734981))
println(s"tree1 = $tree1")
val tree2 = Tree(Seed(609804563))
println(s"tree2 = $tree2")
primaryStage.setTitle("Hello Trees!")
val root: Group = new Group
val canvas: Canvas = new Canvas(1024, 768)
val gc: GraphicsContext = canvas.getGraphicsContext2D
gc.setStroke(Color.BROWN)
gc.setLineWidth(5)
drawTree(tree1, 250, 650, gc)
drawTree(tree2, 550, 650, gc)
root.getChildren.add(canvas)
primaryStage.setScene(new Scene(root))
primaryStage.show()
}
def drawTree(tree1: Tree, startX: Int, startY: Int, gc: GraphicsContext): Unit = {
gc.strokeLine(startX, startY, startX, startY - tree1.trunkHeight * Zoom)
}
}
开发者ID:Fitosoft,项目名称:Experiments,代码行数:49,代码来源:TreeGenerator.scala
示例4: AboutStage
//设置package包名称以及导入依赖的类
package fr.acinq.eclair.gui.stages
import javafx.application.HostServices
import javafx.event.EventHandler
import javafx.fxml.FXMLLoader
import javafx.scene.image.Image
import javafx.scene.input.KeyCode._
import javafx.scene.input.KeyEvent
import javafx.scene.{Parent, Scene}
import javafx.stage.{Modality, Stage, StageStyle}
import fr.acinq.eclair.gui.controllers.AboutController
class AboutStage(hostServices: HostServices) extends Stage() {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair-square.png", false))
setTitle("About Eclair")
setResizable(false)
setWidth(500)
setHeight(200)
// get fxml/controller
val openFXML = new FXMLLoader(getClass.getResource("/gui/modals/about.fxml"))
openFXML.setController(new AboutController(hostServices))
val root = openFXML.load[Parent]
// create scene
val scene = new Scene(root)
val self = this
scene.addEventFilter(KeyEvent.KEY_PRESSED, new EventHandler[KeyEvent]() {
def handle(event: KeyEvent) = {
event.getCode match {
case ESCAPE =>
self.close
case _ =>
}
}
})
setScene(scene)
}
开发者ID:viacoin,项目名称:eclair,代码行数:45,代码来源:AboutStage.scala
示例5: SendPaymentStage
//设置package包名称以及导入依赖的类
package fr.acinq.eclair.gui.stages
import javafx.fxml.FXMLLoader
import javafx.scene.image.Image
import javafx.scene.{Parent, Scene}
import javafx.stage.{Modality, Stage, StageStyle}
import fr.acinq.eclair.Setup
import fr.acinq.eclair.gui.Handlers
import fr.acinq.eclair.gui.controllers.SendPaymentController
import grizzled.slf4j.Logging
class SendPaymentStage(handlers: Handlers, setup: Setup) extends Stage() with Logging {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair-square.png", false))
setTitle("Send a Payment Request")
setMinWidth(450)
setWidth(450)
setMinHeight(450)
setHeight(450)
// get fxml/controller
val receivePayment = new FXMLLoader(getClass.getResource("/gui/modals/sendPayment.fxml"))
receivePayment.setController(new SendPaymentController(handlers, this, setup))
val root = receivePayment.load[Parent]
// create scene
val scene = new Scene(root)
setScene(scene)
}
开发者ID:viacoin,项目名称:eclair,代码行数:33,代码来源:SendPaymentStage.scala
示例6: OpenChannelStage
//设置package包名称以及导入依赖的类
package fr.acinq.eclair.gui.stages
import javafx.fxml.FXMLLoader
import javafx.scene.image.Image
import javafx.scene.{Parent, Scene}
import javafx.stage.{Modality, Stage, StageStyle}
import fr.acinq.eclair.Setup
import fr.acinq.eclair.gui.Handlers
import fr.acinq.eclair.gui.controllers.OpenChannelController
class OpenChannelStage(handlers: Handlers, setup: Setup) extends Stage() {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair-square.png", false))
setTitle("Open a new channel")
setMinWidth(550)
setWidth(550)
setMinHeight(350)
setHeight(350)
// get fxml/controller
val openFXML = new FXMLLoader(getClass.getResource("/gui/modals/openChannel.fxml"))
openFXML.setController(new OpenChannelController(handlers, this, setup))
val root = openFXML.load[Parent]
// create scene
val scene = new Scene(root)
setScene(scene)
}
开发者ID:viacoin,项目名称:eclair,代码行数:32,代码来源:OpenChannelStage.scala
示例7: ReceivePaymentStage
//设置package包名称以及导入依赖的类
package fr.acinq.eclair.gui.stages
import javafx.fxml.FXMLLoader
import javafx.scene.image.Image
import javafx.scene.{Parent, Scene}
import javafx.stage.{Modality, Stage, StageStyle}
import fr.acinq.eclair.Setup
import fr.acinq.eclair.gui.Handlers
import fr.acinq.eclair.gui.controllers.ReceivePaymentController
class ReceivePaymentStage(handlers: Handlers, setup: Setup) extends Stage() {
initModality(Modality.WINDOW_MODAL)
initStyle(StageStyle.DECORATED)
getIcons().add(new Image("/gui/commons/images/eclair-square.png", false))
setTitle("Receive a Payment")
setMinWidth(550)
setWidth(550)
setMinHeight(300)
setHeight(300)
// get fxml/controller
val receivePayment = new FXMLLoader(getClass.getResource("/gui/modals/receivePayment.fxml"))
receivePayment.setController(new ReceivePaymentController(handlers, this, setup))
val root = receivePayment.load[Parent]
// create scene
val scene = new Scene(root)
setScene(scene)
}
开发者ID:viacoin,项目名称:eclair,代码行数:32,代码来源:ReceivePaymentStage.scala
示例8: Main
//设置package包名称以及导入依赖的类
package views
import javafx.application.Application
import javafx.stage.Stage
import javafx.scene.Scene
import javafx.scene.layout.BorderPane
class Main extends Application {
override def start(stage: Stage) {
stage.setTitle("pafelog")
stage.setScene(new Scene(new BorderPane {
setTop(Menus)
setCenter(new BorderPane {
setTop(Tools)
setCenter(Table)
})
}))
stage.setWidth(640)
stage.setHeight(480)
stage.show
}
}
object Main {
def main(args: Array[String]) {
Application.launch(classOf[Main], args: _*)
}
}
开发者ID:nextzlog,项目名称:pafe,代码行数:29,代码来源:Main.scala
示例9: DatePickerSample
//设置package包名称以及导入依赖的类
package net.sf.hajuergens.format
package net.sf.hajuergens.format
import java.util.Locale
import javafx.application.Application
import javafx.scene.Scene
import javafx.scene.control.{DatePicker => FxDatePicer}
import javafx.scene.layout.StackPane
import javafx.stage.Stage
object DatePickerSample {
locally {
Locale.setDefault(Locale.US)
}
def main(args: Array[String]) {
val appClass : Class[_ <: Application]= classOf[DatePickerSample]
Application.launch(appClass, args: _*)
}
}
class DatePickerSample extends Application {
override def start(primaryStage: Stage): Unit = {
val datePicker = new FxDatePicer()
datePicker.setConverter(new StringConverterLocalDate(datePicker.getChronology))
primaryStage.setScene(new Scene(new StackPane(Array(datePicker): _*), 375, 120))
primaryStage.show()
}
}
开发者ID:hjuergens,项目名称:cascading.formatters,代码行数:33,代码来源:DatePickerSample.scala
示例10: SceneSpec
//设置package包名称以及导入依赖的类
package com.reactific.jfxtend.stage
import javafx.geometry.NodeOrientation
import javafx.scene.paint.Color
import com.reactific.jfxtend.scene._
import javafx.scene.{PerspectiveCamera, Scene}
import javafx.scene.layout.StackPane
import org.specs2.mutable.Specification
class SceneSpec extends Specification {
"Scene" should {
"provide simple setters" in {
val scene = new Scene( new StackPane)
scene.fill = Color.BLACK
scene.camera = new PerspectiveCamera()
scene.nodeOrientation = NodeOrientation.LEFT_TO_RIGHT
success
}
}
}
开发者ID:reactific,项目名称:jfxtend,代码行数:26,代码来源:SceneSpec.scala
注:本文中的javafx.scene.Scene类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论