table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF) setColumnWidths(table) frame.add(JScrollPane(table)) frame.pack() size = frame.getSize() loc = frame.getLocation() frame.setLocation( Point(loc.x - (size.width >> 1), loc.y - (size.height >> 1))) frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(KeyBindings()) if 'AdminConfig' in dir(): if sys.version.startswith('2.1'): msg = '\nPress <Enter> to terminate this application: ' else: msg = '' raw_input(msg) else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
val = model.getValueAt(row, idx) if not i: section = val.startswith('_') fm = metrics[section] # FontMetric lines = max(lines, int(round(fm.stringWidth(val) / pre) + 1)) table.setRowHeight(row, lines * h0) #----------------------------------------------------------------------- # Set the preferred viewport size so we don't (initially) see scrollbars #----------------------------------------------------------------------- table.setPreferredScrollableViewportSize( Dimension(tWidth, sections * table.getRowHeight())) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: if 'AdminConfig' in dir(): EventQueue.invokeLater(SecConfigReport_06()) raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script requires a WebSphere environment.' print 'Usage: wsadmin -f SecConfigReport_06.py' else: print '\nError: This script should be executed, not imported.\n' print 'Usage: wsadmin -f %s.py' % __name__ sys.exit()
# Note: Invoked by the Swing Event Dispatch Thread #--------------------------------------------------------------------------- def run(self): frame = JFrame('verticalBox', locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) box = Box.createVerticalBox() box.add(JLabel('<---- Top ---->')) box.add(JLabel('<---- Mid ---->')) box.add(JLabel('<---- Bot ---->')) frame.add(box) frame.pack() frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(vBox()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
button = JToggleButton( # Make a toggle button 'Off' , # Initial button text itemStateChanged = self.toggle # Event handler ) frame.add( button ) frame.setVisible( 1 ) #----------------------------------------------------------------------------- # Name: toggle() # Role: Used to handle itemStateChanged events when the button is pressed #----------------------------------------------------------------------------- def toggle( self, event ) : button = event.getItem() button.setText( [ 'Off', 'On' ][ button.isSelected() ] ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( ToggleButton() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
#--------------------------------------------------------------------------- def run(self): frame = JFrame( 'SpinEdit3', size=(200, 106), # size = ( 200, 116 ), locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) table = JTable(tm(), rowHeight=20) # table = JTable( tm(), rowHeight = 25 ) table.setDefaultRenderer(JSpinner, sRenderer()) table.setDefaultEditor(JSpinner, editor()) frame.add(JScrollPane(table)) frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(SpinEdit3()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
'SplitPane3', defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) frame.add( JSplitPane( JSplitPane.VERTICAL_SPLIT, JButton( 'Top' ), JSplitPane( JSplitPane.HORIZONTAL_SPLIT, JButton( 'Left' ), JButton( 'Right' ), ) ) ) frame.pack() frame.setVisible( 1 ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( SplitPane3() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
self.width = JTextField(4) self.height = JTextField(4) self.x = JTextField(4) self.y = JTextField(4) items = [[JLabel('Width:'), 11, 7], [self.width, 50, 5], [JLabel('Height:'), 7, 31], [self.height, 50, 30], [JLabel('X:'), 35, 55], [self.x, 50, 53], [JLabel('Y:'), 35, 79], [self.y, 50, 78]] for item in items: thing = frame.add(item[0]) size = thing.getPreferredSize() thing.setBounds(item[1], item[2], size.width, size.height) frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(Frame2()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
#--------------------------------------------------------------------------- # Name: run() # Role: Instantiate the user class # Note: Invoked by the Swing Event Dispatch Thread #--------------------------------------------------------------------------- def run(self): frame = JFrame('NumbEdit', size=(500, 100), locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) table = JTable(tm()) frame.add(JScrollPane(table)) frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(NumbEdit()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
return tree #--------------------------------------------------------------------------- # Name: select() # Role: TreeSelectionListener valueChanged event handler #--------------------------------------------------------------------------- def select(self, event): tree = event.getSource() # Get access to tree count = tree.getSelectionCount() sPath = tree.getSelectionModel().getSelectionPath() if sPath: # How deep is the pick? depth = sPath.getPathCount() else: # Nothing selected depth = 0 self.buttons['Remove'].setEnabled(count and depth > 1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(DynamicTree()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
#--------------------------------------------------------------------------- # Name: textFile() # Role: Load and return the contents of specified file. #--------------------------------------------------------------------------- def textFile(self, filename): result = '' try: f = open(filename) result = f.read() f.close() except: Type, value = sys.exc_info()[:2] result = '%s\n%s' % (Type, value) return result #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(FrameMethods()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
# Role: Instantiate the user class # Note: Invoked by the Swing Event Dispatch Thread #--------------------------------------------------------------------------- def run(self): self.frame = frame = JFrame('FormattedTextFieldDemo', layout=GridLayout(0, 2), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) self.addFTF('getInstance()') self.addFTF('getCurrencyInstance()') self.addFTF('getIntegerInstance()') self.addFTF('getNumberInstance()') self.addFTF('getPercentInstance()') frame.pack() frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(FormattedTextFieldDemo()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
) frame.add( JTextField( 'Enter "pass"', inputVerifier = inputChecker() ), BorderLayout.NORTH ) frame.add( JTextField( 'TextField 2' ), BorderLayout.SOUTH ) frame.pack() frame.setVisible( 1 ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( VerifierTest2() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
print('No mode') def checkPos(self,event): global mode mode = 0 mouseMove(check_pos) def getCurrentPos(self, event): global mode print('Start to Get mouse pos') mode = 4 Thread.sleep(3000) print('Get mouse pos') mouse_pos = Env.getMouseLocation() print('Current mouse pos: x:' + mouse_pos.x + ' y:' + mouse_pos.y) def stop(self, event): if self.timer: self.timer.cancel() self.frame.dispose() self.dispose() def __del__(self): if self.timer: self.timer.cancel() print('Deconstructor') if __name__ == '__main__': EventQueue.invokeLater(MainFrame())
) def getRemediationBackground(self): return "This is an <b>informational</b> finding only.<br>" def getIssueDetail(self): out = "" for i in range(0, len(self.scopes)): out = out + "Data sent: " + str( self.datas[i]) + " as scope: " + str(self.scopes[i]) + "<br>" return str( "Burp Scanner has analysed the following response for postMessage() issues <b>" "%s</b><br><br>%s" % (self.reqres.getUrl().toString(), out)) def getRemediationDetail(self): return None def getHttpMessages(self): #print ("................raising issue................") rra = [self.reqres] return rra def getHttpService(self): return self.reqres.getHttpService() if __name__ in ('__main__', 'main'): EventQueue.invokeLater(Run(BurpExtender))
#--------------------------------------------------------------------------- # Name: about() # Role: Event handler for "Help" -> "About" menu item #--------------------------------------------------------------------------- def about(self, event): print 'Menu6.about()' #--------------------------------------------------------------------------- # Name: exit() # Role: Event handler for "File" -> "Exit" menu item #--------------------------------------------------------------------------- def exit(self, event): print 'Menu6.exit()' sys.exit() #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(Menu6()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
# -*- coding: utf-8 -*- from java.awt import EventQueue from java.lang import Runnable from gui.Gui import Gui class AwtRun(Runnable): def run(self): gui = Gui() gui.draw() if __name__ == '__main__': EventQueue.invokeLater(AwtRun())
print ' anchor:', c.anchor print ' fill:', c.fill print ' insets:', c.insets print ' ipadx:', c.ipadx print ' ipady:', c.ipady for name in '1,2,3 being the third number'.split( ',' ) : container.add( JButton( name ) ) #--------------------------------------------------------------------------- # Name: buttonPress() # Role: Event handler #--------------------------------------------------------------------------- def buttonPress( self, event ) : print event #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( GridBagLayoutDemo() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
) ) ComboBox.addActionListener( self ) self.msg = frame.add( JLabel() ) frame.setVisible( 1 ) #--------------------------------------------------------------------------- # Name: actionPerformed() # Role: Event handler associated withe the JComboBox #--------------------------------------------------------------------------- def actionPerformed( self, event ) : ComboBox = event.getSource() msg = 'Selection: ' + ComboBox.getSelectedItem() self.msg.setText( msg ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( EditableComboBox() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
for item in data: button = frame.add(JButton(item[0])) size = button.getPreferredSize() button.setBounds(insets.left + item[1], insets.top + item[2], size.width + item[3], size.height + item[4]) # Define the application frame size frame.setSize( 300 + insets.left + insets.right, # frame width 150 + insets.top + insets.bottom # frame height ) # Make the frame visible frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(AbsoluteLayout()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
font = Font( 'Courier' , Font.PLAIN, 12 ) ) ) ) frame.pack() size = frame.getSize() # print 'frame.getSize():', size loc = frame.getLocation() # print 'frame.getLocation():', loc loc.x -= ( size.width >> 1 ) loc.y -= ( size.height >> 1 ) frame.setLocation( loc ) frame.setVisible( 1 ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : if 'AdminConfig' in dir() : EventQueue.invokeLater( WSAShelp_01() ) raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script requires a WebSphere environment.' print 'Usage: wsadmin -f WSAShelp_01.py' else : print '\nError: This script should be executed, not imported.\n' print 'Usage: wsadmin -f %s.py' % __name__ sys.exit()
'Table4', size = ( 300, 200 ), locationRelativeTo = None, defaultCloseOperation = JFrame.EXIT_ON_CLOSE ) headings = 'Date,size,Location'.split( ',' ) frame.add( JScrollPane( JTable( myTM( self.data, headings ), selectionMode = ListSelectionModel.SINGLE_SELECTION ) ) ) frame.setVisible( 1 ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( Table4() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
#--------------------------------------------------------------------------- # Name: caretPositionChanged() # Role: InputMethodListener event handler #--------------------------------------------------------------------------- def caretPositionChanged(self, e): print 'caretPositionChanged() :', e #--------------------------------------------------------------------------- # Name: inputMethodTextChanged() # Role: InputMethodListener event handler #--------------------------------------------------------------------------- def inputMethodTextChanged(self, e): print 'inputMethodTextChanged() :', e #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(List6()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
'Notice', JOptionPane.WARNING_MESSAGE ) #--------------------------------------------------------------------------- # Name: update() # Role: Invoked when the user presses <Enter> # Note: Instances of javax.swing.SwingWorker are not reusuable, so we create # new instances for every update. #--------------------------------------------------------------------------- def update( self, event ) : WSAStask( self ).execute() #------------------------------------------------------------------------------- # Role: main entry point - verify that the script was executed, not imported. # Note: wsadmin in WebSphere Application Server v 6.1 uses 'main', not '__main__' # However, it is important to note that the version of Jython that is # provided with WSAS V 6.1 does not include the SwingWorker class #------------------------------------------------------------------------------- if __name__ == '__main__' : if 'AdminConfig' in dir() : EventQueue.invokeLater( consoleTimeout_04() ) raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script requires the WebSphere Application Server product.' print 'Usage: wsadmin -f consoleTimeout_04.py' else : print '\nError: This script should be executed, not imported.\n' print 'Usage: wsadmin -f %s.py' % __name__ sys.exit()
class Spinner4(java.lang.Runnable): #--------------------------------------------------------------------------- # Name: run() # Role: Instantiate the user class # Note: Invoked by the Swing Event Dispatch Thread #--------------------------------------------------------------------------- def run(self): frame = JFrame('Spinner4', layout=FlowLayout(), defaultCloseOperation=JFrame.EXIT_ON_CLOSE) frame.add(JSpinner(SpinnerDateModel())) frame.pack() frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(Spinner4()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
self.addCB(cp, 'No') self.addCB(cp, 'Maybe') self.label = frame.add(JLabel('Nothing selected')) frame.setVisible(1) #----------------------------------------------------------------------------- # Name: toggle() # Role: Used to handle itemStateChanged events when the selection is made #----------------------------------------------------------------------------- def toggle(self, event): cb = event.getItem() text = cb.getText() state = ['No', 'Yes'][cb.isSelected()] self.label.setText('%s selected? %s' % (text, state)) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(CheckBoxes()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
task.addPropertyChangeListener( self ) task.execute() #--------------------------------------------------------------------------- # Name: propertyChange() # Role: PropertyChangeListener event handler for progressTask instance #--------------------------------------------------------------------------- def propertyChange( self, event ) : if event.getPropertyName() == 'progress' : progress = event.getNewValue() self.progressBar.setValue( progress ) if progress == 100 : self.button.setEnabled( 1 ) # else : # print 'progressUpdate:', event.getPropertyName() #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( ProgressBar2() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
self.classes = result #----------------------------------------------------------------------- # Did the user just move the cursor, or did they change the text field? #----------------------------------------------------------------------- if text != self.prevText : # print 'dot: %2d text: "%s"' % ( e.getDot(), text ) model = DefaultListModel() items = [ item for item in self.classes if item.find( text ) > -1 ] if len( items ) > 0 : for item in items : model.addElement( item ) else : model.addElement( 'No matching classes found.' ) self.List.setModel( model ) self.prevText = text #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( javadocInfo_10() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
def propertyUpdate(self, event): PM, task = self.PM, self.task if event.getPropertyName() == 'progress': progress = event.getNewValue() # integer % complete lo, hi = PM.getMinimum(), PM.getMaximum() here = int((hi - lo) * 0.01 * progress) + lo # print '%3d%% of %3d..%3d = %3d' % ( progress, lo, hi, here ) PM.setProgress(here) PM.setNote('%d%% Complete' % progress) done = task.isDone() if PM.isCanceled() or done: if not done: task.cancel(1) self.button.setEnabled(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(ProgressMonitor6()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
def run(self): frame = JFrame('AdminTask commandGroups', locationRelativeTo=None, defaultCloseOperation=JFrame.EXIT_ON_CLOSE) tree = self.groupTree() tree.getSelectionModel().setSelectionMode( TreeSelectionModel.SINGLE_TREE_SELECTION) frame.add(JScrollPane(tree, preferredSize=(300, 300)), BorderLayout.CENTER) frame.pack() print frame.getSize() frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: if 'AdminConfig' in dir(): EventQueue.invokeLater(ATgroups()) raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script requires a WebSphere environment.' print 'Usage: wsadmin -f ATgroups.py' else: print '\nError: This script should be executed, not imported.\n' print 'Usage: wsadmin -f %s.py' % __name__ sys.exit()
#----------------------------------------------------------------------- # Then, we replace the frame ContentPane with a JDesktopPane instance # for all of the inner frames, and populate it with our eventLogger # inner frame instance. #----------------------------------------------------------------------- self.desktop = desktop = JDesktopPane() self.logger = eventLogger() desktop.add(self.logger, 0, 0) frame.setContentPane(desktop) #----------------------------------------------------------------------- # Initialize the number of inner frames created #----------------------------------------------------------------------- self.iFrameCount = 0 frame.setVisible(1) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in ['__main__', 'main']: EventQueue.invokeLater(iFrameEvents2()) if 'AdminConfig' in dir(): raw_input('\nPress <Enter> to terminate the application:\n') else: print '\nError: This script should be executed, not imported.\n' which = ['wsadmin -f', 'jython']['JYTHON_JAR' in dir(sys)] print 'Usage: %s %s.py' % (which, __name__) sys.exit()
frame.add( JButton( 'Press me', actionPerformed = self.buttonPressed ) ) frame.pack() frame.setVisible( 1 ) #--------------------------------------------------------------------------- # Name: buttonPressed() # Role: Invoked when the associated button is pressed #--------------------------------------------------------------------------- def buttonPressed( self, e ) : print 'button pressed' #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( ButtonDemo_03a() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
frame.add( self.label, BorderLayout.SOUTH ) frame.setVisible( 1 ) #--------------------------------------------------------------------------- # Name: showFC() # Role: Demonstrate use of JFileChooser #--------------------------------------------------------------------------- def showFC( self, event ) : fc = JFileChooser() result = fc.showOpenDialog( None ) if result == JFileChooser.APPROVE_OPTION : message = 'result = "%s"' % fc.getSelectedFile() else : message = 'Request canceled by user' self.label.setText( message ) #------------------------------------------------------------------------------- # Name: anonymous # Role: Verify that the script was executed, and not imported and instantiate # the user application class on the Swing Event Dispatch Thread #------------------------------------------------------------------------------- if __name__ in [ '__main__', 'main' ] : EventQueue.invokeLater( FileChooserDemo1() ) if 'AdminConfig' in dir() : raw_input( '\nPress <Enter> to terminate the application:\n' ) else : print '\nError: This script should be executed, not imported.\n' which = [ 'wsadmin -f', 'jython' ][ 'JYTHON_JAR' in dir( sys ) ] print 'Usage: %s %s.py' % ( which, __name__ ) sys.exit()
self.view.unlock() elif (code == KeyEvent.VK_E): nbrActor = self.view.GetRenderer().GetNumberOfPropsRendered() print("Number of actors rendered : " + str(nbrActor)) print("Number of actors : " + str(self.view.GetRenderer().GetViewProps().GetNumberOfItems())) elif code == KeyEvent.VK_P: print self.view.GetRenderer().GetActiveCamera() canvas.addKeyListener(MyKeyListener(canvas)) style = vtkInteractorStyleTrackballCamera() style.AutoAdjustCameraClippingRangeOn() canvas.getIren().SetInteractorStyle(style) # Run these commands in the Event Dispatch Thread, otherwise an # IllegalMonitorStateException may be raised. class RunInEventDispatchThread(Thread): def __init__(self, frame, canvas): self.frame = frame self.canvas = canvas def run(self): self.frame.setVisible(True) self.canvas.cameraManager.fitAll() EventQueue.invokeLater(RunInEventDispatchThread(frame, canvas)) if options.batch: Utils.takeScreenshot(canvas, options.batch) sys.exit(0)