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

Scala Font类代码示例

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

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



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

示例1: GameOver

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

import java.awt.Color
import java.awt.Font

package object bubbles {
  
  val SCREEN_HEIGHT = 600
  val SCREEN_WIDTH  = 800

  val NUM_CIRCLES           = 10
  val CIRCLE_DIAMETER       = 40
  val SPACE_BETWEEN_CIRCLES = 72
  val INITIAL_SPACE         = 40
  val CIRCLE_FONT           = new Font("Sans Serif", Font.BOLD, 22)
  val CIRCLE_FONT_PADDING_X = 13
  val CIRCLE_FONT_PADDING_Y = 28

  val APPLICATION_NAME        = "Akka Actors 'Kill The Characters' Game"
  val ACTOR_SYSTEM_NAME       = "TinyBubbles"
  val BUBBLE_PANEL_ACTOR_NAME = "bubblePanelActor"
  val MAIN_FRAME_ACTOR_NAME   = "mainFrameActor"
  val KEY_LISTENER_ACTOR_NAME = "keyListenerActor"
  val PLAY_SOUND_ACTOR_NAME   = "playSoundActor"
  val ACTOR_MANAGER_NAME      = "actorManager"

  val COLORS = Array(
      (Color.WHITE, Color.BLUE), 
      (Color.BLACK, Color.CYAN), 
      (Color.BLACK, Color.GREEN), 
      (Color.BLACK, Color.LIGHT_GRAY), 
      (Color.WHITE, Color.MAGENTA),
      (Color.WHITE, Color.ORANGE), 
      (Color.WHITE, Color.PINK), 
      (Color.WHITE, Color.RED), 
      (Color.BLACK, Color.WHITE), 
      (Color.BLACK, Color.YELLOW))

  // actor messages
  case object GameOver

} 
开发者ID:arunhprasadbh,项目名称:AkkaKillTheCharactersGame,代码行数:43,代码来源:package.scala


示例2: PremiseView

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

import java.awt.{Toolkit, BorderLayout, Dimension, Font}
import javax.swing._


class PremiseView(premise: String = "") extends JFrame {
  private val premisePanel = new JPanel()
  private var graphPanel: ResultPanel = null

  config
  configInput
  start

  private def start = {
    val screenSize = Toolkit.getDefaultToolkit.getScreenSize
    setSize(new Dimension(
      (screenSize.getWidth * .60).toInt,
      (screenSize.getHeight * .60).toInt))
    setLocationRelativeTo(null)
    setVisible(true)
  }

  private def config = {
    setLayout(new BorderLayout())
    add(premisePanel, BorderLayout.NORTH)
    setIconImage(new ImageIcon("resources/icon.png").getImage)
    setTitle(s"Premise View")
  }

  private def configInput = {
    val premiseLabel = new JLabel()
    val font = premiseLabel.getFont()
    val boldFont = new Font(font.getFontName(), Font.BOLD, font.getSize())
    premiseLabel.setFont(boldFont)
    premiseLabel.setText(premise)

    premisePanel.add(premiseLabel)

    graphPanel = new ResultPanel(premise)
    getContentPane.add(graphPanel)
    getContentPane.repaint()
    getContentPane.validate()
  }

} 
开发者ID:mariohd,项目名称:LogicCompiler,代码行数:47,代码来源:PremiseView.scala


示例3: Fonte

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

import br.edu.ifrn.potigol.Potigolutil.{ Inteiro, Real, Texto }
import java.awt.Font

object Fonte {

}

case class Fonte(tamanho: Inteiro) {
  private[this] val font = new Font("Dialog", Font.BOLD, tamanho);

  def desenhe_centralizado(msg: Texto, x: Real, y: Real, z: Inteiro, c: Cor) = {
    Desenho.incluir(z, g => {
      g.setColor(c.color)
      g.setFont(font)
      val largura = g.getFontMetrics.stringWidth(msg)
      val altura = g.getFontMetrics.getHeight
      g.drawString(msg, x.toInt - largura / 2, y.toInt - altura / 2)
    })

  }

  def desenhe(msg: Texto, x: Real, y: Real, z: Inteiro, c: Cor) = {
    Desenho.incluir(z, g => {
      g.setColor(c.color)
      g.setFont(font)
      g.drawString(msg, x.toInt, y.toInt)
    })
  }
} 
开发者ID:potigol,项目名称:Jerimum,代码行数:32,代码来源:Fonte.scala


示例4: JawaSyntaxHighlighter

//设置package包名称以及导入依赖的类
package org.argus.cit.intellij.jawa.highlighter

import java.awt.Font
import java.util

import com.intellij.lexer.Lexer
import com.intellij.openapi.editor.colors.TextAttributesKey
import com.intellij.openapi.editor.markup.TextAttributes
import com.intellij.openapi.fileTypes.SyntaxHighlighterBase
import com.intellij.psi.tree.IElementType
import org.argus.cit.intellij.jawa.lang.lexer.{JawaLexerAdapter, JawaTokenTypes}


object JawaSyntaxHighlighter extends SyntaxHighlighterBase {

  final val BOLD = new TextAttributes(null, null, null, null, Font.BOLD)
  final val ITALIC = new TextAttributes(null, null, null, null, Font.ITALIC)
  final val BOLD_ITALIC = TextAttributes.merge(BOLD, ITALIC)

  private final val ATTRIBUTES: util.HashMap[IElementType, TextAttributesKey] = new util.HashMap
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.LINE_COMMENTS, DefaultHighlighter.LINE_COMMENT)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.BLOCK_COMMENTS, DefaultHighlighter.BLOCK_COMMENT)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.DOC_COMMENTS, DefaultHighlighter.DOC_COMMENT)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.KEYWORDS, DefaultHighlighter.KEYWORD)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.NUMBERS, DefaultHighlighter.NUMBER)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.STRINGS, DefaultHighlighter.STRING)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.BRACKETS, DefaultHighlighter.BRACKETS)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.BRACES, DefaultHighlighter.BRACES)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.PARENTESES, DefaultHighlighter.PARENTHESES)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.ASSIGN_OP, DefaultHighlighter.ASSIGN)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.SEMICOLON, DefaultHighlighter.SEMICOLON)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.DOT, DefaultHighlighter.DOT)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.COMMA, DefaultHighlighter.COMMA)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.BAD_CHARACTER, DefaultHighlighter.BAD_CHARACTER)
  SyntaxHighlighterBase.fillMap(ATTRIBUTES, JawaTokenTypes.ANNOTATION, DefaultHighlighter.ANNOTATION)

  override def getTokenHighlights(iElementType: IElementType): Array[TextAttributesKey] = {
    SyntaxHighlighterBase.pack(ATTRIBUTES.get(iElementType))
  }

  override def getHighlightingLexer: Lexer = new JawaLexerAdapter
} 
开发者ID:arguslab,项目名称:argus-cit-intellij,代码行数:43,代码来源:JawaSyntaxHighlighter.scala


示例5: CountByRatingChart

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

import scala.collection.immutable.ListMap
import scalax.chart.module.ChartFactories
import java.awt.Font
import org.jfree.chart.axis.CategoryLabelPositions


object CountByRatingChart {

  def main(args: Array[String]) {
    val rating_data_raw = Util.sc.textFile("../../data/ml-100k/u.data")
    val rating_data = rating_data_raw.map(line => line.split("\t"))
    val ratings = rating_data.map(fields => fields(2).toInt)
    val ratings_count = ratings.countByValue()

    val sorted =  ListMap(ratings_count.toSeq.sortBy(_._1):_*)
    val ds = new org.jfree.data.category.DefaultCategoryDataset
    sorted.foreach{ case (k,v) => ds.addValue(v,"Rating Values", k)}

    val chart = ChartFactories.BarChart(ds)
    val font = new Font("Dialog", Font.PLAIN,5);

    chart.peer.getCategoryPlot.getDomainAxis().
      setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    chart.peer.getCategoryPlot.getDomainAxis.setLabelFont(font)
    chart.show()
    Util.sc.stop()
  }
} 
开发者ID:PacktPublishing,项目名称:Machine-Learning-with-Spark-Second-Edition,代码行数:31,代码来源:CountByRatingChart.scala


示例6: UserOccupationChart

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

