• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Scala Color类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Scala R类代码示例发布时间:2022-05-23
下一篇:
Scala WebViewClient类代码示例发布时间:2022-05-23
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap