当前位置: 首页>>代码示例>>Python>>正文


Python JFrame.setLocation方法代码示例

本文整理汇总了Python中javax.swing.JFrame.setLocation方法的典型用法代码示例。如果您正苦于以下问题:Python JFrame.setLocation方法的具体用法?Python JFrame.setLocation怎么用?Python JFrame.setLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.JFrame的用法示例。


在下文中一共展示了JFrame.setLocation方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: tree

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
def tree():
  """
  tree(xmlfile="dsm2.xml")
    creates a tree view on a given xml file of dsm2 input data
  """
  tv = TreeViewer()
  mp2 = JPanel()
  mp2.setLayout(BorderLayout())
  tf = JTextField("dsm2.inp")
  pb = JButton("parse")
  mp2.add(tf,BorderLayout.CENTER)
  mp2.add(pb,BorderLayout.EAST)
  class ParseListener(ActionListener):
    def __init__(self,tf,tv,fr):
      self.tf = tf
      self.tv = tv
      self.fr = fr
    def actionPerformed(self,evt):
      dsm2file = self.tf.getText()
      parser = DSM2Parser(dsm2file)
      self.tv.xdoc = parser.dsm2_data.toXml()
      self.fr.getContentPane().add(self.tv.gui(),BorderLayout.CENTER)
      self.fr.pack()
      self.fr.setVisible(1)
  fr = JFrame()
  fr.setTitle("DSM2Tree")
  fr.setLocation(100,100)
  fr.setSize(600,60)
  fr.getContentPane().setLayout(BorderLayout())
  fr.getContentPane().add(mp2,BorderLayout.NORTH)
  al = ParseListener(tf,tv,fr)
  pb.addActionListener(al)
  fr.pack()
  fr.setVisible(1)
开发者ID:GTP-CalLitGUI,项目名称:CalLiteGUI_RW1,代码行数:36,代码来源:dsm2.py

示例2: positionDialog

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
class positionDialog(JFrame):
    def __init__(self):
        self.frame = JFrame("CellCropper: Experiment details", size=(400,200))
        self.frame.setLocation(20,120)
        self.Panel = JPanel(GridLayout(4,2))
        self.frame.add(self.Panel)
        self.Panel.add(JLabel("Date:"))
        self.dateField = JTextField( str(date.today()), 8 )
        self.Panel.add(self.dateField)
        self.strainField = JTextField( "2926",4 )
        self.Panel.add(self.strainField)
        self.tempField = JTextField( "34",2 )
        self.Panel.add(self.tempField)
        self.ODField = JTextField( "0.5",3 )
        self.Panel.add(self.ODField)
        self.condField = JTextField( "0.5",3 )
        self.Panel.add(self.condField)

        self.OKButton = JButton("OK",actionPerformed=closeAndMakePos)
        self.Panel.add(self.OKButton)
        self.frame.pack()
        WindowManager.addWindow(self.frame)
        self.show()

    def show(self):
        self.frame.visible = True
    
    def close(self):
        return self.dateField.text, self.strainField.text, self.tempField.text, self.ODField.text, self.condField.text
        WindowManager.removeWindow(self.frame)
        self.frame.dispose()
开发者ID:schiklen,项目名称:DotObjects,代码行数:33,代码来源:CellCropper_V4.py

示例3: gui_open

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
 def gui_open(path):
     label = JLabel(ImageIcon(ImageIO.read(File(URL(path).getFile()))))
     frame = JFrame()
     frame.getContentPane().add(label)
     frame.pack()
     frame.setLocation(200, 200)
     frame.setVisible(True)
开发者ID:ppawlak,项目名称:pystacia,代码行数:9,代码来源:compat.py