import scala.collection.immutable.ListMap
import scalax.chart.module.ChartFactories
import java.awt.Font
import org.jfree.chart.axis.CategoryLabelPositions


object UserOccupationChart {

  def main(args: Array[String]) {
    val user_data = Util.getUserData()
    val user_fields = user_data.map(l => l.split("\\|"))
    val count_by_occupation = user_fields.map( fields => (fields(3), 1)).
      reduceByKey( (x, y) => x + y).collect()
    println(count_by_occupation)

    val sorted =  ListMap(count_by_occupation.toSeq.sortBy(_._2):_*)
    val ds = new org.jfree.data.category.DefaultCategoryDataset
    sorted.foreach{ case (k,v) => ds.addValue(v,"UserAges", k)}

    val chart = ChartFactories.BarChart(ds)
    val font = new Font("Dialog", Font.PLAIN,5);

    chart.peer.getCategoryPlot.getDomainAxis().
      setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    chart.peer.getCategoryPlot.getDomainAxis.setLabelFont(font)
    chart.show()
    Util.sc.stop()
  }
} 
开发者ID:PacktPublishing,项目名称:Machine-Learning-with-Spark-Second-Edition,代码行数:32,代码来源:UserOccupationChart.scala


示例7:

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

import java.awt.Font

import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession
import org.apache.spark.sql.types.{IntegerType, StructField, StructType}
import org.jfree.chart.axis.CategoryLabelPositions

import scalax.chart.module.ChartFactories



    val customSchema = StructType(Array(
      StructField("user_id", IntegerType, true),
      StructField("movie_id", IntegerType, true),
      StructField("rating", IntegerType, true),
      StructField("timestamp", IntegerType, true)))

    val spConfig = (new SparkConf).setMaster("local").setAppName("SparkApp")
    val spark = SparkSession
      .builder()
      .appName("SparkRatingData").config(spConfig)
      .getOrCreate()

    val rating_df = spark.read.format("com.databricks.spark.csv")
      .option("delimiter", "\t").schema(customSchema)
      .load("../../data/ml-100k/u.data")

    val rating_df_count = rating_df.groupBy("rating").count().sort("rating")
    //val rating_df_count_sorted = rating_df_count.sort("count")
    rating_df_count.show()
    val rating_df_count_collection = rating_df_count.collect()

    val ds = new org.jfree.data.category.DefaultCategoryDataset
    val mx = scala.collection.immutable.ListMap()

    for( x <- 0 until rating_df_count_collection.length) {
      val occ = rating_df_count_collection(x)(0)
      val count = Integer.parseInt(rating_df_count_collection(x)(1).toString)
      ds.addValue(count,"UserAges", occ.toString)
    }


    //val sorted =  ListMap(ratings_count.toSeq.sortBy(_._1):_*)
    //val ds = new org.jfree.data.category.DefaultCategoryDataset
    //sorted.foreach{ case (k,v) => ds.addValue(v,"Rating Values", k)}

    val chart = ChartFactories.BarChart(ds)
    val font = new Font("Dialog", Font.PLAIN,5);

    chart.peer.getCategoryPlot.getDomainAxis().
      setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    chart.peer.getCategoryPlot.getDomainAxis.setLabelFont(font)
    chart.show()
    Util.sc.stop()
  }
} 
开发者ID:PacktPublishing,项目名称:Machine-Learning-with-Spark-Second-Edition,代码行数:59,代码来源:CountByRatingChart.scala


示例8: UserOccupationChart

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

import java.awt.Font

import org.jfree.chart.axis.CategoryLabelPositions

import scalax.chart.module.ChartFactories


object UserOccupationChart {

