⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 swing.py

📁 Python Development Environment (Python IDE plugin for Eclipse). Features editor, code completion, re
💻 PY
字号:
"""
A hack to make pawt.swing point to the java swing library.
This allows code which imports pawt.swing to work on both JDK1.1 and 1.2
"""
swing = None

try:
	import javax.swing.Icon
	from javax import swing
except (ImportError, AttributeError):
	try:
		import java.awt.swing.Icon
		from java.awt import swing
	except (ImportError, AttributeError):
		try:
			import com.sun.java.swing.Icon
			from com.sun.java import swing
		except (ImportError, AttributeError):
			raise ImportError, 'swing not defined in javax.swing or java.awt.swing or com.sun.java.swing'
import sys
def test(panel, size=None, name='Swing Tester'):
	f = swing.JFrame(name, windowClosing=lambda event: sys.exit(0))
	if hasattr(panel, 'init'):
		panel.init()

	f.contentPane.add(panel)
	f.pack()
	if size is not None:
		from java import awt
		f.setSize(apply(awt.Dimension, size))
	f.setVisible(1)
	return f

if swing is not None:
	import pawt, sys
	pawt.swing = swing
	sys.modules['pawt.swing'] = swing
	swing.__dict__['test'] = test
	
	#These two lines help out jpythonc to figure out this very strange module
	swing.__dict__['__file__'] = __file__
	swing.__dict__['__jpythonc_name__'] = 'pawt.swing'

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -