本文整理汇总了Python中javax.swing.JFrame.remove方法的典型用法代码示例。如果您正苦于以下问题:Python JFrame.remove方法的具体用法?Python JFrame.remove怎么用?Python JFrame.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JFrame
的用法示例。
在下文中一共展示了JFrame.remove方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PythonWindow
# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import remove [as 别名]
#.........这里部分代码省略.........
editmenu.add(item)
item = new_item("Run Selection", "runselection", KeyEvent.VK_E,
mod=shortcut | ActionEvent.SHIFT_MASK)
editmenu.add(item)
editmenu.addSeparator()
item = new_item("Indent Selection", "indentselection",
KeyEvent.VK_CLOSE_BRACKET)
editmenu.add(item)
item = new_item("Dedent Selection", "dedentselection",
KeyEvent.VK_OPEN_BRACKET)
editmenu.add(item)
shellmenu = JMenu("Interactive")
menubar.add(shellmenu)
item = new_item("Previous Input", "up", KeyEvent.VK_UP,
mod=ActionEvent.ALT_MASK)
shellmenu.add(item)
item = new_item("Next Input", "down", KeyEvent.VK_DOWN,
mod=ActionEvent.ALT_MASK)
shellmenu.add(item)
self.frame.setJMenuBar(menubar)
def toggle_visibility(self):
self.frame.visible = not self.frame.visible
def add_component(self, c):
self.remove_component()
self.frame.add(c, BorderLayout.PAGE_START)
self.component = c
def remove_component(self):
if self.component is not None:
self.frame.remove(self.component)
self.component = None
def add(self, text, type="input"):
self.outputpane.addtext(text, type)
self.frame.validate()
def error(self, text):
self.outputpane.addtext(text, "error", ensure_newline=True)
def write(self, text):
self.add(text, "output")
# Code execution methods
def runcode(self, source, interactive=True):
if not source.strip():
return True
processed_source = source.replace("$", "geo.")
code = self.interface.compileinteractive(processed_source)
if code in ("continue", "error"):
code = self.interface.compilemodule(processed_source)
if code == "error":
return
if code == "error":
return False
source = source.strip()
if interactive:
self.history.append(source)
self.current_text = ""
self.outputpane.addtext(source +'\n', "input", ensure_newline=True)
self.interface.run(code)
示例2: main
# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import remove [as 别名]
def main():
binNaviProxy = StandAlone.getPluginInterface()
binNaviProxy.databaseManager.addDatabase("","com.mysql.jdbc.Driver","localhost","BINNAVI1","binnavi","binnavi",False,False)
db=binNaviProxy.databaseManager.databases[0]
db.connect()
db.load()
mods=db.getModules()
### initiate dialogBox to setect the module that should be used.
######################################################
frame = JFrame('BinNavi Module Selector',layout=BorderLayout(),
defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
size = (1500, 800)
)
frame2 = JFrame('Function Selector',layout=BorderLayout(),
defaultCloseOperation = JFrame.EXIT_ON_CLOSE,
size = (30, 30)
)
frame2.setFocusableWindowState(False)
frame2.setFocusable(False)
frame2.setAlwaysOnTop(False)
#convert the module list into the string to be used in the TextBox.
textTemp = map((lambda x,y:"[%d]%s"%(x,y)),range(len(mods)),mods)
textStr=''.join(textTemp)
tx=JTextArea(textStr)
tx.setLineWrap(True);
tx.setWrapStyleWord(True);
frame.add(tx,BorderLayout.PAGE_START)
frame.visible = True
modInd = JOptionPane.showInputDialog(frame2, "Enter the index of the chosen module",
"Module selector");
#Open the module returned by the index
bfname=mods[int(modInd)] # this modules correxponds to the chosen module
bfname.load()
funcViews=bfname.views
#textTemp2 = ["[%d]%s"%(i,j) for i in range(len(funcViews)) for j in funcViews]
textTemp2=map((lambda x,y:"[%d]%s"%(x,y.toString()[5:18])),range(len(funcViews)),funcViews)
textStr1=''.join(textTemp2)
## remove the older text from the frame view
frame.remove(tx)
frame.update(frame.getGraphics())
frame.visible = False
## create a new textArea with the string made from all the functions' name
txStr=JTextArea(textStr1)
#tx.setsrcollOffset(20)
txStr.setLineWrap(True);
txStr.setWrapStyleWord(True);
frame.add(txStr,BorderLayout.PAGE_START)
frame.update(frame.getGraphics())
frame.visible = True
funcInd = JOptionPane.showInputDialog(frame2, "Enter the index of the function",
"Function selector");
######################################################
bffunc=bfname.views[int(funcInd)] #this is the view of the buildfname function
bffunc.load()
frame2.setVisible(False)
dispose(frame2)
bfReil=bffunc.getReilCode() # this is the REIL code of the function
bfReilGraph=bfReil.getGraph()
instGraph = InstructionGraph.create(bfReilGraph)
time.clock()
results=doAnalysis(instGraph)
totalTime=time.clock()
#print "resultsLen", len([r for r in results])
print "**** printing results *******\n"
print "Total time:", totalTime, '\n'
numNode=0
for n in instGraph:
numNode+=numNode
nIn=list(results.getState(n).inVal)
nIn.sort(key=itemgetter(0))
nOut=list(results.getState(n).out)
nOut.sort(key=itemgetter(0))
print '@@ ',n.getInstruction(),'\n'
print '\t In', nIn, '\n'
print '\t OUT', nOut, '\n'
print '\t memory: ',results.getState(n).memoryWritten, '\n'
print "++++ Total instructions: %d +++++\n"%numNode
#finally close the view of the function
bffunc.close()
#print bffunc.isLoaded()
#junky=raw_input("function closed. enter any charater")
#.........这里部分代码省略.........
示例3: PythonWindow
# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import remove [as 别名]
class PythonWindow(KeyListener):
def __init__(self):
self.frame = JFrame("Python Window")
#self.historyList = JList(DefaultListModel())
#self.historyList.cellRenderer = MyListCellRenderer()
scrollpane = JScrollPane()
inputPanel = JPanel()
inputPanel.layout = GridLayout(1, 1)
self.input = JTextArea("")
self.input.border = BorderFactory.createEmptyBorder(5, 5, 5, 5)
self.input.tabSize = 4
self.input.font = Font("Monospaced", Font.PLAIN, 12)
self.input.addKeyListener(self)
inputPanel.add(self.input)
self.outputpane = OutputPane()
scrollpane.viewport.view = self.outputpane.textpane #self.historyList
self.frame.add(scrollpane, BorderLayout.CENTER)
self.frame.add(inputPanel, BorderLayout.PAGE_END)
self.frame.size = 500, 600
self.frame.visible = False
self.component = None
def toggle_visibility(self):
self.frame.visible = not self.frame.visible
def add_component(self, c):
self.remove_component()
self.frame.add(c, BorderLayout.PAGE_START)
self.component = c
def remove_component(self):
if self.component is not None:
self.frame.remove(self.component)
self.component = None
def add(self, text, type="input"):
self.outputpane.addtext(text, type)
#self.historyList.model.addElement({"text": text, "type": type})
#self.historyList.validate()
self.frame.validate()
#last = self.historyList.model.getSize() - 1
#self.historyList.ensureIndexIsVisible(last)
def error(self, text):
self.outputpane.addtext(text, "error", ensure_newline=True)
def write(self, text):
self.add(text, "output")
def run(self, evt):
source = self.input.text
if not source.strip():
self.input.text = ""
return
processed_source = source.replace("$", "geo.")
code = interface.compileinteractive(processed_source)
if code in ("continue", "error"):
code = interface.compilemodule(processed_source)
if code == "error":
return
source = source.strip() + '\n'
self.outputpane.addtext(source, "input", ensure_newline=True)
result = interface.run(code)
if result == "OK":
self.input.text = ""
def keyPressed(self, evt):
pass
def keyReleased(self, evt):
pass
def keyTyped(self, evt):
if evt.keyChar == '\n':
# Only try to run compound statements when they end with
# two \n
source = self.input.text
lines = source.split("\n")
if lines[0].rstrip().endswith(":") and not source.endswith("\n\n"):
for i, c in enumerate(lines[-2]):
if c not in ' \t': break
else:
self.run(evt)
return
prefix = lines[-2][:i]
if lines[-2].endswith(":"):
prefix += '\t'
self.input.text = source + prefix
else:
self.run(evt)