本文整理汇总了Python中javax.swing.JLabel.addMouseListener方法的典型用法代码示例。如果您正苦于以下问题:Python JLabel.addMouseListener方法的具体用法?Python JLabel.addMouseListener怎么用?Python JLabel.addMouseListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JLabel
的用法示例。
在下文中一共展示了JLabel.addMouseListener方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createAuxPanelWrapper
# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import addMouseListener [as 别名]
def createAuxPanelWrapper(self, auxPanel, auxTitle):
# Initialize auxillary panel
leftPanel = JPanel()
leftPanel.layout = BorderLayout()
leftPanel.addFocusListener(LeftFocusListener(self))
# NengoStyle.applyStyle(leftPanel);
if self.showTitle:
# Create auxillary panel's title bar
titleBar = JPanel()
titleBar.border = BorderFactory.createEmptyBorder(0, 0, 5, 0))
NengoStyle.applyStyle(titleBar)
titleBar.background = NengoStyle.COLOR_BACKGROUND2
titleBar.opaque = True
titleBar.layout = BorderLayout()
titleLabel = JLabel(title)
titleLabel.font = NengoStyle.FONT_BIG
NengoStyle.applyStyle(titleLabel)
titleLabel.background = NengoStyle.COLOR_BACKGROUND2
titleLabel.opaque = True
hideButtonTxt = " >> " if self.orientation == 'right' else " << "
hideButton = JLabel(hideButtonTxt)
NengoStyle.applyStyle(hideButton)
hideButton.background = NengoStyle.COLOR_BACKGROUND2
hideButton.opaque = True
# Keep in this order, Swing puts items added first on top.
# We want the button to be on top
titleBar.add(hideButton, BorderLayout.EAST)
titleBar.add(titleLabel, BorderLayout.WEST)
hideButton.addMouseListener(HideButtonListener(self, hideButton))
leftPanel.add(titleBar, BorderLayout.NORTH)
leftPanel.minimumSize = self.minimumSize
if auxPanel is not None:
# NengoStyle.applyStyle(auxPanel)
leftPanel.add(auxPanel, BorderLayout.CENTER)
return leftPanel
示例2: getContentPane
# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import addMouseListener [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
示例3: QatDialog
# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import addMouseListener [as 别名]
class QatDialog(ToggleDialog):
"""ToggleDialog for error type selection and buttons for reviewing
errors in sequence
"""
def __init__(self, name, iconName, tooltip, shortcut, height, app):
ToggleDialog.__init__(self, name, iconName, tooltip, shortcut, height)
self.app = app
tools = app.tools
#Main panel of the dialog
mainPnl = JPanel(BorderLayout())
mainPnl.setBorder(BorderFactory.createEmptyBorder(0, 1, 1, 1))
### First tab: errors selection and download ###########################
#ComboBox with tools names
self.toolsComboModel = DefaultComboBoxModel()
for tool in tools:
self.add_data_to_models(tool)
self.toolsCombo = JComboBox(self.toolsComboModel,
actionListener=ToolsComboListener(app))
renderer = ToolsComboRenderer(self.app)
renderer.setPreferredSize(Dimension(20, 20))
self.toolsCombo.setRenderer(renderer)
self.toolsCombo.setToolTipText(app.strings.getString("Select_a_quality_assurance_tool"))
#ComboBox with categories names ("views"), of the selected tool
self.viewsCombo = JComboBox(actionListener=ViewsComboListener(app))
self.viewsCombo.setToolTipText(app.strings.getString("Select_a_category_of_error"))
#Popup for checks table
self.checkPopup = JPopupMenu()
#add favourite check
self.menuItemAdd = JMenuItem(self.app.strings.getString("Add_to_favourites"))
self.menuItemAdd.setIcon(ImageIcon(File.separator.join([self.app.SCRIPTDIR,
"tools",
"data",
"Favourites",
"icons",
"tool_16.png"])))
self.menuItemAdd.addActionListener(PopupActionListener(self.app))
self.checkPopup.add(self.menuItemAdd)
#remove favourite check
self.menuItemRemove = JMenuItem(self.app.strings.getString("Remove_from_favourites"))
self.menuItemRemove.setIcon(ImageIcon(File.separator.join([self.app.SCRIPTDIR,
"tools",
"data",
"Favourites",
"icons",
"black_tool_16.png"])))
self.menuItemRemove.addActionListener(PopupActionListener(self.app))
self.checkPopup.add(self.menuItemRemove)
#Help link for selected check
self.menuItemHelp = JMenuItem(self.app.strings.getString("check_help"))
self.menuItemHelp.setIcon(ImageIcon(File.separator.join([self.app.SCRIPTDIR,
"images",
"icons",
"info_16.png"])))
self.checkPopup.add(self.menuItemHelp)
self.menuItemHelp.addActionListener(PopupActionListener(self.app))
#Table with checks of selected tool and view
self.checksTable = JTable()
self.iconrenderer = IconRenderer()
self.iconrenderer.setHorizontalAlignment(JLabel.CENTER)
scrollPane = JScrollPane(self.checksTable)
self.checksTable.setFillsViewportHeight(True)
tableSelectionModel = self.checksTable.getSelectionModel()
tableSelectionModel.addListSelectionListener(ChecksTableListener(app))
self.checksTable.addMouseListener(ChecksTableClickListener(app,
self.checkPopup,
self.checksTable))
#Favourite area status indicator
self.favAreaIndicator = JLabel()
self.update_favourite_zone_indicator()
self.favAreaIndicator.addMouseListener(FavAreaIndicatorListener(app))
#label with OSM id of the object currently edited and number of
#errors still to review
self.checksTextFld = JTextField("",
editable=0,
border=None,
background=None)
#checks buttons
btnsIconsDir = File.separator.join([app.SCRIPTDIR, "images", "icons"])
downloadIcon = ImageIcon(File.separator.join([btnsIconsDir, "download.png"]))
self.downloadBtn = JButton(downloadIcon,
actionPerformed=app.on_downloadBtn_clicked,
enabled=0)
startIcon = ImageIcon(File.separator.join([btnsIconsDir, "start_fixing.png"]))
self.startBtn = JButton(startIcon,
actionPerformed=app.on_startBtn_clicked,
enabled=0)
self.downloadBtn.setToolTipText(app.strings.getString("Download_errors_in_this_area"))
self.startBtn.setToolTipText(app.strings.getString("Start_fixing_the_selected_errors"))
#tab layout
#.........这里部分代码省略.........
示例4: BurpExtender
# 需要导入模块: from javax.swing import JLabel [as 别名]
# 或者: from javax.swing.JLabel import addMouseListener [as 别名]
class BurpExtender(IBurpExtender, ITab, IMessageEditorController, AbstractTableModel, IContextMenuFactory):
def registerExtenderCallbacks(self, callbacks):
# keep a reference to our callbacks object
self._callbacks = callbacks
# obtain an extension helpers object
self._helpers = callbacks.getHelpers()
# set our extension name
callbacks.setExtensionName("PT Vulnerabilities Manager")
self.config = SafeConfigParser()
self.createSection('projects')
self.createSection('general')
self.config.read('config.ini')
self.chooser = JFileChooser()
# create the log and a lock on which to synchronize when adding log entries
self._log = ArrayList()
self._lock = Lock()
self.logTable = Table(self)
self.logTable.getColumnModel().getColumn(0).setMaxWidth(35)
self.logTable.getColumnModel().getColumn(1).setMinWidth(100)
self._requestViewer = self._callbacks.createMessageEditor(self, False)
self._responseViewer = self._callbacks.createMessageEditor(self, False)
self.initVulnerabilityTab()
self.initProjSettingsTab()
self.initTabs()
self.initCallbacks()
if self.projPath.getText() != None:
self.loadVulnerabilities(self.projPath.getText())
print "Thank you for installing PT Vulnerabilities Manager v1.0 extension"
print "by Barak Tawily\n\n\n"
print "Disclaimer:\nThis extension might create folders and files in your hardisk which might be declared as sensitive information, make sure you are creating projects under encrypted partition"
return
def initVulnerabilityTab(self):
#
## init vulnerability tab
#
nameLabel = JLabel("Vulnerability Name:")
nameLabel.setBounds(10, 10, 140, 30)
self.addButton = JButton("Add",actionPerformed=self.addVuln)
self.addButton.setBounds(10, 500, 100, 30)
rmVulnButton = JButton("Remove",actionPerformed=self.rmVuln)
rmVulnButton.setBounds(465, 500, 100, 30)
mitigationLabel = JLabel("Mitigation:")
mitigationLabel.setBounds(10, 290, 150, 30)
addSSBtn = JButton("Add SS",actionPerformed=self.addSS)
addSSBtn.setBounds(750, 40, 110, 30)
deleteSSBtn = JButton("Remove SS",actionPerformed=self.removeSS)
deleteSSBtn.setBounds(750, 75, 110, 30)
piclistLabel = JLabel("Images list:")
piclistLabel.setBounds(580, 10, 140, 30)
self.screenshotsList = DefaultListModel()
self.ssList = JList(self.screenshotsList)
self.ssList.setBounds(580, 40, 150, 250)
self.ssList.addListSelectionListener(ssChangedHandler(self))
self.ssList.setBorder(BorderFactory.createLineBorder(Color.GRAY))
previewPicLabel = JLabel("Selected image preview: (click to open in image viewer)")
previewPicLabel.setBounds(580, 290, 500, 30)
copyImgMenu = JMenuItem("Copy")
copyImgMenu.addActionListener(copyImg(self))
self.imgMenu = JPopupMenu("Popup")
self.imgMenu.add(copyImgMenu)
self.firstPic = JLabel()
self.firstPic.setBorder(BorderFactory.createLineBorder(Color.GRAY))
self.firstPic.setBounds(580, 320, 550, 400)
self.firstPic.addMouseListener(imageClicked(self))
self.vulnName = JTextField("")
self.vulnName.getDocument().addDocumentListener(vulnTextChanged(self))
self.vulnName.setBounds(140, 10, 422, 30)
sevirities = ["Unclassified", "Critical","High","Medium","Low"]
self.threatLevel = JComboBox(sevirities);
self.threatLevel.setBounds(140, 45, 140, 30)
colors = ["Color:", "Green", "Red"]
self.colorCombo = JComboBox(colors);
self.colorCombo.setBounds(465, 45, 100, 30)
self.colorCombo
#.........这里部分代码省略.........