def complex_console(): global frame #generates frame frame = JFrame("[BETA] Game Master\'s Bot - Console Log") frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) frame.setResizable(False) frame.setAlwaysOnTop(True) frame.setBounds(8,545,600,130) frame.contentPane.layout = FlowLayout() #add QUIT button quitButton = JButton("QUIT", actionPerformed = closeFrame) quitButton.setForeground(Color.RED) quitButton.setPreferredSize(Dimension(100,100)) frame.contentPane.add(quitButton) #add text message global textArea textArea = JTextArea(6,38) textArea.setEditable(False) frame.contentPane.add(textArea) scrollPane = JScrollPane(textArea, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) frame.contentPane.add(scrollPane) #show frame frame.pack() frame.setVisible(True) log("Welcome to Game Master\'s Bot!")
def __init__(self): w = JFrame("Settler-o-matic", size = (120,680)) w.setAlwaysOnTop(True) pause = JButton("Pause", actionPerformed = self.pause) w.add(pause, SOUTH) w.visible = True self.window = w self.pause = pause
def simple_console(): global frame frame = JFrame("[BETA] GameMaster Bot - Log") frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE) frame.setBounds(0,45,560,30) global messageLOG messageLOG = JLabel("") frame.add(messageLOG,BorderLayout.CENTER) button = JButton("QUIT", actionPerformed =closeFrame) button.setForeground(Color.RED) frame.add(button,BorderLayout.WEST) frame.setUndecorated(True) frame.setAlwaysOnTop(True) frame.setVisible(True) log("Welcome to GameMaster\'s Bot!")
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") print "Done! Closing the module selector window" frame.setVisible(False) dispose(frame)
def resume(event): global next_run global countdown next_run = 0 countdown = 0 # ===================== DÉFINITION DU MESSAGE D AVERTISSEMENT DE SCRIPT EN EXÉCUTION ============= from javax.swing import JFrame, JTextArea, JButton, JPanel from java.awt import Color as JC from java.awt import Font as JFONT box = JFrame('FOE Robot', defaultCloseOperation=JFrame.EXIT_ON_CLOSE) box.setAlwaysOnTop(True) layout = JPanel() layout.setLayout(None) box.add(layout) msg = JTextArea( "ATTENTION - SCRIPT EN COURS D'EXECUTION - VEUILLEZ EVITER DE TOUCHER A LA SOURIS" ) #\n msg.setEditable(False) msg.setBackground(JC.yellow) msg.setFont(JFONT("Dialog", JFONT.PLAIN, 25)) msg.setBounds(0, 0, 1250, 50) layout.add(msg) status = JTextArea(text="") #\n status.editable = False
###################################################### 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()