Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
ef876646
Unverified
Commit
ef876646
authored
Oct 20, 2021
by
Roman Sedaikin
Committed by
GitHub
Oct 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SkiaJvmSample. (#288)
parent
4420bbdb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
126 additions
and
145 deletions
+126
-145
App.kt
samples/SkiaJvmSample/src/main/kotlin/SkiaJvmSample/App.kt
+18
-136
ClocksJvm.kt
.../SkiaJvmSample/src/main/kotlin/SkiaJvmSample/ClocksJvm.kt
+103
-0
SwingSkia.kt
.../SkiaJvmSample/src/main/kotlin/SkiaJvmSample/SwingSkia.kt
+5
-9
No files found.
samples/SkiaJvmSample/src/main/kotlin/SkiaJvmSample/App.kt
View file @
ef876646
package
SkiaJvmSample
package
SkiaJvmSample
import
kotlinx.coroutines.*
import
kotlinx.coroutines.*
import
org.jetbrains.skia.*
import
org.jetbrains.skia.paragraph.FontCollection
import
org.jetbrains.skia.paragraph.ParagraphBuilder
import
org.jetbrains.skia.paragraph.ParagraphStyle
import
org.jetbrains.skia.paragraph.TextStyle
import
org.jetbrains.skiko.*
import
org.jetbrains.skiko.*
import
java.awt.Color
import
java.awt.Dimension
import
java.awt.Dimension
import
java.awt.Toolkit
import
java.awt.Toolkit
import
java.awt.event.*
import
java.awt.event.*
import
javax.swing.*
import
javax.swing.*
import
kotlin.math.cos
import
kotlin.math.sin
import
java.io.File
import
java.io.File
import
java.nio.file.Files
import
java.nio.file.Files
import
javax.imageio.ImageIO
import
javax.imageio.ImageIO
...
@@ -25,15 +19,16 @@ fun main() {
...
@@ -25,15 +19,16 @@ fun main() {
}
}
fun
createWindow
(
title
:
String
,
exitOnClose
:
Boolean
)
=
SwingUtilities
.
invokeLater
{
fun
createWindow
(
title
:
String
,
exitOnClose
:
Boolean
)
=
SwingUtilities
.
invokeLater
{
var
mouseX
=
0
val
skiaLayer
=
SkiaLayer
()
var
mouseY
=
0
val
clocks
=
ClocksJvm
(
skiaLayer
)
val
window
=
SkiaWindow
()
val
window
=
JFrame
(
title
)
window
.
defaultCloseOperation
=
window
.
defaultCloseOperation
=
if
(
exitOnClose
)
WindowConstants
.
EXIT_ON_CLOSE
else
WindowConstants
.
DISPOSE_ON_CLOSE
if
(
exitOnClose
)
WindowConstants
.
EXIT_ON_CLOSE
else
WindowConstants
.
DISPOSE_ON_CLOSE
window
.
title
=
title
window
.
title
=
title
skiaLayer
.
attachTo
(
window
.
contentPane
)
// Create menu.
// Create menu.
val
menuBar
=
JMenuBar
()
val
menuBar
=
JMenuBar
()
val
fileMenu
=
JMenu
(
"File"
)
val
fileMenu
=
JMenu
(
"File"
)
...
@@ -44,7 +39,7 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
...
@@ -44,7 +39,7 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
miFullscreenState
.
setAccelerator
(
ctrlI
)
miFullscreenState
.
setAccelerator
(
ctrlI
)
miFullscreenState
.
addActionListener
(
object
:
ActionListener
{
miFullscreenState
.
addActionListener
(
object
:
ActionListener
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
println
(
"${window.title} is in fullscreen mode: ${
window.l
ayer.fullscreen}"
)
println
(
"${window.title} is in fullscreen mode: ${
skiaL
ayer.fullscreen}"
)
}
}
})
})
...
@@ -53,7 +48,7 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
...
@@ -53,7 +48,7 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
miToggleFullscreen
.
setAccelerator
(
ctrlF
)
miToggleFullscreen
.
setAccelerator
(
ctrlF
)
miToggleFullscreen
.
addActionListener
(
object
:
ActionListener
{
miToggleFullscreen
.
addActionListener
(
object
:
ActionListener
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
window
.
layer
.
fullscreen
=
!
window
.
l
ayer
.
fullscreen
skiaLayer
.
fullscreen
=
!
skiaL
ayer
.
fullscreen
}
}
})
})
...
@@ -64,7 +59,7 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
...
@@ -64,7 +59,7 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
miTakeScreenshot
.
setAccelerator
(
ctrlS
)
miTakeScreenshot
.
setAccelerator
(
ctrlS
)
miTakeScreenshot
.
addActionListener
(
object
:
ActionListener
{
miTakeScreenshot
.
addActionListener
(
object
:
ActionListener
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
val
screenshot
=
window
.
l
ayer
.
screenshot
()
!!
val
screenshot
=
skiaL
ayer
.
screenshot
()
!!
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
GlobalScope
.
launch
(
Dispatchers
.
IO
)
{
val
image
=
screenshot
.
toBufferedImage
()
val
image
=
screenshot
.
toBufferedImage
()
ImageIO
.
write
(
image
,
"png"
,
File
(
defaultScreenshotPath
))
ImageIO
.
write
(
image
,
"png"
,
File
(
defaultScreenshotPath
))
...
@@ -92,21 +87,16 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
...
@@ -92,21 +87,16 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
window
.
setJMenuBar
(
menuBar
)
window
.
setJMenuBar
(
menuBar
)
val
state
=
State
()
skiaLayer
.
onStateChanged
(
SkiaLayer
.
PropertyKind
.
Renderer
)
{
layer
->
state
.
text
=
title
window
.
layer
.
onStateChanged
(
SkiaLayer
.
PropertyKind
.
Renderer
)
{
layer
->
println
(
"Changed renderer for $layer: new value is ${layer.renderApi}"
)
println
(
"Changed renderer for $layer: new value is ${layer.renderApi}"
)
}
}
window
.
layer
.
renderer
=
Renderer
(
window
.
layer
)
{
skiaLayer
.
skikoView
=
GenericSkikoView
(
skiaLayer
,
clocks
)
renderer
,
w
,
h
,
nanoTime
->
displayScene
(
renderer
,
w
,
h
,
nanoTime
,
mouseX
,
mouseY
,
state
)
}
window
.
l
ayer
.
addMouseMotionListener
(
object
:
MouseMotionAdapter
()
{
skiaL
ayer
.
addMouseMotionListener
(
object
:
MouseMotionAdapter
()
{
override
fun
mouseMoved
(
event
:
MouseEvent
)
{
override
fun
mouseMoved
(
event
:
MouseEvent
)
{
mouseX
=
event
.
x
clocks
.
xpos
=
event
.
x
mouseY
=
event
.
y
clocks
.
ypos
=
event
.
y
}
}
})
})
...
@@ -115,124 +105,16 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
...
@@ -115,124 +105,16 @@ fun createWindow(title: String, exitOnClose: Boolean) = SwingUtilities.invokeLat
window
.
setUndecorated
(
true
)
window
.
setUndecorated
(
true
)
// On Windows we don't set transparent background to avoid event input issues (JDK specific)
// On Windows we don't set transparent background to avoid event input issues (JDK specific)
if
(
hostOs
!=
OS
.
Windows
)
{
if
(
hostOs
!=
OS
.
Windows
)
{
window
.
background
=
java
.
awt
.
Color
(
0
,
0
,
0
,
0
)
window
.
background
=
Color
(
0
,
0
,
0
,
0
)
}
}
window
.
l
ayer
.
transparency
=
true
skiaL
ayer
.
transparency
=
true
}
else
{
}
else
{
window
.
layer
.
background
=
java
.
awt
.
Color
.
WHITE
skiaLayer
.
background
=
Color
.
WHITE
}
}
// MANDATORY: set window preferred size before calling pack()
// MANDATORY: set window preferred size before calling pack()
window
.
preferredSize
=
Dimension
(
800
,
600
)
window
.
preferredSize
=
Dimension
(
800
,
600
)
window
.
pack
()
window
.
pack
()
window
.
l
ayer
.
paint
(
window
.
graphics
)
skiaL
ayer
.
paint
(
window
.
graphics
)
window
.
isVisible
=
true
window
.
isVisible
=
true
}
}
class
Renderer
(
val
layer
:
SkiaLayer
,
val
displayScene
:
(
Renderer
,
Int
,
Int
,
Long
)
->
Unit
):
SkiaRenderer
{
val
typeface
=
Typeface
.
makeFromFile
(
"fonts/JetBrainsMono-Regular.ttf"
)
val
font
=
Font
(
typeface
,
40f
)
val
paint
=
Paint
().
apply
{
color
=
0
xff9BC730L
.
toInt
()
mode
=
PaintMode
.
FILL
strokeWidth
=
1f
}
var
canvas
:
Canvas
?
=
null
override
fun
onRender
(
canvas
:
Canvas
,
width
:
Int
,
height
:
Int
,
nanoTime
:
Long
)
{
this
.
canvas
=
canvas
val
contentScale
=
layer
.
contentScale
canvas
.
scale
(
contentScale
,
contentScale
)
displayScene
(
this
,
(
width
/
contentScale
).
toInt
(),
(
height
/
contentScale
).
toInt
(),
nanoTime
)
// Alpha layers test
val
rectW
=
100f
val
rectH
=
100f
val
left
=
(
width
/
layer
.
contentScale
-
rectW
)
/
2f
val
top
=
(
height
/
layer
.
contentScale
-
rectH
)
/
2f
val
pictureRecorder
=
PictureRecorder
()
val
pictureCanvas
=
pictureRecorder
.
beginRecording
(
Rect
.
makeLTRB
(
left
,
top
,
left
+
rectW
,
top
+
rectH
)
)
pictureCanvas
.
drawLine
(
left
,
top
,
left
+
rectW
,
top
+
rectH
,
Paint
())
val
picture
=
pictureRecorder
.
finishRecordingAsPicture
()
canvas
.
drawPicture
(
picture
,
null
,
Paint
())
canvas
.
drawLine
(
left
,
top
+
rectH
,
left
+
rectW
,
top
,
Paint
())
layer
.
needRedraw
()
}
}
class
State
{
var
frame
:
Int
=
0
var
text
:
String
=
"Hello Skija"
}
private
val
fontCollection
=
FontCollection
()
.
setDefaultFontManager
(
FontMgr
.
default
)
fun
displayScene
(
renderer
:
Renderer
,
width
:
Int
,
height
:
Int
,
nanoTime
:
Long
,
xpos
:
Int
,
ypos
:
Int
,
state
:
State
)
{
val
canvas
=
renderer
.
canvas
!!
val
watchFill
=
Paint
().
apply
{
color
=
0
xFFFFFFFF
.
toInt
()
}
val
watchStroke
=
Paint
().
apply
{
color
=
0
xFF000000
.
toInt
()
mode
=
PaintMode
.
STROKE
strokeWidth
=
1f
}
val
watchStrokeAA
=
Paint
().
apply
{
color
=
0
xFF000000
.
toInt
()
mode
=
PaintMode
.
STROKE
strokeWidth
=
1f
}
val
watchFillHover
=
Paint
().
apply
{
color
=
0
xFFE4FF01
.
toInt
()
}
for
(
x
in
0
..
(
width
-
50
)
step
50
)
{
for
(
y
in
20
..
(
height
-
50
)
step
50
)
{
val
hover
=
xpos
>
x
+
0
&&
xpos
<
x
+
50
&&
ypos
>
y
+
0
&&
ypos
<
y
+
50
val
fill
=
if
(
hover
)
watchFillHover
else
watchFill
val
stroke
=
if
(
x
>
width
/
2
)
watchStrokeAA
else
watchStroke
canvas
.
drawOval
(
Rect
.
makeXYWH
(
x
+
5f
,
y
+
5f
,
40f
,
40f
),
fill
)
canvas
.
drawOval
(
Rect
.
makeXYWH
(
x
+
5f
,
y
+
5f
,
40f
,
40f
),
stroke
)
var
angle
=
0f
while
(
angle
<
2f
*
Math
.
PI
)
{
canvas
.
drawLine
(
(
x
+
25
-
17
*
sin
(
angle
)),
(
y
+
25
+
17
*
cos
(
angle
)),
(
x
+
25
-
20
*
sin
(
angle
)),
(
y
+
25
+
20
*
cos
(
angle
)),
stroke
)
angle
+=
(
2.0
*
Math
.
PI
/
12.0
).
toFloat
()
}
val
time
=
(
nanoTime
/
1
E6
)
%
60000
+
(
x
.
toFloat
()
/
width
*
5000
).
toLong
()
+
(
y
.
toFloat
()
/
width
*
5000
).
toLong
()
val
angle1
=
(
time
.
toFloat
()
/
5000
*
2f
*
Math
.
PI
).
toFloat
()
canvas
.
drawLine
(
x
+
25f
,
y
+
25f
,
x
+
25f
-
15f
*
sin
(
angle1
),
y
+
25f
+
15
*
cos
(
angle1
),
stroke
)
val
angle2
=
(
time
/
60000
*
2f
*
Math
.
PI
).
toFloat
()
canvas
.
drawLine
(
x
+
25f
,
y
+
25f
,
x
+
25f
-
10f
*
sin
(
angle2
),
y
+
25f
+
10f
*
cos
(
angle2
),
stroke
)
}
}
val
text
=
"${state.text} ${state.frame++}!"
canvas
.
drawString
(
text
,
xpos
.
toFloat
(),
ypos
.
toFloat
(),
renderer
.
font
,
renderer
.
paint
)
val
style
=
ParagraphStyle
()
val
paragraph
=
ParagraphBuilder
(
style
,
fontCollection
)
.
pushStyle
(
TextStyle
().
setColor
(
0
xFF000000
.
toInt
()))
.
addText
(
"Graphics API: ${renderer.layer.renderApi} ✿゚ ${currentSystemTheme}"
)
.
popStyle
()
.
build
()
paragraph
.
layout
(
Float
.
POSITIVE_INFINITY
)
paragraph
.
paint
(
canvas
,
5f
,
5f
)
}
samples/SkiaJvmSample/src/main/kotlin/SkiaJvmSample/ClocksJvm.kt
0 → 100644
View file @
ef876646
package
SkiaJvmSample
import
org.jetbrains.skiko.*
import
org.jetbrains.skia.*
import
org.jetbrains.skia.paragraph.FontCollection
import
org.jetbrains.skia.paragraph.ParagraphBuilder
import
org.jetbrains.skia.paragraph.ParagraphStyle
import
org.jetbrains.skia.paragraph.TextStyle
import
kotlin.math.cos
import
kotlin.math.sin
import
kotlin.math.PI
class
ClocksJvm
(
private
val
layer
:
SkiaLayer
):
SkikoView
{
val
typeface
=
Typeface
.
makeFromFile
(
"fonts/JetBrainsMono-Regular.ttf"
)
val
font
=
Font
(
typeface
,
40f
)
val
paint
=
Paint
().
apply
{
color
=
0
xff9BC730L
.
toInt
()
mode
=
PaintMode
.
FILL
strokeWidth
=
1f
}
private
var
frame
=
0
var
xpos
=
0
var
ypos
=
0
private
val
fontCollection
=
FontCollection
()
.
setDefaultFontManager
(
FontMgr
.
default
)
override
fun
onRender
(
canvas
:
Canvas
,
width
:
Int
,
height
:
Int
,
currentTimestamp
:
Long
)
{
val
watchFill
=
Paint
().
apply
{
color
=
0
xFFFFFFFF
.
toInt
()
}
val
watchStroke
=
Paint
().
apply
{
color
=
0
xFF000000
.
toInt
()
mode
=
PaintMode
.
STROKE
strokeWidth
=
1f
}
val
watchStrokeAA
=
Paint
().
apply
{
color
=
0
xFF000000
.
toInt
()
mode
=
PaintMode
.
STROKE
strokeWidth
=
1f
}
val
watchFillHover
=
Paint
().
apply
{
color
=
0
xFFE4FF01
.
toInt
()
}
for
(
x
in
0
..
(
width
-
50
)
step
50
)
{
for
(
y
in
20
..
(
height
-
50
)
step
50
)
{
val
hover
=
xpos
>
x
+
0
&&
xpos
<
x
+
50
&&
ypos
>
y
+
0
&&
ypos
<
y
+
50
val
fill
=
if
(
hover
)
watchFillHover
else
watchFill
val
stroke
=
if
(
x
>
width
/
2
)
watchStrokeAA
else
watchStroke
canvas
.
drawOval
(
Rect
.
makeXYWH
(
x
+
5f
,
y
+
5f
,
40f
,
40f
),
fill
)
canvas
.
drawOval
(
Rect
.
makeXYWH
(
x
+
5f
,
y
+
5f
,
40f
,
40f
),
stroke
)
var
angle
=
0f
while
(
angle
<
2f
*
PI
)
{
canvas
.
drawLine
(
(
x
+
25
-
17
*
sin
(
angle
)),
(
y
+
25
+
17
*
cos
(
angle
)),
(
x
+
25
-
20
*
sin
(
angle
)),
(
y
+
25
+
20
*
cos
(
angle
)),
stroke
)
angle
+=
(
2.0
*
PI
/
12.0
).
toFloat
()
}
val
time
=
(
currentTimestamp
/
1
E6
)
%
60000
+
(
x
.
toFloat
()
/
width
*
5000
).
toLong
()
+
(
y
.
toFloat
()
/
width
*
5000
).
toLong
()
val
angle1
=
(
time
.
toFloat
()
/
5000
*
2f
*
PI
).
toFloat
()
canvas
.
drawLine
(
x
+
25f
,
y
+
25f
,
x
+
25f
-
15f
*
sin
(
angle1
),
y
+
25f
+
15
*
cos
(
angle1
),
stroke
)
val
angle2
=
(
time
/
60000
*
2f
*
PI
).
toFloat
()
canvas
.
drawLine
(
x
+
25f
,
y
+
25f
,
x
+
25f
-
10f
*
sin
(
angle2
),
y
+
25f
+
10f
*
cos
(
angle2
),
stroke
)
}
}
val
text
=
"Frames: ${frame++}!"
canvas
.
drawString
(
text
,
xpos
.
toFloat
(),
ypos
.
toFloat
(),
font
,
paint
)
val
style
=
ParagraphStyle
()
val
renderInfo
=
ParagraphBuilder
(
style
,
fontCollection
)
.
pushStyle
(
TextStyle
().
setColor
(
0
xFF000000
.
toInt
()))
.
addText
(
"Graphics API: ${layer.renderApi} ✿゚ ${currentSystemTheme}"
)
.
popStyle
()
.
build
()
renderInfo
.
layout
(
Float
.
POSITIVE_INFINITY
)
renderInfo
.
paint
(
canvas
,
5f
,
5f
)
// Alpha layers test
val
rectW
=
100f
val
rectH
=
100f
val
left
=
(
width
/
layer
.
contentScale
-
rectW
)
/
2f
val
top
=
(
height
/
layer
.
contentScale
-
rectH
)
/
2f
val
pictureRecorder
=
PictureRecorder
()
val
pictureCanvas
=
pictureRecorder
.
beginRecording
(
Rect
.
makeLTRB
(
left
,
top
,
left
+
rectW
,
top
+
rectH
)
)
pictureCanvas
.
drawLine
(
left
,
top
,
left
+
rectW
,
top
+
rectH
,
Paint
())
val
picture
=
pictureRecorder
.
finishRecordingAsPicture
()
canvas
.
drawPicture
(
picture
,
null
,
Paint
())
canvas
.
drawLine
(
left
,
top
+
rectH
,
left
+
rectW
,
top
,
Paint
())
}
}
\ No newline at end of file
samples/SkiaJvmSample/src/main/kotlin/SkiaJvmSample/SwingSkia.kt
View file @
ef876646
...
@@ -10,10 +10,7 @@ import java.awt.event.ComponentEvent
...
@@ -10,10 +10,7 @@ import java.awt.event.ComponentEvent
import
java.awt.event.MouseEvent
import
java.awt.event.MouseEvent
import
java.awt.event.MouseMotionAdapter
import
java.awt.event.MouseMotionAdapter
import
javax.swing.*
import
javax.swing.*
import
org.jetbrains.skiko.GenericSkikoView
private
val
state
=
State
()
private
var
mouseX
=
0
private
var
mouseY
=
0
fun
Button
(
fun
Button
(
text
:
String
,
text
:
String
,
...
@@ -36,8 +33,6 @@ fun SwingSkia() = SwingUtilities.invokeLater {
...
@@ -36,8 +33,6 @@ fun SwingSkia() = SwingUtilities.invokeLater {
window
.
defaultCloseOperation
=
WindowConstants
.
DISPOSE_ON_CLOSE
window
.
defaultCloseOperation
=
WindowConstants
.
DISPOSE_ON_CLOSE
window
.
title
=
"SwingSkiaWindow"
window
.
title
=
"SwingSkiaWindow"
state
.
text
=
window
.
title
var
panel
=
getSkiaPanel
()
var
panel
=
getSkiaPanel
()
window
.
contentPane
.
add
(
window
.
contentPane
.
add
(
...
@@ -87,6 +82,8 @@ fun SwingSkia() = SwingUtilities.invokeLater {
...
@@ -87,6 +82,8 @@ fun SwingSkia() = SwingUtilities.invokeLater {
private
fun
getSkiaPanel
():
SkiaPanel
{
private
fun
getSkiaPanel
():
SkiaPanel
{
val
panel
=
SkiaPanel
()
val
panel
=
SkiaPanel
()
val
clocks
=
ClocksJvm
(
panel
.
layer
)
panel
.
layer
.
skikoView
=
GenericSkikoView
(
panel
.
layer
,
clocks
)
val
btnPanelOK
=
JPanel
()
val
btnPanelOK
=
JPanel
()
btnPanelOK
.
setLayout
(
BorderLayout
(
0
,
0
))
btnPanelOK
.
setLayout
(
BorderLayout
(
0
,
0
))
btnPanelOK
.
setBackground
(
Color
.
white
)
btnPanelOK
.
setBackground
(
Color
.
white
)
...
@@ -103,11 +100,10 @@ private fun getSkiaPanel(): SkiaPanel {
...
@@ -103,11 +100,10 @@ private fun getSkiaPanel(): SkiaPanel {
panel
.
repaint
()
panel
.
repaint
()
}
}
})
})
panel
.
layer
.
renderer
=
Renderer
(
panel
.
layer
)
{
renderer
,
w
,
h
,
nanoTime
->
displayScene
(
renderer
,
w
,
h
,
nanoTime
,
mouseX
,
mouseY
,
state
)
}
panel
.
layer
.
addMouseMotionListener
(
object
:
MouseMotionAdapter
()
{
panel
.
layer
.
addMouseMotionListener
(
object
:
MouseMotionAdapter
()
{
override
fun
mouseMoved
(
event
:
MouseEvent
)
{
override
fun
mouseMoved
(
event
:
MouseEvent
)
{
mouseX
=
event
.
x
clocks
.
xpos
=
event
.
x
mouseY
=
event
.
y
clocks
.
ypos
=
event
.
y
}
}
})
})
return
panel
return
panel
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment