当前位置: 首页>>代码示例>>Scala>>正文


Scala Insets类代码示例

本文整理汇总了Scala中scalafx.geometry.Insets的典型用法代码示例。如果您正苦于以下问题:Scala Insets类的具体用法?Scala Insets怎么用?Scala Insets使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Insets类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。

示例1: ScalaFXHelloWorld

//设置package包名称以及导入依赖的类
package hello

import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.geometry.Insets
import scalafx.scene.Scene
import scalafx.scene.effect.DropShadow
import scalafx.scene.layout.HBox
import scalafx.scene.paint.Color._
import scalafx.scene.paint._
import scalafx.scene.text.Text

object ScalaFXHelloWorld extends JFXApp {

  stage = new PrimaryStage {
    //    initStyle(StageStyle.Unified)
    title = "ScalaFX Hello World"
    scene = new Scene {
      fill = Color.rgb(38, 38, 38)
      content = new HBox {
        padding = Insets(50, 80, 50, 80)
        children = Seq(
          new Text {
            text = "Scala"
            style = "-fx-font: normal bold 100pt sans-serif"
            fill = new LinearGradient(
              endX = 0,
              stops = Stops(Red, DarkRed))
          },
          new Text {
            text = "FX"
            style = "-fx-font: italic bold 100pt sans-serif"
            fill = new LinearGradient(
              endX = 0,
              stops = Stops(White, DarkGray)
            )
            effect = new DropShadow {
              color = DarkGray
              radius = 15
              spread = 0.25
            }
          }
        )
      }
    }

  }
} 
开发者ID:dariyavis,项目名称:scalaFXStart,代码行数:49,代码来源:ScalaFXHelloWorld.scala

示例2: RepoTab

//设置package包名称以及导入依赖的类
package mco.ui.desktop.components

import scalafx.geometry.Insets
import scalafx.scene.control.Tab
import scalafx.scene.layout.{HBox, VBox}

import alleycats.Empty
import cats.implicits._
import cats.derived.empty._, legacy._
import mco.ui.desktop.UIComponent
import mco.ui.state.{UIAction, UIState}
import fx.tools.cats._
import mco.ui.state.UIState.PendingAdds

object RepoTab extends UIComponent[UIState, Tab] {
  override def apply(state: ObservableValueM[UIState], act: (UIAction) => Unit): Tab = new Tab {
    text <== state.map(_.repoName)
    closable = false
    content = new HBox { contentRoot =>
      padding = Insets(10)

      private val mainView = Seq(
        RepoPackagesTable(state, act),
        new VBox {
          padding = Insets(0, 0, 0, 10)
          prefWidth <== (contentRoot.width / 3)
          children = Seq(
            PackageThumbnail(state.map(_.thumbnailURL) product width, act),
            PackageContentTable(state.map(_.currentPackage.map(_.contents).getOrElse(Set())), act),
            PackageActionButtons(state.map(_.currentPackage), act)
          )
        }
      )

      private val adds = state.map(_.pendingAdds.getOrElse(Empty[PendingAdds].empty))
      private lazy val pendingAddsView = Seq(BulkAssoc(adds, act))

      children <== state.map { s =>
        if (s.pendingAdds.isEmpty) mainView
        else pendingAddsView
      }
    }
  }
} 
开发者ID:oleg-py,项目名称:mco,代码行数:45,代码来源:RepoTab.scala

示例3: PackageActionButtons

//设置package包名称以及导入依赖的类
package mco.ui.desktop.components

import scalafx.Includes._
import scalafx.geometry.{Insets, Pos}
import scalafx.scene.control.Button
import scalafx.scene.layout.{HBox, Priority, Region}

import mco.{ContentKind, Package}
import mco.ui.desktop.UIComponent
import mco.ui.state.{InstallPackage, UIAction, UninstallPackage}
import fx.tools.cats._
import cats.syntax.functor._

object PackageActionButtons extends UIComponent[Option[Package], HBox] {
  override def apply(state: ObservableValueM[Option[Package]], act: (UIAction) => Unit): HBox =
    new HBox {
      hgrow = Priority.Always
      alignmentInParent = Pos.CenterRight
      padding = Insets(10, 0, 10, 0)
      spacing = 10
      children = Seq(
        new Region {
          minWidth = 10
          maxWidth = Double.MaxValue
          hgrow = Priority.Always
        },
        new Button("View README") {
          prefWidth = 125
          disable <== state.map(!_.exists(_.contents.exists(_.kind == ContentKind.Doc)))
          onMouseClicked = handle { sys.error("Readme not implemented") }
        },
        new Button {
          prefWidth = 125
          text <== state.map {
            case Some(p) if p.isInstalled => "Uninstall"
            case _ => "Install"
          }
          disable <== state.map(_.isEmpty)
          onAction <== state.map {
            _.fold(handle { })( x =>
              handle { act(if (!x.isInstalled) InstallPackage(x) else UninstallPackage(x)) })
          }
          defaultButton = true
        }
      )
    }
} 
开发者ID:oleg-py,项目名称:mco,代码行数:48,代码来源:PackageActionButtons.scala

示例4:

//设置package包名称以及导入依赖的类
package com.github.oopman.collectioneer.ui


import com.github.oopman.collectioneer.model.Collection

import scalafx.geometry.Insets
import scalafx.scene.control.{ListCell, ListView}
import scalafx.scene.layout.HBox
import scalafx.scene.text.Text


  cellFactory = { _ =>
    new ListCell[Collection] {
      item.onChange { (_, _, newValue) =>
        graphic = new HBox {
          padding = Insets(5, 10, 5, 10)
          children = Seq(
            // TODO: Use proper controls
            new Text { text = newValue.name },
            new Text { text = if(newValue.active) "X" else "O" }
          )
        }

      }
    }
  }
} 
开发者ID:OOPMan,项目名称:Collectioneer,代码行数:28,代码来源:CollectionsListView.scala

示例5: MainMenu

//设置package包名称以及导入依赖的类
package org.rustkeylock.fragments

import scalafx.Includes._
import scalafx.scene.Scene
import org.slf4j.LoggerFactory
import com.typesafe.scalalogging.Logger
import scalafx.scene.layout.GridPane
import scalafx.geometry.Insets
import scalafx.scene.layout.BorderPane
import org.rustkeylock.fragments.sides.Navigation
import scalafx.scene.control.ScrollPane
import scalafx.scene.layout.VBox
import scalafx.scene.control.ScrollPane.ScrollBarPolicy
import scalafx.scene.control.ListView
import scalafx.scene.text.Text
import scalafx.scene.paint.Stops
import scalafx.geometry.Pos
import scalafx.scene.image.ImageView
import scalafx.stage.Stage

class MainMenu(stage: Stage) extends Scene {
  val logger = Logger(LoggerFactory.getLogger(this.getClass))

  root = new BorderPane() {
    style = "-fx-background: white"
    // Navigation pane
    left = new Navigation
    // Main pane
    center = new ScrollPane {
      fitToHeight = true
      hbarPolicy = ScrollBarPolicy.AsNeeded
      vbarPolicy = ScrollBarPolicy.AsNeeded
      content = new Center
    }
  }

  private class Center extends VBox {
    spacing = 33
    padding = Insets(10, 10, 10, 10)
    alignment = Pos.Center

    children = Seq(
      new ImageView("images/rkl.png"),
      new Text {
        style = "-fx-font-size: 12pt"
        text = "Please make a selection"
      },
      new Text {
        style = "-fx-font-size: 12pt"
        text = "on the Navigation bar on the left in order to proceed"
      })
  }

} 
开发者ID:rust-keylock,项目名称:rust-keylock-ui,代码行数:55,代码来源:MainMenu.scala

示例6: ExperimenterImageTab

//设置package包名称以及导入依赖的类
package com.antiparagon.cvexperimenter.gui

import scalafx.geometry.{Insets, Pos}
import scalafx.scene.control.{ScrollPane, Tab}
import scalafx.scene.image.{Image, ImageView}
import scalafx.scene.layout.{HBox, VBox}


class ExperimenterImageTab(val img : Image) extends Tab with ExperimenterTab {

  content = new VBox {
    padding = Insets(20)
    style = "-fx-background-color: black"
    alignment = Pos.Center
    children = Seq(
      new HBox {
        alignment = Pos.Center
        children = new ScrollPane {
          style = "-fx-background-color: black"
          //alignment = Pos.Center
          val imgView = new ImageView(img)
          imgView.style = "-fx-background-color: transparent"
          content = imgView
        }
      }
    )
  }

  override def getImg() : Image = return img

  override def getTabText(): String = text.value

} 
开发者ID:antiparagon,项目名称:CVExperimenter,代码行数:34,代码来源:ExperimenterImageTab.scala

示例7: SampleScalaFXApp2

//设置package包名称以及导入依赖的类
package com.equalinformation.scala.programs.gui

import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.geometry.Insets
import scalafx.scene.Scene
import scalafx.scene.effect.DropShadow
import scalafx.scene.layout.HBox
import scalafx.scene.paint.Color._
import scalafx.scene.paint.{LinearGradient, Stops}
import scalafx.scene.text.Text


object SampleScalaFXApp2 extends JFXApp {
  //TODO Resolve run-time issue
  stage = new PrimaryStage {
    title = "ScalaFX Sample App2"
    scene = new Scene {
      fill = Black
      content = new HBox {
        padding = Insets(20)
        children = Seq(
          new Text {
            text = "Sample "
            style = "-fx-font-size: 48pt"
            fill = new LinearGradient(
              endX = 0,
              stops = Stops(PaleGreen, SeaGreen))
          },
          new Text {
            text = "App2!!!"
            style = "-fx-font-size: 48pt"
            fill = new LinearGradient(
              endX = 0,
              stops = Stops(Cyan, DodgerBlue)
            )
            effect = new DropShadow {
              color = DodgerBlue
              radius = 25
              spread = 0.25
            }
          }
        )
      }
    }
  }
} 
开发者ID:bpupadhyaya,项目名称:scala-programs-collection,代码行数:48,代码来源:SampleScalaFXApp2.scala


注:本文中的scalafx.geometry.Insets类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。