本文整理汇总了Python中javax.swing.JLabel.setFocusable方法的典型用法代码示例。如果您正苦于以下问题:Python JLabel.setFocusable方法的具体用法?Python JLabel.setFocusable怎么用?Python JLabel.setFocusable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.setFocusable方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getContentPane
# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import setFocusable [as 别名]
def getContentPane():
global contentPane
global REMAP_WIDTH
global REMAP_HEIGHT
global MARGIN
if not contentPane:
global mainScreen
global mainScreenImg
mainScreen = JLabel()
cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB)
blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor")
mainScreen.setCursor(blankCursor)
mainScreen.setPreferredSize(
Dimension(REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN))
mainScreen.setText("main screen!")
image = BufferedImage(REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN
, BufferedImage.TYPE_INT_ARGB)
g = image.createGraphics()
g.setColor(Color.BLACK)
g.fillRect(0, 0, REMAP_WIDTH + MARGIN, REMAP_HEIGHT + MARGIN)
g.setColor(Color.WHITE)
g.setFont(Font("Serif", Font.BOLD, 20))
g.drawString("Cursor will display on your device.", 50, 30)
mainScreenImg = image
mainScreen.setIcon(swing.ImageIcon(image))
mouseListener = ScrMouseListener()
mainScreen.addMouseListener(mouseListener)
mainScreen.addMouseMotionListener(mouseListener)
mainScreen.addMouseWheelListener(mouseListener)
keyListener = ScrKeyListener()
mainScreen.addKeyListener(keyListener)
mainScreen.setFocusable(True)
scrPanel = JPanel()
scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS))
scrPanel.add(mainScreen)
contentPane = JPanel()
contentPane.setLayout(BorderLayout())
contentPane.add(scrPanel, BorderLayout.WEST)
# contentPAne.add(controlPanel(). BorderLayout.EAST)
return contentPane