本文整理汇总了Python中javax.swing.JButton.setIcon方法的典型用法代码示例。如果您正苦于以下问题:Python JButton.setIcon方法的具体用法?Python JButton.setIcon怎么用?Python JButton.setIcon使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setIcon方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: init
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setIcon [as 别名]
def init(self):
jbNew = JButton( PaneOpsProgAction() )
jbNew.setIcon( NamedIcon("resources/decoderpro.gif","resources/decoderpro.gif") )
jbNew.addMouseListener(self.getMouseListeners()[0]) # In order to get the popupmenu on the button too
jbNew.setToolTipText( jbNew.getText() )
jbNew.setText( None )
self.add(jbNew)
示例2: init
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setIcon [as 别名]
def init(self):
jbNew= JButton( LoadDefaultXmlThrottlesLayoutAction() )
jbNew.setIcon( NamedIcon("resources/Throttles.gif","resources/Throttles.gif") )
jbNew.addMouseListener(self.getMouseListeners()[0]) # In order to get the popupmenu on the button too
jbNew.setToolTipText( jbNew.getText() )
jbNew.setText( None )
self.add(jbNew)
示例3: getScreenPanel
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setIcon [as 别名]
def getScreenPanel():
global mainScreen
global scrPanel
if not scrPanel:
mainScreen = JButton()
cursorImg = BufferedImage(16,16,BufferedImage.TYPE_INT_ARGB)
blankCursor = Toolkit.getDefaultToolkit().createCustomCursor(cursorImg, Point(0,0), "blank cursor")
mainScreen.setCursor(blankCursor)
mainScreen.setPreferredSize(
Dimension(700, 700))
image = BufferedImage(700, 700, BufferedImage.TYPE_INT_ARGB)
g = image.createGraphics()
g.setColor(Color.BLACK)
g.fillRect(0, 0, 700, 700)
g.setColor(Color.WHITE)
g.setFont(Font("Serif", Font.BOLD, 20))
g.drawString("Move your mouse here to controlfocused device.", 50, 30)
mainScreenImg = image
mainScreen.setIcon(swing.ImageIcon(image))
mouseListener = ScrMouseListener()
mainScreen.addMouseListener(mouseListener)
mainScreen.addMouseMotionListener(mouseListener)
mainScreen.addMouseWheelListener(mouseListener)
mainScreen.setFocusable(True)
keyListener = ScrKeyListener()
mainScreen.addKeyListener(keyListener)
scrPanel = JPanel()
scrPanel.setLayout(BoxLayout(scrPanel, BoxLayout.Y_AXIS))
scrPanel.add(mainScreen)
scrPanel.setFocusable(True)
return scrPanel