本文整理汇总了Scala中scalafx.geometry.Pos类的典型用法代码示例。如果您正苦于以下问题:Scala Pos类的具体用法?Scala Pos怎么用?Scala Pos使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Pos类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: 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
}
)
}
}
示例2: Empty
//设置package包名称以及导入依赖的类
package org.rustkeylock.fragments
import scalafx.scene.Scene
import scalafx.scene.layout.BorderPane
import scalafx.scene.layout.VBox
import scalafx.scene.image.ImageView
import scalafx.scene.paint.LinearGradient
import scalafx.scene.effect.DropShadow
import scalafx.scene.text.Text
import scalafx.geometry.Pos
class Empty() extends Scene {
root = new VBox() {
style = "-fx-background: white"
alignment = Pos.Center
children = Seq(
new ImageView("images/rkl.png"),
new Text {
text = "rust-keylock"
style = "-fx-font-size: 48pt"
})
}
}
示例3: 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"
})
}
}
示例4: 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
}
示例5: Notifications
//设置package包名称以及导入依赖的类
package net.mikolak.pomisos.utils
import org.controlsfx.control.Notifications
import scalafx.geometry.Pos
import scalafx.scene.image.ImageView
import scala.concurrent.duration._
import language.postfixOps
import Implicits._
import net.mikolak.pomisos.graphics.MainIcon
class Notifications(icon: MainIcon) {
def show(message: String) = {
Notifications.create
.title("Pomodoro")
.text(message)
.hideAfter(5 seconds)
.hideCloseButton()
.graphic(new ImageView(icon.image))
.position(Pos.TopRight)
.show()
}
}