  def main(args: Array[String]) {
    val userDataFrame = Util.getUserFieldDataFrame()
    val occupation = userDataFrame.select("occupation")
    val occupation_groups = userDataFrame.groupBy("occupation").count()
    //occupation_groups.show()
    val occupation_groups_sorted = occupation_groups.sort("count")
    occupation_groups_sorted.show()
    val occupation_groups_collection = occupation_groups_sorted.collect()

    val ds = new org.jfree.data.category.DefaultCategoryDataset
    val mx = scala.collection.immutable.ListMap()

    for( x <- 0 until occupation_groups_collection.length) {
      val occ = occupation_groups_collection(x)(0)
      val count = Integer.parseInt(occupation_groups_collection(x)(1).toString)
      ds.addValue(count,"UserAges", occ.toString)
    }

    val chart = ChartFactories.BarChart(ds)
    val font = new Font("Dialog", Font.PLAIN,5);

    chart.peer.getCategoryPlot.getDomainAxis().
      setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    chart.peer.getCategoryPlot.getDomainAxis.setLabelFont(font)
    chart.show()
    Util.sc.stop()
  }
} 
开发者ID:PacktPublishing,项目名称:Machine-Learning-with-Spark-Second-Edition,代码行数:40,代码来源:UserOccupationChart.scala


示例9: PlotLogData

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

//import org.sparksamples.Util

//import _root_.scalax.chart.ChartFactories
import java.awt.Font

import org.jfree.chart.axis.CategoryLabelPositions

import scala.collection.immutable.ListMap
import scalax.chart.module.ChartFactories



object PlotLogData {

  def main(args: Array[String]) {
    val records = Util.getRecords()._1
    val records_x = records.map(r => Math.log(r(r.length -1).toDouble))
    var records_int = new Array[Int](records_x.collect().length)
    print(records_x.first())
    val records_collect = records_x.collect()

    for (i <- 0 until records_collect.length){
      records_int(i) = records_collect(i).toInt
    }
    val min_1 = records_int.min
    val max_1 = records_int.max

    val min = min_1.toFloat
    val max = max_1.toFloat
    val bins = 10
    val step = (max/bins).toFloat

    var mx = Map(0.0.toString -> 0)
    for (i <- step until (max + step) by step) {
      mx += (i.toString -> 0);
    }

    for(i <- 0 until records_collect.length){
      for (j <- 0.0 until (max + step) by step) {
        if(records_int(i) >= (j) && records_int(i) < (j + step)){
          mx = mx + (j.toString -> (mx(j.toString) + 1))
        }
      }
    }
    val mx_sorted = ListMap(mx.toSeq.sortBy(_._1.toFloat):_*)
    val ds = new org.jfree.data.category.DefaultCategoryDataset
    var i = 0
    mx_sorted.foreach{ case (k,v) => ds.addValue(v,"", k)}

    val chart = ChartFactories.BarChart(ds)
    val font = new Font("Dialog", Font.PLAIN,4);

    chart.peer.getCategoryPlot.getDomainAxis().
      setCategoryLabelPositions(CategoryLabelPositions.UP_90);
    chart.peer.getCategoryPlot.getDomainAxis.setLabelFont(font)
    chart.show()
    Util.sc.stop()
  }
} 
开发者ID:PacktPublishing,项目名称:Machine-Learning-with-Spark-Second-Edition,代码行数:62,代码来源:PlotLogData.scala


示例10: Pi

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

import java.awt.{AlphaComposite, Color, Font, RenderingHints}
import java.awt.image.BufferedImage
import java.io.File
import javax.imageio.ImageIO
import scala.io.Source

object Pi {
  private val Rows = 500
  private val Cols = 2000
  private val Watermark = "?"

  def main(args: Array[String]): Unit = {
    val lines = Source.fromFile("pi-formatted.txt").getLines

    // Calculate width and height of single row of digits.
    val font = new Font("Source Code Pro", Font.PLAIN, 10)
    var gr = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics()
    val (width, height) = try {
      gr.setFont(font)
      val metrics = gr.getFontMetrics
      (metrics.stringWidth("0" * Cols), metrics.getHeight * Rows)
    } finally
      gr.dispose()

    val image = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB)

