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

Scala PrimaryStage类代码示例

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

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



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

//设置package包名称以及导入依赖的类
import java.io.IOException
import javafx.{fxml => jfxf}
import javafx.{scene => jfxs}
import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene

object Main extends JFXApp {

  val resource = getClass.getResource("hello.fxml")
  if (resource == null) {
    throw new IOException("Cannot load resource: hello.fxml")
  }

  val root: jfxs.Parent = jfxf.FXMLLoader.load(resource)

  stage = new PrimaryStage() {
    title = "ScalaFX Sandbox"
    scene = new Scene(root)
  }
} 
开发者ID:Germanika,项目名称:ScalaFX-Sandbox,代码行数:23,代码来源:Main.scala


示例3: Gui

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

import java.io.{ File, FileInputStream }
import java.util.Properties

import scalafx.Includes._
import scalafx.application.JFXApp.PrimaryStage
import scalafx.application.{ JFXApp, Platform }
import scalafx.scene.Scene
import scalafx.scene.image.Image
import scalafx.scene.control._
import scalafx.scene.layout._
import scalafx.stage.WindowEvent

object Gui extends JFXApp {
  val commonProp = new Properties
  commonProp.load(new FileInputStream(new File("conf" + File.separator + "common.conf")))

  val dir = new File(commonProp.getProperty("directories.path"))
  val command = commonProp.getProperty("exec.path")

  val defaultImg = new Image(new File("conf" + File.separator + "no.jpg").toURI().toString)

  val rootPane = new BorderPane()
  val listPane = new FlowPane(10, 10)
  val scrollPane = new ScrollPane()
  scrollPane.setContent(listPane)
  listPane.prefWidth.bind(scrollPane.width)
  listPane.prefHeight.bind(scrollPane.height)
  scrollPane.styleClass.append("base")


  rootPane.setCenter(scrollPane)

  def scanFiles(dir: File): Unit = {
    val thumbnails = dir.listFiles.filter(f => f.isFile && !f.getName.matches(".*\\.jpg"))
    thumbnails.foreach { f => listPane.children.add(new FileInfo(f, command, ".jpg", defaultImg)) }
  }

  stage = new PrimaryStage {
    title = "Bestiary"
    scene = new Scene(rootPane, 1280, 768) {
      stylesheets.add("/strnet/main.css")
    }
    onCloseRequest = (we: WindowEvent) => Platform.exit()
  }

  println(dir + ":" + dir.exists())
  if ( dir.exists() && dir.isDirectory() ) {
    scanFiles(dir)
  }
} 
开发者ID:hossshy,项目名称:bestiary,代码行数:53,代码来源:Gui.scala


示例4: Ui

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

import org.rustkeylock.fragments.Empty
import org.rustkeylock.init.NativeInitializer
import org.slf4j.LoggerFactory

import com.typesafe.scalalogging.Logger

import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.image.Image
import scalafx.event.EventType
import scalafx.event.EventHandler
import scalafx.stage.WindowEvent
import scalafx.event.ActionEvent
import org.rustkeylock.utils.Defs
import org.rustkeylock.api.InterfaceWithRust
import scalafx.application.Platform

object Ui extends JFXApp {
  val Banner = """
                _        _              _            _    
 _ __ _   _ ___| |_     | | _____ _   _| | ___   ___| | __
| '__| | | / __| __|____| |/ / _ \ | | | |/ _ \ / __| |/ /
| |  | |_| \__ \ ||_____|   <  __/ |_| | | (_) | (__|   < 
|_|   \__,_|___/\__|    |_|\_\___|\__, |_|\___/ \___|_|\_\
                                  |___/                   

"""
  val logger = Logger(LoggerFactory.getLogger(this.getClass))
  logger.info(Banner)

