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

Scala VBox类代码示例

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

本文整理汇总了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
} 
开发者ID:hossshy,项目名称:bestiary,代码行数:51,代码来源:FileInfo.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: 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"
      })
  }
} 
开发者ID:rust-keylock,项目名称:rust-keylock-ui,代码行数:24,代码来源:Empty.scala


示例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"
      })
  }

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


示例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

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



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Scala duration类代码示例发布时间:2022-05-23
下一篇:
Scala EventFilter类代码示例发布时间: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