    // Render all digits.
    gr = image.createGraphics()
    gr.setRenderingHint(RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY)
    gr.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON)
    gr.setRenderingHint(RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY)
    gr.setRenderingHint(RenderingHints.KEY_DITHERING, RenderingHints.VALUE_DITHER_ENABLE)
    gr.setRenderingHint(RenderingHints.KEY_FRACTIONALMETRICS, RenderingHints.VALUE_FRACTIONALMETRICS_ON)
    gr.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR)
    gr.setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY)
    gr.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE)
    gr.setFont(font)
    gr.setColor(Color.BLACK)
    lines.foldLeft(0) { (r, line) =>
      gr.drawString(line, 0, (r + 1) * gr.getFontMetrics.getAscent)
      r + 1
    }

    // Render the Pi symbol overlay.
    gr.setFont(new Font("Symbol", Font.PLAIN, 6000))
    gr.setColor(Color.BLUE)
    gr.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.8F))
    val bounds = gr.getFontMetrics.getStringBounds(Watermark, gr)
    val x = (width - bounds.getWidth) / 2
    val y = -bounds.getY - (height - bounds.getHeight) / 2
    gr.drawString(Watermark, x.toInt, y.toInt)
    gr.dispose()

    ImageIO.write(image, "PNG", new File("pi-poster.png"))
  }
} 
开发者ID:davidledwards,项目名称:huge-pi,代码行数:59,代码来源:Pi.scala


示例11: ChangeModes

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

import java.awt.Font

import colors.ThemeSettings._
import de.sciss.syntaxpane.DefaultSyntaxKit
import textengine.Cluster

object ChangeModes {

  def changeFontsToSliderValue(newSize: Int, cluster: Cluster) = {
    cluster.editor.font =
      new Font(cluster.vars.font_style, java.awt.Font.PLAIN, newSize)
    cluster.info.text = s"Font size is set to $newSize"
    newSize
  }

  def goToEditorMode(cluster: Cluster) = {
    val txt = cluster.editor.text
    val syntaxConfig = DefaultSyntaxKit.getConfig(classOf[DefaultSyntaxKit])
    syntaxConfig.put(
        "DefaultFont",
        cluster.vars.font_style + " " + cluster.vars.font_size.toString)
    cluster.editor.contentType = "text/" + cluster.const.AVAILABLE_SYNTAX(
          "Scala")
    cluster.editor.text = txt
    setThemeForEditorMode(cluster)
    cluster.vars.mode = false
    cluster.info.text = "You are now in the text editor mode"
  }

  def goToNotepadMode(cluster: Cluster) = {
    val txt = cluster.editor.text
    cluster.editor.contentType = "text/plain"
    setEditorTheme(cluster, cluster.vars.theme)
    cluster.editor.text = txt
    cluster.vars.mode = true
    cluster.info.text = "You are now in the notepad mode"
  }

  def changeSyntax(lang: String, cluster: Cluster) = {
    goToEditorMode(cluster)
    val availableSyntax = cluster.const.AVAILABLE_SYNTAX
    val txt = cluster.editor.text
    if (availableSyntax.keys.exists(_ == lang)) {
      cluster.editor.contentType = "text/" + availableSyntax(lang)
      cluster.editor.text = txt
      cluster.info.text = s"You updated the syntax to $lang"
    } else {
      cluster.info.text = s"Can not find syntax pack for $lang"
    }
  }

} 
开发者ID:billpcs,项目名称:lithepad,代码行数:55,代码来源:ChangeModes.scala


示例12: Misc

//设置package包名称以及导入依赖的类
// scalac -deprecation Misc.scala

import scala.annotation.unchecked._
import java.awt.Font
import java.awt.Font._

object Misc {
  @deprecated(message = "Use factorial(n: BigInt) instead")
  def factorial(n: Int): Int = if (n <= 0) 1 else n * factorial(n - 1)
    // Recursive call causes a deprecation warning 
  def draw(@deprecatedName('sz) size: Int, style: Int = PLAIN) {
    val font = new Font("Dialog", style, size)
    // ...
  }

  draw(sz = 12)

  def process(lst: List[Int]) = 
    (lst: @unchecked) match {
      case head :: tail => head + tail.length
    }
}

trait Comparable[-T] extends 
  java.lang.Comparable[T @uncheckedVariance] 
开发者ID:yeahnoob,项目名称:scala-impatient-2e-code,代码行数:26,代码来源:Misc.scala


示例13: WindowGraph

//设置package包名称以及导入依赖的类
package aug.script.test

import java.awt.Font

import aug.script.framework._

class WindowGraph extends AbstractClient {
  var profile : ProfileInterface = _
  var console : TextWindowInterface = _
  var com : TextWindowInterface = _
  var metric : TextWindowInterface = _

