本文整理汇总了Scala中scalafx.scene.paint.Color类的典型用法代码示例。如果您正苦于以下问题:Scala Color类的具体用法?Scala Color怎么用?Scala Color使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Color类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Scala代码示例。
示例1: ScalaFXHelloWorld
//设置package包名称以及导入依赖的类
package my.scalafx
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafx.scene.layout.BorderPane
import scalafx.scene.paint.Color
import scalafx.scene.web.WebView
object ScalaFXHelloWorld extends JFXApp {
val webView = new WebView()
webView.getEngine.loadContent(
"""
<audio controls #player src="http://www.largesound.com/ashborytour/sound/AshboryBYU.mp3" preload="none">
Your browser does not support the audio element.
</audio>
"""
)
stage = new PrimaryStage {
title = "ScalaFX Hello World"
scene = new Scene {
fill = Color.rgb(38, 38, 38)
content = new BorderPane {
center = webView
}
}
}
}
开发者ID:setrar,项目名称:scalaFX-html5-audio,代码行数:32,代码来源:ScalaFXHelloWorld.scala
示例2: View
//设置package包名称以及导入依赖的类
package com.hombredequeso.robbierobot.Ui
import javafx.beans.property.SimpleBooleanProperty
import Vm.{RobotViewModel, ViewModel}
import scalafx.scene.paint.Color
import scalafx.scene.shape.{Circle, Rectangle, Shape}
import scalafx.Includes._
object View {
def getContent(
viewModel: ViewModel,
xWindowWidth: Int,
yWindowHeight: Int)
: List[Shape] = {
val robotView = createRobotView(viewModel.robot)
val gridView = createGridView(xWindowWidth,yWindowHeight, viewModel.grid)
gridView :+ robotView
}
private def createRobotView(vm: RobotViewModel) = {
new Circle {
centerX <== vm.xPos
centerY <== vm.yPos
radius = 50
}
}
private def createGridView(
totalX: Int, totalY: Int,
board: Vector[Vector[SimpleBooleanProperty]]
): List[Rectangle] = {
val xCount = board.length
val yCount = board(0).length
val xSize = totalX.toDouble / xCount.toDouble
val ySize = totalY.toDouble / yCount.toDouble
val all = for(
x <- 0 to xCount-1;
y <- 0 to yCount-1
) yield (x,y)
all.map(a => {
val (x1, y1):(Int, Int) = a
val rectX = (x1 * xSize)
val rectY = (y1 * ySize)
new Rectangle {
x = rectX
y = rectY
width = xSize
height = ySize
stroke = Color.Black
fill <== when(board(x1)(y1)) choose Color.Brown otherwise Color.White
}
}).toList
}
}
开发者ID:hombredequeso,项目名称:robbie-robot-scala,代码行数:60,代码来源:View.scala
示例3: SetFormula
//设置package包名称以及导入依赖的类
package scalaExcel.model
import scalafx.scene.paint.Color
import scalaExcel.CellPos
sealed trait ModelMutations
case class SetFormula(pos : CellPos, f: String) extends ModelMutations
case class EmptyCell(pos : Traversable[CellPos]) extends ModelMutations
case class CopyCell(from : CellPos, to : CellPos) extends ModelMutations
case class CutCell(from : CellPos, to : CellPos) extends ModelMutations
case class SetColor(pos : Traversable[CellPos], c: Color) extends ModelMutations
case class SetBackground(pos : Traversable[CellPos], c: Color) extends ModelMutations
case class SetAlign(pos : Traversable[CellPos], align: Alignment) extends ModelMutations
case class SetFormat(pos : Traversable[CellPos], format: ValueFormat) extends ModelMutations
case class SortColumn(x: Int, asc: Boolean) extends ModelMutations
case object Redo extends ModelMutations
case object Undo extends ModelMutations
case object Refresh extends ModelMutations
case class SetSheet(values: Map[(Int,Int),String], styles: Map[(Int,Int), Styles]) extends ModelMutations
case class AddRows(count: Int, index: Int) extends ModelMutations
case class AddColumns(count: Int, index: Int) extends ModelMutations
case class RemoveRows(count: Int, index: Int) extends ModelMutations
case class RemoveColumns(count: Int, index: Int) extends ModelMutations
case class ReorderColumns(permutations: Map[Int, Int]) extends ModelMutations
case object ClearHistory extends ModelMutations
开发者ID:dhoepelman,项目名称:ExcelClone,代码行数:27,代码来源:ModelMutations.scala
注:本文中的scalafx.scene.paint.Color类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论