示例4: install

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
def install(helper):
  	print('install called'); 
	
	frame = JFrame("Please Input Values")
	frame.setLocation(100,100)
	frame.setSize(500,400)
	frame.setLayout(None)

	lbl1 = JLabel("Input1: ")
	lbl1.setBounds(60,20,60,20)
	txt1 = JTextField(100)
	txt1.setBounds(130,20,200,20)
	lbl2 = JLabel("Input2: ")
	lbl2.setBounds(60,50,100,20)
	txt2 = JTextField(100)
	txt2.setBounds(130,50,200,20)
	lbl3 = JLabel("Input3: ")
	lbl3.setBounds(60,80,140,20)
	txt3 = JTextField(100)
	txt3.setBounds(130,80,200,20)
	lbl4 = JLabel("Input4: ")
	lbl4.setBounds(60,110,180,20)
	txt4 = JTextField(100)
	txt4.setBounds(130,110,200,20)
	
	def getValues(event):
		print "clicked"
		ScriptVars.setGlobalVar("Input1",str(txt1.getText()))
		print(ScriptVars.getGlobalVar("Input1"))
		ScriptVars.setGlobalVar("Input2",str(txt2.getText()))
		print(ScriptVars.getGlobalVar("Input2"))
		ScriptVars.setGlobalVar("Input3",str(txt3.getText()))
		print(ScriptVars.getGlobalVar("Input3"))
		ScriptVars.setGlobalVar("Input4",str(txt4.getText()))
		print(ScriptVars.getGlobalVar("Input4"))		
		
	btn = JButton("Submit", actionPerformed = getValues)
	btn.setBounds(160,150,100,20)
		
	frame.add(lbl1)
	frame.add(txt1)
	frame.add(lbl2)
	frame.add(txt2)
	frame.add(btn)
	frame.add(lbl3)
	frame.add(txt3)
	frame.add(lbl4)
	frame.add(txt4)
	frame.setVisible(True)
开发者ID:thc202,项目名称:zap-extensions,代码行数:51,代码来源:getInputsFromuser.py

示例5: cachedBPROM

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
def cachedBPROM(genome, fileName, frame):
  """
  genome: Genome as a string.
  fileName: File to save the BPROM results in.
  swing: A JFrame or None.  If this is None then messages will be printed, if it isn't then
         they will also be put in a dialog box.

  return: Results of the BPROM prediction stored in a list of Promoter objects.

  If the file Specified by fileName already exists then this function simply parses the file
  already there.  Also, if a request is made to BPROM and nothing is returned, no file is
  created, the user is warned, and an empty list is returned.
  """
  offset = 25 if ".forward.bprom" in fileName else 50
  direction = "forward" if offset == 50 else "reverse"
    
  def getPromoters():
    input = open(fileName, "r")
    results = parseBPROM(input.read())
    input.close()
    return results

  if not os.path.isfile(fileName):
    results = urllib.urlopen("http://linux1.softberry.com/cgi-bin/programs/gfindb/bprom.pl",
                             urllib.urlencode({"DATA" : genome}))
    resultString = results.read()
    results.close()
    resultString = resultString[resultString.find("<pre>"):resultString.find("</pre>")]
    resultString = re.sub("<+.+>+", "", resultString).strip()
    if resultString:
      output = open(fileName, "w")
      output.write(resultString)
      output.close()
      return getPromoters()
    else:
      if frame:
        messageFrame = JFrame("BPROM Error",
                              defaultCloseOperation = WindowConstants.DISPOSE_ON_CLOSE)
        messageFrame.setLocation(frame.location().x + offset, frame.location().y + offset)
        messageFrame.contentPane.layout = GridBagLayout()
        constraints = GridBagConstraints()
        constraints.gridx, constraints.gridy = 0, 0
        constraints.gridwidth, constraints.gridheight = 1, 1
        constraints.fill = GridBagConstraints.BOTH
        constraints.weightx, constraints.weighty = 1, 1
        messageFrame.contentPane.add(JLabel("<html>The pipeline will continue to run but BPROM<br/>did not process the request for promoters on the<br/>" + direction + " strand.  Try again tomorrow.</html>"), constraints)
        constraints.gridx, constraints.gridy = 0, 1
        constraints.fill = GridBagConstraints.NONE
        constraints.weightx, constraints.weighty = 1, 1
        constraints.anchor = GridBagConstraints.LINE_END
        messageFrame.contentPane.add(JButton("Ok", actionPerformed = lambda e: messageFrame.dispose()), constraints)
        messageFrame.pack()
        messageFrame.visible = True
      print "BPROM Error:", "The pipeline will continue to run but BPROM did not process the request for promoters on the " + direction + " strand.  Try again tomorrow"
      return []
  else:
    return getPromoters()
