本文整理汇总了Scala中scalafx.scene.layout.VBox类的典型用法代码示例。如果您正苦于以下问题:Scala VBox类的具体用法?Scala VBox怎么用?Scala VBox使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了VBox类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: FileInfo
//设置package包名称以及导入依赖的类
package strnet
import java.io.File
import scala.sys.process._
import scalafx.Includes._
import org.apache.commons.io.FilenameUtils
import scalafx.scene.control.Label
import scalafx.scene.image.{ Image, ImageView }
import scalafx.scene.input.MouseEvent
import scalafx.scene.layout.VBox
class FileInfo(
file: File,
command: String,
thumbnailExtension: String,
defaultImg: Image)
extends VBox {
val baseName = FilenameUtils.getBaseName(file.getName)
val imgFile = new File(FilenameUtils.removeExtension(file.getPath()) + thumbnailExtension)
val img = if ( imgFile.exists() ) {
new Image(imgFile.toURI().toString)
} else {
defaultImg
}
val imageView = new ImageView(img) {
preserveRatio = true
smooth = false
}
if (img.getWidth > 120) {
imageView.fitWidth = 120
}
if (img.getHeight > 120) {
imageView.fitHeight = 120
}
onMouseClicked = (e: MouseEvent) => new Thread() {
override def run() {
Seq(command, file.getPath).!
}
}.start()
styleClass.append("thumbnail")
children.addAll(
imageView,
new Label(baseName))
alignment = scalafx.geometry.Pos.TopCenter
}
示例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
}
}
}
}
示例3: 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"
})
}
}
示例4: 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"
})
}
}
示例5: 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
}