コード例 #1
0
    def initUI(self):
       
        self.panel = JPanel(size=(50,50))
        

        self.panel.setLayout(FlowLayout( ))
        self.panel.setToolTipText("GPU Demo")

#TODO- change this so that it deletes itself when text is entered
        self.textfield1 = JTextField('Smoothing Parameter',15)        
        self.panel.add(self.textfield1)
      
        joclButton = JButton("JOCL",actionPerformed=self.onJocl)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        self.panel.add(joclButton)
        
        javaButton = JButton("Java",actionPerformed=self.onJava)
        javaButton.setBounds(100, 500, 100, 30)
        javaButton.setToolTipText("Java Button")
        self.panel.add(javaButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        self.panel.add(qButton)
        newImage = ImageIO.read(io.File(getDataDir() + "input.png"))
        resizedImage =  newImage.getScaledInstance(600, 600,10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Input Image",newIcon, JLabel.CENTER)

        label1.setVerticalTextPosition(JLabel.TOP)
        label1.setHorizontalTextPosition(JLabel.RIGHT)
        label1.setSize(10,10)
        label1.setBackground(Color.orange)
        self.panel.add(label1)
        
        self.getContentPane().add(self.panel)
        
        self.clockLabel = JLabel()
        self.clockLabel.setSize(1,1)
        self.clockLabel.setBackground(Color.orange)
        
        self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
        self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)
        
        myClockFont = Font("Serif", Font.PLAIN, 50)
        self.clockLabel.setFont(myClockFont)
        
        
        self.panel.add(self.clockLabel)
        
        self.setTitle("Structure-oriented smoothing OpenCL Demo")
        self.setSize(1200, 700)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
コード例 #2
0
ファイル: demo2.py プロジェクト: ke0m/Senior_Design
    def initUI(self):

        self.panel = JPanel(size=(50, 50))

        self.panel.setLayout(FlowLayout())
        self.panel.setToolTipText("GPU Demo")

        self.textfield1 = JTextField('Smoothing Parameter', 15)
        self.panel.add(self.textfield1)

        joclButton = JButton("JOCL", actionPerformed=self.onJocl)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        self.panel.add(joclButton)

        javaButton = JButton("Java", actionPerformed=self.onJava)
        javaButton.setBounds(100, 500, 100, 30)
        javaButton.setToolTipText("Java Button")
        self.panel.add(javaButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        self.panel.add(qButton)
        newImage = ImageIO.read(io.File("input.png"))
        resizedImage = newImage.getScaledInstance(600, 600, 10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Input Image", newIcon, JLabel.CENTER)

        label1.setVerticalTextPosition(JLabel.TOP)
        label1.setHorizontalTextPosition(JLabel.RIGHT)
        label1.setSize(10, 10)
        label1.setBackground(Color.orange)
        self.panel.add(label1)

        self.getContentPane().add(self.panel)

        self.clockLabel = JLabel()
        self.clockLabel.setSize(1, 1)
        self.clockLabel.setBackground(Color.orange)

        self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
        self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)

        myClockFont = Font("Serif", Font.PLAIN, 50)
        self.clockLabel.setFont(myClockFont)

        self.panel.add(self.clockLabel)

        self.setTitle("GPU Demo")
        self.setSize(1200, 600)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
コード例 #3
0
    def initUI(self):

        panel = JPanel(size=(50,50))
        

        panel.setLayout(BorderLayout( ))
        panel.setToolTipText("A Panel container")

        joclButton = JButton("JOCL", actionPerformed=self.onJOCL)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        panel.add(joclButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        panel.add(qButton)
		
		
		
        newImage = ImageIO.read(io.File("input.png"))
        resizedImage =  newImage.getScaledInstance(500, 500,10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Image and Text",newIcon, JLabel.	CENTER)

        label1.setVerticalTextPosition(JLabel.BOTTOM)
        label1.setHorizontalTextPosition(JLabel.CENTER)
        label1.setSize(10,10)
        panel.add(label1)
        
        self.getContentPane().add(panel)
        self.setTitle("GPU Demo")
        self.setSize(1200, 600)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
コード例 #4
0
ファイル: demo2.py プロジェクト: ke0m/Senior_Design
class Demo(JFrame, Runnable):
    def __init__(self):
        super(Demo, self).__init__()

        self.initUI()

    def initUI(self):

        self.panel = JPanel(size=(50, 50))

        self.panel.setLayout(FlowLayout())
        self.panel.setToolTipText("GPU Demo")

        self.textfield1 = JTextField('Smoothing Parameter', 15)
        self.panel.add(self.textfield1)

        joclButton = JButton("JOCL", actionPerformed=self.onJocl)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        self.panel.add(joclButton)

        javaButton = JButton("Java", actionPerformed=self.onJava)
        javaButton.setBounds(100, 500, 100, 30)
        javaButton.setToolTipText("Java Button")
        self.panel.add(javaButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        self.panel.add(qButton)
        newImage = ImageIO.read(io.File("input.png"))
        resizedImage = newImage.getScaledInstance(600, 600, 10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Input Image", newIcon, JLabel.CENTER)

        label1.setVerticalTextPosition(JLabel.TOP)
        label1.setHorizontalTextPosition(JLabel.RIGHT)
        label1.setSize(10, 10)
        label1.setBackground(Color.orange)
        self.panel.add(label1)

        self.getContentPane().add(self.panel)

        self.clockLabel = JLabel()
        self.clockLabel.setSize(1, 1)
        self.clockLabel.setBackground(Color.orange)

        self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
        self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)

        myClockFont = Font("Serif", Font.PLAIN, 50)
        self.clockLabel.setFont(myClockFont)

        self.panel.add(self.clockLabel)

        self.setTitle("GPU Demo")
        self.setSize(1200, 600)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)

    def onQuit(self, e):
        System.exit(0)

    def onJocl(self, e):
        self.clockLabel.setText('running')
        self.started = Calendar.getInstance().getTimeInMillis()
        #print self.textfield1.getText()
        #time.sleep(5)
        iters = toInt(self.textfield1.getText())
        jocl_smoother(iters)
        elapsed = Calendar.getInstance().getTimeInMillis() - self.started
        self.clockLabel.setText('JOCL Elapsed: %.2f seconds' %
                                (float(elapsed) / 1000.0))

    def onJava(self, e):
        self.clockLabel.setText('running')
        self.started = Calendar.getInstance().getTimeInMillis()
        #print self.textfield1.getText()
        #time.sleep(5)
        iters = toInt(self.textfield1.getText())
        java_smoother(iters)
        elapsed = Calendar.getInstance().getTimeInMillis() - self.started
        self.clockLabel.setText('Java Elapsed: %.2f seconds' %
                                (float(elapsed) / 1000.0))
コード例 #5
0
class Demo(JFrame, Runnable):

    def __init__(self):
        super(Demo, self).__init__()

        self.initUI()

    def initUI(self):
       
        self.panel = JPanel(size=(50,50))
        

        self.panel.setLayout(FlowLayout( ))
        self.panel.setToolTipText("GPU Demo")

#TODO- change this so that it deletes itself when text is entered
        self.textfield1 = JTextField('Smoothing Parameter',15)        
        self.panel.add(self.textfield1)
      
        joclButton = JButton("JOCL",actionPerformed=self.onJocl)
        joclButton.setBounds(100, 500, 100, 30)
        joclButton.setToolTipText("JOCL Button")
        self.panel.add(joclButton)
        
        javaButton = JButton("Java",actionPerformed=self.onJava)
        javaButton.setBounds(100, 500, 100, 30)
        javaButton.setToolTipText("Java Button")
        self.panel.add(javaButton)

        qButton = JButton("Quit", actionPerformed=self.onQuit)
        qButton.setBounds(200, 500, 80, 30)
        qButton.setToolTipText("Quit Button")
        self.panel.add(qButton)
        newImage = ImageIO.read(io.File(getDataDir() + "input.png"))
        resizedImage =  newImage.getScaledInstance(600, 600,10)
        newIcon = ImageIcon(resizedImage)
        label1 = JLabel("Input Image",newIcon, JLabel.CENTER)

        label1.setVerticalTextPosition(JLabel.TOP)
        label1.setHorizontalTextPosition(JLabel.RIGHT)
        label1.setSize(10,10)
        label1.setBackground(Color.orange)
        self.panel.add(label1)
        
        self.getContentPane().add(self.panel)
        
        self.clockLabel = JLabel()
        self.clockLabel.setSize(1,1)
        self.clockLabel.setBackground(Color.orange)
        
        self.clockLabel.setVerticalTextPosition(JLabel.BOTTOM)
        self.clockLabel.setHorizontalTextPosition(JLabel.LEFT)
        
        myClockFont = Font("Serif", Font.PLAIN, 50)
        self.clockLabel.setFont(myClockFont)
        
        
        self.panel.add(self.clockLabel)
        
        self.setTitle("Structure-oriented smoothing OpenCL Demo")
        self.setSize(1200, 700)
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
        
    def onQuit(self, e): System.exit(0)
    
    def onJocl(self, e): 
     self.clockLabel.setText('running')
     self.started = Calendar.getInstance().getTimeInMillis();
     #print self.textfield1.getText()  
     #time.sleep(5)
     iters = toInt(self.textfield1.getText())
     jocl_smoother(iters)
     elapsed = Calendar.getInstance().getTimeInMillis() - self.started;
     self.clockLabel.setText( 'JOCL Elapsed: %.2f seconds' % ( float( elapsed ) / 1000.0 ) )
    
    def onJava(self, e): 
     self.clockLabel.setText('running')
     self.started = Calendar.getInstance().getTimeInMillis();
     #print self.textfield1.getText()  
     #time.sleep(5)
     iters = toInt(self.textfield1.getText())
     java_smoother(iters)
     elapsed = Calendar.getInstance().getTimeInMillis() - self.started;
     self.clockLabel.setText( 'Java Elapsed: %.2f seconds' % ( float( elapsed ) / 1000.0 ) )