开发者ID:pavithra03,项目名称:neofelis,代码行数:59,代码来源:promoters.py

示例6: __init__

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
  def __init__(self, title, display, panel):
    from java.awt import Toolkit
    from javax.swing import JFrame
    self.display = display

    frame = JFrame(title, windowClosing=self.desty)
    frame.getContentPane().add(panel)
    frame.pack()
    frame.invalidate()

    fSize = frame.getSize()
    screensize = Toolkit.getDefaultToolkit().getScreenSize()
    frame.setLocation((screensize.width - fSize.width)/2,
                      (screensize.height - fSize.height)/2)
    frame.setVisible(1)
开发者ID:Devanshi26,项目名称:visad,代码行数:17,代码来源:NuView.py

示例7: geom_viewer

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
def geom_viewer(dsm2file = "dsm2.inp"):
  """
  geom_viewer(dsm2file = "dsm2.inp")
  starts off a dsm2 geometry viewer for dsm2 input data
  Irregular xsections are plotted if available otherwise
  regular xsections are plotted.
  """
  dgv = DSM2GeomViewer(dsm2file)
  mp = dgv.gui()
  fr = JFrame()
  fr.setTitle('Geom Viewer')
  fr.getContentPane().add(mp)
  fr.setLocation(300,100)
  fr.pack()
  sz = fr.getSize()
  fr.setSize(250,sz.height)
  fr.setVisible(1)
开发者ID:GTP-CalLitGUI,项目名称:CalLiteGUI_RW1,代码行数:19,代码来源:dsm2.py

示例8: MenueFrame

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
class MenueFrame(object):
   def __init__(self):
      self.mainDir = ""
   
      self.frame = JFrame("Dots Quality Check", size=(250,300))
      self.frame.setLocation(20,120)
      self.Panel = JPanel(GridLayout(0,1))
      self.frame.add(self.Panel)

      self.openNextButton = JButton('Open Next Random',actionPerformed=openRandom)
      self.Panel.add(self.openNextButton)
      
      self.saveButton = JButton('Save',actionPerformed=save)
      self.saveButton.setEnabled(False)
      self.Panel.add(self.saveButton)

      self.cropButton = JButton('Crop values from here', actionPerformed=cropVals)
      self.Panel.add(self.cropButton)

      self.DiscardButton = JButton('Discard cell', actionPerformed=discardCell)
      self.DiscardButton.setEnabled(True)
      self.Panel.add(self.DiscardButton)

      self.quitButton = JButton('Quit script',actionPerformed=quit)
      self.Panel.add(self.quitButton)

      annoPanel = JPanel()
      #add gridlayout
      wtRButton = JRadioButton("wt", actionCommand="wt")
      defectRButton = JRadioButton("Defect", actionCommand="defect")
      annoPanel.add(wtRButton)
      annoPanel.add(defectRButton)
      self.aButtonGroup = ButtonGroup()
      self.aButtonGroup.add(wtRButton)
      self.aButtonGroup.add(defectRButton)
      
      self.Panel.add(annoPanel)

      self.ProgBar = JProgressBar()
      self.ProgBar.setStringPainted(True)
      self.ProgBar.setValue(0)
      self.Panel.add(self.ProgBar)

      self.pathLabel = JLabel("-- No main directory chosen --")
      self.pathLabel.setHorizontalAlignment( SwingConstants.CENTER )
      self.Panel.add(self.pathLabel)

      
      WindowManager.addWindow(self.frame)
      self.show()

   def show(self):
      self.frame.visible = True

   def getFrame(self):
      return self.frame

   def setSaveActive(self):
      self.saveButton.setEnabled(True)
      self.show()

   def setSaveInactive(self):
      self.saveButton.setEnabled(False)
      self.show()

   def setMainDir(self, path):
      self.mainDir = path
      self.pathLabel.setText("MainDir: " + os.path.basename(os.path.split(self.mainDir)[0]))

   def getMainDir(self):
      return self.mainDir

   def setProgBarMax(self, maximum):
      self.ProgBar.setMaximum(maximum)

   def setProgBarVal(self, value):
      self.ProgBar.setValue(value)

   def close():
      WindowManager.removeWindow(self.frame)
      self.frame.dispose()     
