本文整理汇总了Python中javax.swing.JButton.setText方法的典型用法代码示例。如果您正苦于以下问题:Python JButton.setText方法的具体用法?Python JButton.setText怎么用?Python JButton.setText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JButton
的用法示例。
在下文中一共展示了JButton.setText方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: handle
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [as 别名]
def handle(self):
print 'connection from', self.client_address
conn = self.request
while 1:
msg = conn.recv(20)
if msg == "keymap":
print "keymapping!"
keymapFrame = JFrame('Key Mapping Configuration',
defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
size = (300, 500)
)
keyButton = JButton('Press any key in iPhone')
keymapFrame.add(keyButton)
keymapFrame.visible = True
while 1:
recvKey = conn.recv(20)
keyButton.setLabel("%s?" % recvKey)
keyInput = raw_input()
keynum[recvKey] = keyInput
keyButton.setText('Press any key in iPhone')
if recvKey == "keymap":
keymapFrame.visible = False
break
if msg == "quit()":
conn.close()
print self.client_address, 'disconnected'
break
print self.client_address, msg
示例2: init
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [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: init
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [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)
示例4: DetermineCookieFrame
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [as 别名]
class DetermineCookieFrame(JFrame):
""" This is the GUI for for the user to control the actions when
determining which cookie is the session cookie.
"""
def __init__(self, callbacks, selected_message):
super(DetermineCookieFrame, self).__init__()
self.callbacks = callbacks
self.selected_message = selected_message
self.windowClosing = self.close
def loadPanel(self):
panel = JPanel()
panel.setLayout(BoxLayout(panel, BoxLayout.Y_AXIS))
bottomButtonBarPanel = JPanel()
bottomButtonBarPanel.setLayout(BoxLayout(bottomButtonBarPanel, BoxLayout.X_AXIS))
bottomButtonBarPanel.setAlignmentX(1.0)
self.runButton = JButton("Run", actionPerformed=self.start)
self.cancelButton = JButton("Close", actionPerformed=self.cancel)
bottomButtonBarPanel.add(Box.createHorizontalGlue());
bottomButtonBarPanel.add(self.runButton)
bottomButtonBarPanel.add(self.cancelButton)
# Dimension(width,height)
bottom = JPanel()
bottom.setLayout(BoxLayout(bottom, BoxLayout.X_AXIS))
bottom.setAlignmentX(1.0)
self.progressBar = JProgressBar()
self.progressBar.setIndeterminate(False)
self.progressBar.setMaximum(100)
self.progressBar.setValue(0)
bottom.add(self.progressBar)
self.statusTextArea = JTextArea()
self.statusTextArea.setEditable(False)
scrollPane = JScrollPane(self.statusTextArea)
scrollPanel = JPanel()
scrollPanel.setLayout(BoxLayout(scrollPanel, BoxLayout.X_AXIS))
scrollPanel.setAlignmentX(1.0)
scrollPanel.add(scrollPane)
panel.add(scrollPanel)
panel.add(bottomButtonBarPanel)
panel.add(bottom)
self.add(panel)
self.setTitle("Determine Session Cookie(s)")
self.setSize(450, 300)
self.setLocationRelativeTo(None)
self.setVisible(True)
original_request_bytes = self.selected_message.getRequest()
http_service = self.selected_message.getHttpService()
helpers = self.callbacks.getHelpers()
request_info = helpers.analyzeRequest(http_service, original_request_bytes)
parameters = request_info.getParameters();
cookie_parameters = [parameter for parameter in parameters if parameter.getType() == IParameter.PARAM_COOKIE]
num_requests_needed = len(cookie_parameters) + 2
self.statusTextArea.append("This may require up to " + str(num_requests_needed) + " requests to be made. Hit 'Run' to begin.\n")
def start(self, event):
global cancelThread
cancelThread = False
self.runButton.setEnabled(False)
self.cancelButton.setText("Cancel")
thread = ThreadDetermineCookie(self.callbacks, self.selected_message, self.statusTextArea, self.progressBar)
thread.start()
def cancel(self, event):
self.setVisible(False);
self.dispose();
def close(self, event):
global cancelThread
cancelThread = True
示例5: BurpExtender
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [as 别名]
#.........这里部分代码省略.........
self.tabs.addTab("Modified Response", self._responseViewer.getComponent())
self.tabs.addTab("Original Request", self._originalrequestViewer.getComponent())
self.tabs.addTab("Original Response", self._originalresponseViewer.getComponent())
self.tabs.addTab("Unauthenticated Request", self._unauthorizedrequestViewer.getComponent())
self.tabs.addTab("Unauthenticated Response", self._unauthorizedresponseViewer.getComponent())
self.tabs.addTab("Configuration", self.pnl)
self.tabs.setSelectedIndex(6)
self._splitpane.setRightComponent(self.tabs)
def initCallbacks(self):
#
## init callbacks
#
# customize our UI components
self._callbacks.customizeUiComponent(self._splitpane)
self._callbacks.customizeUiComponent(self.logTable)
self._callbacks.customizeUiComponent(self.scrollPane)
self._callbacks.customizeUiComponent(self.tabs)
self._callbacks.customizeUiComponent(self.filtersTabs)
self._callbacks.registerContextMenuFactory(self)
# add the custom tab to Burp's UI
self._callbacks.addSuiteTab(self)
#
## Events functions
#
def startOrStop(self, event):
if self.startButton.getText() == "Autorize is off":
self.startButton.setText("Autorize is on")
self.startButton.setBackground(Color.GREEN)
self.intercept = 1
self._callbacks.registerHttpListener(self)
else:
self.startButton.setText("Autorize is off")
self.startButton.setBackground(Color(255, 100, 91, 255))
self.intercept = 0
self._callbacks.removeHttpListener(self)
def addEDFilter(self, event):
typeName = self.EDType.getSelectedItem().split(":")[0]
self.EDModel.addElement(typeName + ": " + self.EDText.getText())
def delEDFilter(self, event):
index = self.EDList.getSelectedIndex();
if not index == -1:
self.EDModel.remove(index);
def addEDFilterUnauth(self, event):
typeName = self.EDTypeUnauth.getSelectedItem().split(":")[0]
self.EDModelUnauth.addElement(typeName + ": " + self.EDTextUnauth.getText())
def delEDFilterUnauth(self, event):
index = self.EDListUnauth.getSelectedIndex();
if not index == -1:
self.EDModelUnauth.remove(index);
def addIFFilter(self, event):
typeName = self.IFType.getSelectedItem().split(":")[0]
self.IFModel.addElement(typeName + ": " + self.IFText.getText())
def delIFFilter(self, event):
示例6: FilamentGame_ModelEditor
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [as 别名]
class FilamentGame_ModelEditor(EditorExtension, JPanel, MouseListener, MouseMotionListener):
def getExtensionName(self):
return "Filament Model Tool"
def initializeExtension(self, manager):
self.manager = manager
self.frame = JFrame(self.getExtensionName())
self.frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
# instance setup
self.state = State.NOTHING
self.entity = Entity()
# Setupgui
self.setupGui()
self.addMouseListener(self)
self.addMouseMotionListener(self)
self.setPreferredSize(Dimension(500, 500))
self.frame.pack()
self.frame.setResizable(False)
self.frame.setVisible(True)
self.cameraPos = [0, 0]
def setupGui(self):
cPanel = JPanel()
# Draw Shape Button
self.drawShapeButton = JButton("Draw", actionPerformed=self.drawShapeButtonAction)
cPanel.add(self.drawShapeButton)
drawShapeButton = JButton("Clear", actionPerformed=self.clearShapeButtonAction)
cPanel.add(drawShapeButton)
# Label
self.infoLabel = JLabel("Shape Editor")
cPanel.add(self.infoLabel)
self.frame.add(BorderLayout.NORTH, cPanel)
self.frame.add(BorderLayout.CENTER, self)
def entitySelected(self, entity):
self.entity = entity
self.repaint()
def sceneChanged(self, scene):
self.scene = scene
self.entity = Entity()
self.repaint()
# BUTTONS
def drawShapeButtonAction(self, e):
if self.state == State.NOTHING:
self.state = State.DRAW_SHAPE
self.infoLabel.setText("Click to Draw Shape")
self.drawShapeButton.setText("Stop Drawing")
elif self.state != State.NOTHING:
self.state = State.NOTHING
self.infoLabel.setText("")
self.drawShapeButton.setText("Draw")
self.revalidate()
def clearShapeButtonAction(self, e):
if self.state != State.NOTHING:
self.drawShapeButtonAction(e)
self.state = State.NOTHING
polygon = self.entity.getModel().pol
polygon.reset()
self.repaint()
# DRAWING
def paintComponent(self, g):
self.super__paintComponent(g)
g.scale(1, -1)
g.translate(-self.cameraPos[0] + self.getWidth() / 2, -self.cameraPos[1] - self.getHeight() / 2)
self.drawGrid(g)
polygon = self.entity.getModel().pol
x = []
y = []
g.setColor(Color.BLACK)
for i in range(polygon.npoints):
x = x + [int(polygon.xpoints[i])]
y = y + [int(polygon.ypoints[i])]
g.drawRect(int(polygon.xpoints[i]) - 2, int(polygon.ypoints[i]) - 2, 4, 4)
g.fillPolygon(x, y, polygon.npoints)
def drawGrid(self, g):
g.setColor(Color.RED)
g.drawLine(50, 0, -50, 0)
g.drawLine(0, 50, 0, -50)
# MOUSE LISTENER
def mouseCicked(self, e):
return
def mouseEntered(self, e):
return
def mouseExited(self, e):
return
#.........这里部分代码省略.........
示例7: BurpExtender
# 需要导入模块: from javax.swing import JButton [as 别名]
# 或者: from javax.swing.JButton import setText [as 别名]
#.........这里部分代码省略.........
importProjButton = JButton("Import",actionPerformed=self.importProj)
importProjButton.setBounds(470, 10, 100, 30)
exportProjButton = JButton("Export",actionPerformed=self.exportProj)
exportProjButton.setBounds(575, 10, 100, 30)
openProjButton = JButton("Open Directory",actionPerformed=self.openProj)
openProjButton.setBounds(680, 10, 130, 30)
currentProjectLabel = JLabel("Current:")
currentProjectLabel.setBounds(10, 10, 140, 30)
projects = self.config.options('projects')
self.currentProject = JComboBox(projects)
self.currentProject.addActionListener(projectChangeHandler(self))
self.currentProject.setBounds(140, 10, 140, 30)
self.autoSave = JCheckBox("Auto Save Mode")
self.autoSave.setEnabled(False) # implement this feature
self.autoSave.setBounds(300, 10, 140, 30)
self.autoSave.setToolTipText("Will save any changed value while focus is out")
addProjButton = JButton("Add / Update",actionPerformed=self.addProj)
addProjButton.setBounds(10, 330, 150, 30)
removeProjButton = JButton("Remove Current",actionPerformed=self.rmProj)
removeProjButton.setBounds(315, 330, 146, 30)
generalOptions = self.config.options('general')
if 'default project' in generalOptions:
defaultProj = self.config.get('general','default project')
self.currentProject.getModel().setSelectedItem(defaultProj)
self.projPath.setText(self.config.get('projects',self.currentProject.getSelectedItem()))
self.clearProjTab = True
self.projectSettings = JPanel()
self.projectSettings.setBounds(0, 0, 1000, 1000)
self.projectSettings.setLayout(None)
self.projectSettings.add(reportLabel)
self.projectSettings.add(detailsLabel)
self.projectSettings.add(projPathLabel)
self.projectSettings.add(addProjButton)
self.projectSettings.add(openProjButton)
self.projectSettings.add(projNameLabel)
self.projectSettings.add(projDetailsScroll)
self.projectSettings.add(importProjButton)
self.projectSettings.add(exportProjButton)
self.projectSettings.add(removeProjButton)
self.projectSettings.add(generateReportButton)
self.projectSettings.add(chooseProjPathButton)
self.projectSettings.add(currentProjectLabel)
self.projectSettings.add(self.projPath)
self.projectSettings.add(self.autoSave)
self.projectSettings.add(self.projName)
self.projectSettings.add(self.reportType)
self.projectSettings.add(self.currentProject)
def initTabs(self):
#
## init autorize tabs
#
self._splitpane = JSplitPane(JSplitPane.HORIZONTAL_SPLIT)
self.scrollPane = JScrollPane(self.logTable)
self._splitpane.setLeftComponent(self.scrollPane)