Wrapper: update native window

This commit is contained in:
PeratX 2020-03-29 18:38:28 +08:00
parent eb1a15de76
commit f6c508883f
2 changed files with 40 additions and 47 deletions

View File

@ -161,7 +161,6 @@ class MiraiDownloaderProgressBarInUI(): MiraiDownloadProgressBar{
} }
override fun complete() { override fun complete() {
TODO("Not yet implemented")
} }
} }

View File

@ -7,17 +7,16 @@
* https://github.com/mamoe/mirai/blob/master/LICENSE * https://github.com/mamoe/mirai/blob/master/LICENSE
*/ */
@file:Suppress("EXPERIMENTAL_API_USAGE") @file:Suppress("EXPERIMENTAL_API_USAGE")
package net.mamoe.mirai.console.wrapper package net.mamoe.mirai.console.wrapper
import kotlinx.coroutines.* import kotlinx.coroutines.*
import java.awt.Frame
import java.awt.Panel
import java.awt.TextArea import java.awt.TextArea
import java.awt.Toolkit
import java.io.File import java.io.File
import java.lang.StringBuilder
import java.net.URLClassLoader import java.net.URLClassLoader
import java.util.* import java.util.*
import javax.swing.JFrame
import javax.swing.JPanel
val contentPath by lazy { val contentPath by lazy {
@ -41,23 +40,17 @@ object WrapperMain {
fun main(args: Array<String>) { fun main(args: Array<String>) {
gc() gc()
if (args.contains("native") || args.contains("-native")) { if (args.contains("native") || args.contains("-native")) {
val f = JFrame("Mirai-Console Version Check")
val f = Frame("Mirai-Console Version Check") f.setSize(500, 200)
f.setLocationRelativeTo(null)
f.isResizable = false f.isResizable = false
val srcSize= Toolkit.getDefaultToolkit().screenSize
val width = 300 val p = JPanel()
val height = 200
val p = Panel()
val textArea = TextArea()
textArea.isEditable = false
p.add(textArea)
p.isVisible = true
f.setLocation((srcSize.width-width)/2, (srcSize.height-height)/2)
f.setSize(width, height)
f.add(p) f.add(p)
val textArea = TextArea()
p.add(textArea)
textArea.isEditable = false
f.isVisible = true f.isVisible = true
uiLog("正在进行版本检查\n") uiLog("正在进行版本检查\n")
@ -160,15 +153,16 @@ object WrapperMain {
} }
private class MiraiClassLoader( private class MiraiClassLoader(
protocol: File, protocol: File,
console: File, console: File,
parent: ClassLoader? parent: ClassLoader?
): URLClassLoader(arrayOf( ) : URLClassLoader(
arrayOf(
protocol.toURI().toURL(), protocol.toURI().toURL(),
console.toURI().toURL() console.toURI().toURL()
), parent) ), parent
)
private object WrapperProperties { private object WrapperProperties {