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

Scala HBox类代码示例

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

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



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


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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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