  stage = new PrimaryStage {
    title = "rust-keylock"
    scene = new Empty()
    onCloseRequest = {
      new javafx.event.EventHandler[javafx.stage.WindowEvent] {
        def handle(ev: javafx.stage.WindowEvent): Unit = {
          InterfaceWithRust.INSTANCE.go_to_menu(Defs.MENU_EXIT)
          ev.consume()
        }
      }
    }
  }

  stage.getIcons.add(new Image("images/rkl-small.png"))
  Platform.implicitExit_=(false)
  
  NativeInitializer.init(stage)
} 
开发者ID:rust-keylock,项目名称:rust-keylock-ui,代码行数:51,代码来源:Ui.scala


示例5: ScalaFXHelloWorld

//设置package包名称以及导入依赖的类
package my.scalafx

import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafx.scene.layout.BorderPane
import scalafx.scene.paint.Color
import scalafx.scene.web.WebView

object ScalaFXHelloWorld extends JFXApp {

  val webView = new  WebView()
  webView.getEngine.loadContent(
    """
      <audio controls #player src="http://www.largesound.com/ashborytour/sound/AshboryBYU.mp3" preload="none">
        Your browser does not support the audio element.
      </audio>
      """
  )

  stage = new PrimaryStage {
    title = "ScalaFX Hello World"
    scene = new Scene {
      fill = Color.rgb(38, 38, 38)
      content = new BorderPane {
        center = webView
      }
    }

  }
} 
开发者ID:setrar,项目名称:scalaFX-html5-audio,代码行数:32,代码来源:ScalaFXHelloWorld.scala


示例6: Main

//设置package包名称以及导入依赖的类
package com.ruimo.forms

import javafx.{fxml => jfxf}
import javafx.{scene => jfxs}
import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene

object Main extends JFXApp {
  val resource = getClass.getResource("main.fxml")
  if (resource == null) {
    throw new RuntimeException("Cannot load resource: main.fxml")
  }

  {
    val loader = new jfxf.FXMLLoader(resource)
    val root: jfxs.Parent = loader.load()

    stage = new PrimaryStage() {
      title = "Form Builder"
      scene = new Scene(root)
    }

    val controller: MainController = loader.getController().asInstanceOf[MainController]
    controller.setStage(stage);
  }
} 
开发者ID:ruimo,项目名称:formBuilder,代码行数:29,代码来源:Main.scala


示例7: JasyptUi

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

import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafx.scene.image.Image
import scalafxml.core.{FXMLView, NoDependencyResolver}


object JasyptUi extends JFXApp {
  val resource = getClass.getResource("JasyptUi.fxml")

  val root = FXMLView(resource, NoDependencyResolver)

  stage = new PrimaryStage() {
    title = "Jasypt Encrypt/Decrypt Tool"
    scene = new Scene(root)
  }

  stage.setMinHeight(500)
  stage.setMinWidth(720)

  stage.icons.add(new Image("saru.png"))
} 
开发者ID:utkuozdemir,项目名称:jasypt-ui,代码行数:26,代码来源:JasyptUi.scala


示例8: App

//设置package包名称以及导入依赖的类
package de.m7w3.signal

import java.security.Security

import de.m7w3.signal.controller.{DeviceRegistration, UnlockDB}
import org.whispersystems.libsignal.logging.SignalProtocolLoggerProvider

import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene

object App {
  val NAME = "signal-desktop"
  val VERSION = "0.0.1"
  val AUTHOR = "motherflippers"
}

object Main extends JFXApp {
  Security.insertProviderAt(new org.bouncycastle.jce.provider.BouncyCastleProvider(), 1)
  SignalProtocolLoggerProvider.setProvider(new ProtocolLogger())


  val signalDesktopConfig = Config.optionParser.parse(parameters.raw, Config.SignalDesktopConfig())
  signalDesktopConfig.foreach { config =>
    val ctxBuilder = ContextBuilder(config)
    val root = if (ctxBuilder.profileDirExists && ctxBuilder.profileIsInitialized) {
      UnlockDB(ctxBuilder)
    } else {
      // show welcome and registration screen
      DeviceRegistration.load(ctxBuilder)
    }
    stage = new PrimaryStage {
      title = "Welcome"
      scene = new Scene(root)
    }
  }

