Skip to content

Commit

Permalink
fix scala 2.11 build compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
triton11 committed Jul 6, 2018
1 parent b43e165 commit e125613
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -8,3 +8,5 @@ asset/
.idea/
.DS_Store
node_modules
repl-plots/src/main/scala/com/cibo/evilplot/test.scala

18 changes: 9 additions & 9 deletions repl-plots/src/main/scala/com/cibo/evilplot/displayPlot.scala
Expand Up @@ -32,15 +32,16 @@ package com.cibo.evilplot

import java.awt.{Graphics, Graphics2D}

import com.cibo.evilplot.plot.Plot
import com.cibo.evilplot.plot.{Plot}
import javax.swing.{JFileChooser, JFrame, JPanel}
import java.awt.event.{ActionEvent, ComponentAdapter, ComponentEvent}
import java.awt.event.{ActionEvent, ActionListener, ComponentAdapter, ComponentEvent}
import java.io.File

import com.cibo.evilplot.geometry.{Drawable, Extent}
import com.cibo.evilplot.plot.aesthetics.Theme
import com.cibo.evilplot.plot.aesthetics.{Theme}
import javax.swing.filechooser.FileNameExtensionFilter


object displayPlot {

private class DrawablePanel extends JPanel {
Expand Down Expand Up @@ -73,13 +74,12 @@ object displayPlot {
private def createMenuBar()(implicit theme: Theme): Unit = {
val menubar = new JMenuBar
val save = new JMenuItem("Save")
save.addActionListener((event: ActionEvent) => {
def save(event: ActionEvent) = {
val actionListener = new ActionListener {
def actionPerformed(e: ActionEvent) = {
val selectFile = new JFileChooser()
selectFile.setCurrentDirectory(null)
selectFile.setFileFilter(new FileNameExtensionFilter("png", "png"))
val savedFile: Int = selectFile.showSaveDialog(this)

val savedFile: Int = selectFile.showSaveDialog(panel)
if (savedFile == JFileChooser.APPROVE_OPTION) {
val extensionPattern = "(.*\\.png)".r
val file: File = selectFile.getSelectedFile.toString match {
Expand All @@ -89,8 +89,8 @@ object displayPlot {
savePlot(file)
}
}
save(event)
})
}
save.addActionListener(actionListener)
menubar.add(save)
setJMenuBar(menubar)
}
Expand Down

0 comments on commit e125613

Please sign in to comment.