本文整理汇总了Scala中java.awt.BorderLayout类的典型用法代码示例。如果您正苦于以下问题:Scala BorderLayout类的具体用法?Scala BorderLayout怎么用?Scala BorderLayout使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了BorderLayout类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Scala代码示例。
示例1: ResultPanel
//设置package包名称以及导入依赖的类
package ui.premiseView
import java.awt.BorderLayout
import javax.swing.{JPanel, JTabbedPane}
import compiler.Parser
class ResultPanel(expression: String) extends JPanel {
private val tokens = Parser.tokenizer(expression)
private val ast = Parser.generateAST(tokens)
private val tabbedPane = new JTabbedPane
private val graphPanel = new GraphTab(ast, tokens)
private val tokensPanel = new TokensTab(tokens)
private val truthTablePanel = new TruthTableTab(ast, tokens)
start
private def start = {
setLayout(new BorderLayout())
tabbedPane.add("Expression Graph", graphPanel)
tabbedPane.add("Expression Tokens", tokensPanel)
tabbedPane.add("Truth Table", truthTablePanel)
this.add(tabbedPane, BorderLayout.CENTER)
}
}
示例2: TokensTab
//设置package包名称以及导入依赖的类
package ui.premiseView
import java.awt.{BorderLayout, FlowLayout}
import javax.swing.table.AbstractTableModel
import javax.swing.{JLabel, JPanel, JScrollPane, JTable}
import structure._
class TokensTab(tokens: List[Token]) extends JPanel {
private val statusBar = new JPanel(new FlowLayout(FlowLayout.LEFT))
start
draw
private def start = {
setLayout(new BorderLayout())
}
private def draw: Unit = {
val dataModel = new AbstractTableModel() {
private val _tokens = tokens
override def getColumnName(i: Int): String = {
i match {
case 0 => "Category"
case 1 => "Value"
}
}
def getColumnCount: Int = 2
def getRowCount: Int = _tokens.size
def getValueAt(row: Int, col: Int): Object = {
col match {
case 0 => _tokens.lift(row).get.category
case 1 => _tokens.lift(row).get.value
}
}
}
val table = new JTable(dataModel)
add(new JScrollPane(table), BorderLayout.CENTER)
statusBar.add(new JLabel(s"Total: ${tokens.size}"))
add(statusBar, BorderLayout.SOUTH)
}
}
示例3: 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()
}
}
示例4: ApkInfoPanel
//设置package包名称以及导入依赖的类
package org.argus.cit.intellij.android.infoViewer
import java.awt.BorderLayout
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.DataProvider
import com.intellij.openapi.editor.impl.EditorFactoryImpl
import com.intellij.openapi.editor.{Editor, EditorFactory}
import com.intellij.openapi.project.Project
import com.intellij.openapi.ui.SimpleToolWindowPanel
import com.intellij.ui.content.Content
import com.intellij.util.DocumentUtil
abstract class ApkInfoPanel(project: Project, content: Content) extends SimpleToolWindowPanel(false, true) with DataProvider with Disposable {
private val factory = EditorFactory.getInstance()
private val doc = factory.asInstanceOf[EditorFactoryImpl].createDocument("", true, false)
doc.setReadOnly(true)
private val myEditor: Editor = factory.createEditor(doc, project)
private val settings = myEditor.getSettings
settings.setLineMarkerAreaShown(false)
settings.setIndentGuidesShown(false)
settings.setLineNumbersShown(true)
settings.setFoldingOutlineShown(false)
myEditor.setBorder(null)
add(myEditor.getComponent, BorderLayout.CENTER)
def setText(info: String) = {
DocumentUtil.writeInRunUndoTransparentAction(new Runnable {
override def run(): Unit = {
val fragmentDoc = myEditor.getDocument
fragmentDoc.setReadOnly(false)
fragmentDoc.replaceString(0, fragmentDoc.getTextLength, info)
fragmentDoc.setReadOnly(true)
}
})
}
def getText: String = myEditor.getDocument.getText()
override def dispose(): Unit = EditorFactory.getInstance().releaseEditor(myEditor)
}
示例5: Window
//设置package包名称以及导入依赖的类
import java.awt.BorderLayout
import java.awt.BorderLayout.{CENTER, PAGE_END, PAGE_START}
import javax.swing.JFrame.EXIT_ON_CLOSE
import javax.swing.{JFrame, ImageIcon, JLabel, JPanel, BorderFactory}
class Window extends JFrame with StatusChangeCallback {
private val instructions = "<html><br>'m' - Exit<br>'z' - Start<br>'x' - Stop<br>'p' - Play/Pause</html>"
private val icon = new ImageIcon("src/main/resources/mch.png")
private val lblLogo = new JLabel(icon)
private val lblStatus = new JLabel("Waiting")
private val panel = new JPanel()
private val lblInstructions = new JLabel(instructions)
setDefaultCloseOperation(EXIT_ON_CLOSE)
setTitle("MyClickHolder")
setResizable(false)
setIconImage(icon.getImage)
panel.setLayout(new BorderLayout())
panel.setBorder(BorderFactory.createEmptyBorder(50, 50, 50, 50))
panel.add(lblLogo, PAGE_START)
panel.add(lblStatus, CENTER)
panel.add(lblInstructions, PAGE_END)
add(panel)
pack()
setVisible(true)
override def statusChanged(status: String): Unit = {
lblStatus.setText(status)
}
override def engineExit(): Unit = {
System.exit(0)
}
}