  override def stopApp(): Unit = {
    // cleanup shit
    ApplicationContext.getCurrent.foreach(_.close())
    println("bye!")
    super.stopApp()
  }
} 
开发者ID:ayoub-benali,项目名称:signal-desktop-client,代码行数:45,代码来源:Main.scala


示例9: Bozzy

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

import java.io.FileNotFoundException

import bozzy.controllers.MainDictionary

import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafx.scene.input.{TransferMode, DragEvent}
import scalafx.scene.text.Font
import scalafxml.core.{NoDependencyResolver, FXMLLoader}


object Bozzy extends JFXApp {
  Font.loadFont(
    getClass.getResource("/fonts/symbola_hint_8.ttf").toExternalForm,
    14
  )
  val main = getClass.getResource("/view/Main.fxml")
  if (main == null) {
    throw new FileNotFoundException("Cannot load resource: /view/Main.fxml")
  }
  val loader = new FXMLLoader(main, NoDependencyResolver) {
    setResources(I18n.i18n)
  }
  val root = loader.load[javafx.scene.Parent]

  stage = new PrimaryStage() {
    title = I18n.i18n.getString("applicationTitle")
    scene = new Scene(root) {
      stylesheets = List(getClass.getResource("/css/style.css").toExternalForm)
      onDragOver = (event: DragEvent) => {
        if (event.dragboard.hasFiles) {
          event acceptTransferModes TransferMode.COPY
        }
        event.consume
      }
      onDragDropped = (event: DragEvent) => {
        if (event.dragboard.hasFiles) {
          event.dragboard.files foreach (file => {
            file.getAbsolutePath.split('.').last.toLowerCase match {
              case "rtf" | "json" => {
                MainDictionary.addDictionary(file.getAbsolutePath)
                event.dropCompleted = true
              }
              case _ => event.dropCompleted = false
            }
          })
        }
        event.consume
      }
    }
  }
} 
开发者ID:morinted,项目名称:Bozzy,代码行数:57,代码来源:Bozzy.scala


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


示例11: Main

//设置package包名称以及导入依赖的类
package hatanas.browser

import javafx.scene.Parent

import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafxml.core.{FXMLLoader, FXMLView, NoDependencyResolver}


object Main extends JFXApp {

    val resource = getClass.getResource("SimpleBrowser.fxml")
    val loader = new FXMLLoader(resource, NoDependencyResolver)
    loader.load()
    val root = loader.getRoot[Parent]
    val controller = loader.getController[BrowserControllerInitializable]
    controller.initialize(parameters.raw.applyOrElse(0, (n: Int) => "404.html"))

    stage = new PrimaryStage() {
        title = "Simple Browser"
        scene = new Scene(root)
    }
} 
开发者ID:Hatanas,项目名称:SimpleBrowser,代码行数:26,代码来源:Main.scala


示例12: Main

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

import java.io.IOException
import scalafx.Includes._
import scalafx.application.JFXApp
import scalafx.application.JFXApp.PrimaryStage
import scalafx.scene.Scene
import scalafxml.core.{NoDependencyResolver, FXMLView}

object Main extends JFXApp {
  val fxmlFile = "View.fxml"

  val resource = getClass.getClassLoader.getResource(fxmlFile)
  if (resource == null) {
    throw new IOException("Cannot load resource: " + fxmlFile)
  }

  val root = FXMLView(resource, NoDependencyResolver)

  stage = new PrimaryStage() {
    title = "Graph Visualizer"
    scene = new Scene(root)
  }

} 
开发者ID:lmdexpr,项目名称:graph-visualizer,代码行数:26,代码来源:Main.scala



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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