开发者ID:schiklen,项目名称:BatchMeasurement,代码行数:83,代码来源:04-QualityControl_v8j.py

示例9: Menue

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
class Menue(object):
    def __init__(self, p):
        self.cellCounter = 1
        self.olay = Overlay()
        self.position = p
        print p.getRoiPath()
        if p.getRoiPath() != None:         # check if there is an existing overlay file and load it!
            p.loadRois()

        self.frame = JFrame("CellCropper", size=(200,200))
        self.frame.setLocation(20,120)
        self.Panel = JPanel(GridLayout(0,1))
        self.frame.add(self.Panel)
        #self.nameField = JTextField("p" + "_c",15)
        self.nameField = JTextField("p" + str(self.position.getID()) + "_c",15)
        self.Panel.add(self.nameField)
        self.cutoutButton = JButton("Cut out cell",actionPerformed=cut)
        self.Panel.add(self.cutoutButton)
        self.delOlButton = JButton("Delete Overlay",actionPerformed=delOverlay)
        self.Panel.add(self.delOlButton)
        self.saveOlButton = JButton("Save Overlay",actionPerformed=saveOverlay)
        self.Panel.add(self.saveOlButton) 
        self.quitButton = JButton("Quit script",actionPerformed=quit)
        self.Panel.add(self.quitButton)
        self.frame.pack()
        WindowManager.addWindow(self.frame)
        self.show()
        #IJ.setTool("freehand")

    '''def getPosition(self, path, filename):
       moved to containers.position.determineID(path, filename)'''

    def eventtest(self, event):
        print "eventtest"

    def setTextField(self, pos):
        name = "p" + str(pos) + "_c"
        self.nameField.setText(name)

    def openOl(self, path, fileName):
        print "aaaaah"

    def show(self):
        self.frame.visible = True

    def close(self):
        if self.olay != None:
            yncd = YesNoCancelDialog(self.frame, "Save overlay?", "Save overlay?") #frame, title, message
            if yncd.yesPressed():
                self.saveOverlay()
        WindowManager.removeWindow(self.frame)
        self.frame.dispose()
        
    def resetCounter(self):
        self.cellCounter = 0
        
    def increaseCounter(self):
        self.cellCounter += 1
        
    def setCounter(self):
        self.cellCounter += 1
        
    #'get' functions
    def getImp(self):
        return self.imp
    
    def getCounter(self):
        return self.cellCounter
        
    def getFrame(self):
        return self.frame
        
    def getFilePath(self):
        return self.filePath

    def getTextField(self):
        return self.nameField.text
    
    def getPosition(self):
        return self.position
    
    # overlay functions
    def addOlay(self, roi):
        self.olay.add(roi)

    def getOverlay(self):
        return self.olay

    def clearOverlay(self):
        self.olay.clear()
        self.cellCounter = 1

    def saveOverlay(self):
        self.position.saveRois()   
开发者ID:schiklen,项目名称:DotObjects,代码行数:96,代码来源:CellCropper_V4.py

示例10: __init__

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
class NewAccountGUI:
    def __init__(self, amgui):
        self.amgui = amgui
        self.am = amgui.acctmanager
        self.buildgwinfo()
        self.autologin = JCheckBox("Automatically Log In")
        self.acctname = JTextField()
        self.gwoptions = JPanel(doublebuffered)
        self.gwoptions.border = TitledBorder("Gateway Options")
        self.buildgwoptions("Twisted")
        self.mainframe = JFrame("New Account Window")
        self.buildpane()

    def buildgwinfo(self):
        self.gateways = {
            "Twisted": {
                "ident": JTextField(),
                "passwd": JPasswordField(),
                "host": JTextField("twistedmatrix.com"),
                "port": JTextField("8787"),
                "service": JTextField("twisted.words"),
                "persp": JTextField(),
            },
            "AIM": {
                "ident": JTextField(),
                "passwd": JPasswordField(),
                "host": JTextField("toc.oscar.aol.com"),
                "port": JTextField("9898"),
            },
            "IRC": {
                "ident": JTextField(),
                "passwd": JPasswordField(),
                "host": JTextField(),
                "port": JTextField("6667"),
                "channels": JTextField(),
            },
        }
        self.displayorder = {
            "Twisted": [
                ["Identity Name", "ident"],
                ["Password", "passwd"],
                ["Host", "host"],
                ["Port", "port"],
                ["Service Name", "service"],
                ["Perspective Name", "persp"],
            ],
            "AIM": [["Screen Name", "ident"], ["Password", "passwd"], ["Host", "host"], ["Port", "port"]],
            "IRC": [
                ["Nickname", "ident"],
                ["Password", "passwd"],
                ["Host", "host"],
                ["Port", "port"],
                ["Channels", "channels"],
            ],
        }

    def buildgwoptions(self, gw):
        self.gwoptions.removeAll()
        self.gwoptions.layout = GridLayout(len(self.gateways[gw]), 2)
        for mapping in self.displayorder[gw]:
            self.gwoptions.add(JLabel(mapping[0]))
            self.gwoptions.add(self.gateways[gw][mapping[1]])

    def buildpane(self):
        gw = JPanel(GridLayout(1, 2), doublebuffered)
        gw.add(JLabel("Gateway"))
        self.gwlist = JComboBox(self.gateways.keys())  # , actionPerformed=self.changegw)
        self.gwlist.setSelectedItem("Twisted")
        gw.add(self.gwlist)

        stdoptions = JPanel(GridLayout(2, 2), doublebuffered)
        stdoptions.border = TitledBorder("Standard Options")
        stdoptions.add(JLabel())
        stdoptions.add(self.autologin)
        stdoptions.add(JLabel("Account Name"))
        stdoptions.add(self.acctname)

        buttons = JPanel(FlowLayout(), doublebuffered)
        buttons.add(JButton("OK", actionPerformed=self.addaccount))
        buttons.add(JButton("Cancel", actionPerformed=self.cancel))

        mainpane = self.mainframe.getContentPane()
        mainpane.layout = BoxLayout(mainpane, BoxLayout.Y_AXIS)
        mainpane.add(gw)
        mainpane.add(self.gwoptions)
        mainpane.add(stdoptions)
        mainpane.add(buttons)

    def show(self):
        self.mainframe.setLocation(100, 100)
        self.mainframe.pack()
        self.mainframe.show()

    # actionlisteners
    def changegw(self, ae):
        self.buildgwoptions(self.gwlist.getSelectedItem())
        self.mainframe.pack()
        self.mainframe.show()

    def addaccount(self, ae):
#.........这里部分代码省略.........
开发者ID:galaxysd,项目名称:BitTorrent,代码行数:103,代码来源:jyaccount.py

示例11: __init__

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
class PokerApp:
    def __init__(self):
        self._frame = JFrame("PokerApp", size=(600,400), defaultCloseOperation=JFrame.EXIT_ON_CLOSE)

    def minimizeFrame(self, true_false):
        if true_false == True:
            self._frame.state = JFrame.ICONIFIED
        else:
            self._frame.MAXIMIZED_BOTH
#            self._frame.state = JFrame.NORMAL

    def launchPlayNowApp(self, action):
            
            self.playNowApp = PlayNowApp()
            self.pokerTable = PokerTable()
            if (action=="open") :
                self.playNowApp.open()
                self.msg.text += "Play now app opened"
            elif action=="playNowLogin":
                self.playNowApp.login()
                self.msg.text += "Logged into PlayNow app"
            elif action=="texasHoldem":
                self.playNowApp.go_to_texas_holdem()
            elif action=="practiceTable":
                self.playNowApp.go_to_practice_tables()
                self.minimizeFrame(False)
            elif action=="joinTable":
                self.pokerTable.join_table()
            elif action=="highlightObservations":
                self.pokerTable.highlight_regions_all()
            elif action=="leaveTable":
                self.pokerTable.leave_table()
            elif action=="playNowClose":
                self.playNowApp.close()
            else:
                self.minimizeFrame(True)
                self.playNowApp.open()
                self.msg.text += "Play now app opened"
                self.playNowApp.login()
                self.msg.text += "Logged into PlayNow app"
                self.playNowApp.go_to_texas_holdem()
                self.playNowApp.go_to_practice_tables()
                self.minimizeFrame(False)
                self.pokerTable.join_table()
                


    def getScreenSize(self):
        return Toolkit.getDefaultToolkit().getScreenSize()

    def setFrameLocation(self, side):
            screenSize = self.getScreenSize()
            if side == 'Right':
                self._frame.setSize( int(screenSize.width * 0.31), int(screenSize.height * 0.95) )
                self._frame.setLocation( int(screenSize.width * 0.69), 0 )
            

    def playNowApp_startThread(self, action):
            self.setFrameLocation("Right")
            Thread(name="AppLaunch", target=self.launchPlayNowApp, args=(action,) ).start()
            
            

    def setMenuBar(self):
        menuBar = JMenuBar()
        
        menuApp = JMenu("Apps")
        menuApp.setMnemonic('A')
        
        menuSettings = JMenu("Settings")
        menuSettings.setMnemonic('S')
        
        #set submenus
        menuPlayNow = JMenu("PlayNow" )
        
        menuPlayNowOpen = JMenuItem("Open", actionPerformed = (lambda x, param="open": self.playNowApp_startThread(param)) )
        menuPlayNow.add(menuPlayNowOpen)
        
        menuPlayNowLogin = JMenuItem("Login", actionPerformed = lambda x, action="playNowLogin": self.playNowApp_startThread(action) )
        menuPlayNow.add(menuPlayNowLogin)
        
        menuPlayNowClose = JMenuItem("Close", actionPerformed = lambda x, action="playNowClose": self.playNowApp_startThread(action) )
        menuPlayNow.add(menuPlayNowClose)
        
        menuPokerTable = JMenu("PokerTable")
        menuPokerTableJoin = JMenuItem("Find Practice Table", actionPerformed = lambda x, action="practiceTable": self.playNowApp_startThread(action) )
        menuPokerTable.add(menuPokerTableJoin)
        
        menuPokerTableJoin = JMenuItem("Join Table", actionPerformed = lambda x, action="joinTable": self.playNowApp_startThread(action) )
        menuPokerTable.add(menuPokerTableJoin)
        
        menuPokerTableAddChips = JMenuItem("Add Chips", actionPerformed = lambda x, action="addChips": self.playNowApp_startThread(action) )
        menuPokerTable.add(menuPokerTableAddChips)
        
        menuPokerTableSitOut = JMenuItem("Sit Out", actionPerformed = lambda x, action="sitOut": self.playNowApp_startThread(action) )
        menuPokerTable.add(menuPokerTableSitOut)
        
        menuPokerTableLeaveTable = JMenuItem("Leave Table", actionPerformed = lambda x, action="leaveTable": self.playNowApp_startThread(action) )
        menuPokerTable.add(menuPokerTableLeaveTable)
        
#.........这里部分代码省略.........
开发者ID:medikid,项目名称:holdem,代码行数:103,代码来源:PokerApp.py

示例12: correctionTable