  override def init(profileInterface: ProfileInterface, reloadData: ReloadData): Unit = {
    profile = profileInterface
    console = profile.getTextWindow("console")
    com = profile.createTextWindow("com")
    metric = profile.createTextWindow("metric")

    val graph = new SplitWindow(
      new WindowReference("console"),
      new SplitWindow(
        new WindowReference("com"),
        new WindowReference("metric"),
        false, 0.8f
      ),
      true)

    metric.setSplittable(false)
    metric.setHighlightable(false)
    com.setTextFont(new Font("Courier", 0, 36))
    com.setTopColorScheme("bright")

    profile.setWindowGraph(graph)

    com.echo("hello")
    com.echo("hello2")
    com.setLine(10, "line ten")
    com.setLine(8, "line ten")
    metric.echo("100 xpm")
  }

  override def handleCommand(cmd: String): Boolean = {
    cmd match {
      case "clear" =>
        metric.clear()
        true

      case "unsplit" =>
        console.unsplit()
        true

      case "split" =>
        console.split()
        true

      case none => false
    }
  }

} 
开发者ID:austinmiller,项目名称:augustmc,代码行数:61,代码来源:WindowGraph.scala


示例14: MyFont

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

import java.awt.Font

object MyFont {
  private[this] lazy val _initFont: Font = {
    val url = getClass.getResource("/OpenSans-CondLight.ttf")
    require(url != null)
    val is = url.openStream()
    val res = Font.createFont(Font.TRUETYPE_FONT, is)
    is.close()
    res
  }

  private[this] var _condensedFont: Font = _

  def apply(): Font = {
    if (_condensedFont == null) _condensedFont = _initFont
    _condensedFont
  }

  def apply(size: Float): Font = apply().deriveFont(size)
} 
开发者ID:Sciss,项目名称:Schwaermen,代码行数:24,代码来源:MyFont.scala


示例15: Colors

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

import java.awt.{ Color => aColor }
import java.awt.Font
import scala.swing.Swing
import java.awt.{Color => aColor}

object Colors {
  val bluish = new aColor(32, 178, 170)
  val brownLight = new aColor(140, 137, 132)
  val magenta = new aColor(255, 0, 255)
  val indigo = new aColor(75, 0, 130)
  val white = new aColor(255, 255, 255)
  val black = new aColor(0, 0, 0)
  val orange = new aColor(255, 102, 0)
  val yellow = new aColor(255, 255, 0)
  val hiri = new aColor(102, 102, 102)
  val blue = new aColor(0, 51, 102)
  val violet = new aColor(238, 130, 238)
  val plum = new aColor(221, 160, 221)
  val lightbr = new aColor(255, 255, 153)
  val pink = new aColor(216,191,216)
}

object Fonts {
  val thefont = new Font("Verdana", Font.BOLD, 14)
  val tafont = new Font("Verdana", Font.CENTER_BASELINE, 11)
  val bluishborder = Swing.LineBorder(Colors.bluish)
} 
开发者ID:ternava,项目名称:Variability-CChecking,代码行数:30,代码来源:Colors.scala


示例16: font1

//设置package包名称以及导入依赖的类
package de.huberlin.informatik.promi.visualize

import java.awt.Font
import scalax.chart.Chart
import org.jfree.ui.RectangleEdge
import java.awt.Color
import org.jfree.chart.plot.XYPlot

trait ChartLayout {

  def font1: Font
  def font2: Font
  def fontBold : Font
  def position : RectangleEdge

  def layoutChart(chart: Chart): Unit = {
    chart.peer.getLegend.setItemFont(font1)
    chart.peer.getLegend.setPosition(position)

    chart.peer.getTitle.setFont(fontBold)
    
    val plot = chart.plot.asInstanceOf[XYPlot]
    plot.getRenderer.setBaseItemLabelFont(font2)

    plot.setBackgroundPaint(Color.WHITE)
    plot.getDomainAxis.setTickLabelFont(font1)
    plot.getDomainAxis.setLabelFont(font1)
    plot.getRangeAxis.setTickLabelFont(font1)
    plot.getRangeAxis.setLabelFont(font1)
  }
}

object PresentationLayout extends ChartLayout {
  val font1 = new Font("Dialog", Font.PLAIN, 30)
  val font2 = new Font("Dialog", Font.PLAIN, 24)
  val fontBold = new Font("Dialog", Font.BOLD, 30)
  val position = RectangleEdge.BOTTOM
}

object PaperLayout extends ChartLayout {
  val font1 = new Font("Dialog", Font.PLAIN, 24)
  val font2 = new Font("Dialog", Font.PLAIN, 20)
  val fontBold = new Font("Dialog", Font.BOLD, 24)
   val position = RectangleEdge.RIGHT
} 
开发者ID:data-experts,项目名称:predictive_monitoring,代码行数:46,代码来源:ChartLayout.scala


示例17: PanelPuntos

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

import scala.swing.Panel
import java.awt.Graphics2D
import java.awt.Color
import culebrita.mundo.Tablero
import java.awt.BasicStroke
import java.awt.Stroke
import scala.swing.Label
import scala.swing.FlowPanel
import java.awt.Font
import scala.swing.GridPanel
import javax.swing.border.Border
import scala.swing.Swing

class PanelPuntos(val tablero: Tablero, val borde: Int) extends GridPanel(1, 2) {
  background = Color.decode("#B2BF1F")
  border = Swing.EmptyBorder(3)

  var labPuntos = new Label() {
    text = "Puntos: 000"
    font = new Font("Press Start 2P", java.awt.Font.BOLD, 18)
    foreground = Color.decode("#6B5E0B")
    border = Swing.EmptyBorder(2)
  }

  var labTop = new Label() {
    text = "Top: 000"
    font = new Font("Press Start 2P", java.awt.Font.BOLD, 18)
    foreground = Color.decode("#6B5E0B")
    border = Swing.EmptyBorder(2)
  }

  contents += labPuntos
  contents += labTop

  def actualizarPuntos(puntos: Int) {
    labPuntos.text = f"Puntos: $puntos%03d"
  }
} 
开发者ID:ncardozo,项目名称:scalakids,代码行数:41,代码来源:PanelPuntos.scala


示例18: PeriodicTable

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

import java.awt.{Font, BasicStroke, Color, Rectangle}

import atom.Atom

import scala.swing._
import scala.swing.event.MouseClicked


class PeriodicTable extends Panel {
  private var _value:Atom = Atom.C
  def value = _value
  def value_=(v:Atom) = {
    _value = v
    peer.paintImmediately(new Rectangle(size))
  }
  override def paint(graphics : Graphics2D): Unit = {
    val font:Font = new Font("Arial", Font.BOLD, 16)
    graphics.setFont(font)
    val fontMetrics = graphics.getFontMetrics
    for (atom:Atom <- Atom.atoms) {
      val left = (atom.group - 1) * size.width / 18
      val top = (atom.period - 1) * size.height / 5
      val right = atom.group * size.width/18
      val bottom = atom.period * size.height/5
      graphics.setPaint(atom.color)
      graphics.setStroke(new BasicStroke(1))
      graphics.fillRect(left, top, right-left, bottom-top)
      graphics.setPaint(Color.BLACK)
      graphics.drawString(
        atom.symbol,
        left+(size.width/18-fontMetrics.stringWidth(atom.symbol))/2,
        bottom-(size.height/5-fontMetrics.getAscent())/2)
      if (_value == atom) {
        graphics.setStroke(new BasicStroke(4))
        graphics.drawLine(left+2, top+2, right-2, top+2)
        graphics.drawLine(left+2, top+2, left+2, bottom-2)
        graphics.drawLine(left+2, bottom-2, right-2, bottom-2)
        graphics.drawLine(right-2, top+2, right-2, bottom-2)
      }
    }
  }
  listenTo(mouse.clicks, mouse.moves, mouse.wheel)
  reactions += {
    case event: MouseClicked => {
      val group = event.point.x / (size.width / 18) + 1
      val period = event.point.y / (size.height / 5) + 1
      value = Atom(group, period) match {
        case Some(atom) => atom
        case None => value
      }
    }
  }
  preferredSize = new Dimension(400, 200)
  maximumSize = new Dimension(800,200)
} 
开发者ID:ReactionMap,项目名称:RMapViewerS,代码行数:58,代码来源:PeriodicTable.scala



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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