JDialog使用

122 阅读1分钟

创建一个Dialog

private fun showTipDialog(jf: JFrame) {
            val jPanel = JPanel()
            jPanel.add(JLabel().apply {
                text = "查看文件:" + File(FileSystemView.getFileSystemView().homeDirectory.path, "需要翻译的字段.txt").toString()
            })

            val dialog = JDialog(jf, "selcting", true)
            dialog.setSize(600, 300);//设置其大小
            dialog.setLocation(400, 600)//设置其位置
            dialog.defaultCloseOperation = JDialog.HIDE_ON_CLOSE;//设置关闭模式
            dialog.contentPane = jPanel
            dialog.isVisible = true;//设置可见
        }