# 需要导入模块: from javax.swing import JFrame [as 别名]
# 或者: from javax.swing.JFrame import setLocation [as 别名]
class correctionTable(TextPanel):
    """A class that displays an imagePlus and a resultstable. Resultstable and imp are linked in such a 
     way that click on a table row shows the imps respective timeframe."""
    def __init__(self, cell, mF, title="Results"): # add mF?
        # Call constructor of superclass
        TextPanel.__init__(self)
        # pass menue for setting save active/inactive
        self.cell = cell
        self.mF = mF
        # Create a window to show the content in
        self.window = JFrame()
        self.window.add(self)
        self.window.setTitle(title)
        # Add event listeners for keyboard and mouse responsiveness
        
        self.addKeyListener(ListenToKey())
        self.addMouseListener(ListenToMouse())
        
        # TODO: unpacking info out of cell object should be done in cell object itself and accessible e. g. via getData()
        self.imp = self.openImp(self.cell.getMeasTifPath())
        csvFile = open(self.cell.getCsvPath())        
        lines = csvFile.readlines()
        heads = lines.pop(0)
        self.setColumnHeadings("Frame\tDistance\tAnaphase")
        self.XYZtable = []
        for line in lines:      # load file lines in textPanel.
            frame, timepoint, dist, ch0x, ch0y, ch0z, ch0vol, ch1x, ch1y, ch1z, ch1vol = line.split(",")
            self.append(frame + "\t" + dist + "\t" )
            self.XYZtable.append((ch0x, ch0y, ch0z, ch0vol, ch1x, ch1y, ch1z, ch1vol))
        self.setSelection(0,0) # int startline, int endline
        self.changeFrame()
        self.mF.setSaveInactive()
        self.requestFocus()

        self.window.setSize(Dimension(220, 600))
        x = int(self.imp.getWindow().getLocation().getX()) + int(self.imp.getWindow().getWidth()) + 10
        self.window.setLocation(x, int(self.imp.getWindow().getLocation().getY()) )
        self.window.show()

    # Methods implementing KeyAdapter and MouseListener
    #... no multiple inheritance for Java classes?
    

    # - - - - Event driven methods - - - -
    # ------------------------------------

    def changeFrame(self):
        if self.getSelectionEnd() >= 0:
            frame, dist, AOCol = self.getLine(self.getSelectionEnd()).split("\t")
            self.imp.setSlice(int(frame)+1)
    
    def setAnaphase(self):
        frame, Distance, x = self.getLine(self.getSelectionEnd()).split("\t")
        #set anaphase onset
        self.cell.setAnOn(frame)
        for i in range(self.getLineCount()):   # very unelegantly solved, but it works.
            blFr, blDist, blAOCol = self.getLine(i).split("\t")
            self.setLine(i, blFr + "\t" + blDist + "\t")
            frame, distance, AOCol = self.getLine(self.getSelectionEnd()).split("\t") # get old line
            self.setLine(self.getSelectionEnd(), frame + "\t" + distance + "\tX")
        # setFocus back to tw,tp
        self.mF.setSaveActive()
        print "Anaphase set to", self.cell.getAnOn()

    def delVal(self):
        frame, distance, AOCol = self.getLine(self.getSelectionEnd()).split("\t")
        self.setLine(self.getSelectionEnd(), frame + "\tNA" + "\t" + AOCol)

    # - other methods
    def openImp(self, path):
        imp = ImagePlus(path)  # open associated tif file
        imp.show()
        imp.getWindow().setLocationAndSize(280, 120, imp.getWidth()*4, imp.getHeight()*4) # int x, int y, int width, int height
        return imp

    def getImp(self):
        return self.imp

    def getXYZtable(self):
        return self.XYZtable
        
    def closeWindows(self):
        self.imp.close()
        WindowManager.removeWindow(self.window)
        self.window.dispose()
开发者ID:schiklen,项目名称:BatchMeasurement,代码行数:87,代码来源:04-QualityControl_v9.py


注:本文中的javax.swing.JFrame.setLocation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。