示例#1
0
    def initUI(self):

        panel = JPanel()
        panel.setLayout(None)
        panel.setBackground(Color(66, 66, 66))
        self.getContentPane().add(panel)

        rot = ImageIcon("input.png")
        rotLabel = JLabel(rot)
        rotLabel.setBounds(20, 20, rot.getIconWidth(), rot.getIconHeight())

        min = ImageIcon("cpuoutput.png")
        minLabel = JLabel(min)
        minLabel.setBounds(40, 160, min.getIconWidth(), min.getIconHeight())

        bar = ImageIcon("inputdata.png")
        barLabel = JLabel(bar)
        barLabel.setBounds(170, 50, bar.getIconWidth(), bar.getIconHeight())


        panel.add(rotLabel)
        panel.add(minLabel)
        panel.add(barLabel)


        self.setTitle("Absolute")
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setSize(350, 300)
        self.setLocationRelativeTo(None)
        self.setVisible(True)
示例#2
0
    def initUI(self):

        panel = JPanel()
        panel.setLayout(None)
        panel.setBackground(Color(66, 66, 66))
        self.getContentPane().add(panel)

        rot = ImageIcon("input.png")
        rotLabel = JLabel(rot)
        rotLabel.setBounds(20, 20, rot.getIconWidth(), rot.getIconHeight())

        min = ImageIcon("cpuoutput.png")
        minLabel = JLabel(min)
        minLabel.setBounds(40, 160, min.getIconWidth(), min.getIconHeight())

        bar = ImageIcon("inputdata.png")
        barLabel = JLabel(bar)
        barLabel.setBounds(170, 50, bar.getIconWidth(), bar.getIconHeight())

        panel.add(rotLabel)
        panel.add(minLabel)
        panel.add(barLabel)

        self.setTitle("Absolute")
        self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE)
        self.setSize(350, 300)
        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")
        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)

        inputImage = ImageIcon("input.png")
        #JLabel imageLabel = inputImage

        label1 = JLabel(inputImage)
        label1.setBounds(1, 1, inputImage.getIconWidth(),
                         inputImage.getIconHeight())

        #label1.setVerticalTextPosition(JLabel.BOTTOM)
        #label1.setHorizontalTextPosition(JLabel.CENTER)
        #label1.setSize(1,1)
        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
    def initUI(self):

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

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

        joclButton = JButton("JOCL")
        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)
		
        inputImage = ImageIcon("input.png")
        #JLabel imageLabel = inputImage


        label1 = JLabel(inputImage)
        label1.setBounds(1, 1, inputImage.getIconWidth(), inputImage.getIconHeight())

        #label1.setVerticalTextPosition(JLabel.BOTTOM)
        #label1.setHorizontalTextPosition(JLabel.CENTER)
        #label1.setSize(1,1)
        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)
示例#5
0
class ButtonPanel(Panel):
	
	playButton = None
	helpButton = None
	resetButton = None
	exitButton = None

	def __init__(self, inconsolePanel,dialogPanel):
		self.consolePanel = inconsolePanel
		self.dialogPanel = dialogPanel
		Panel.__init__(self, "gap 1px 1px, insets 0 0 0 0, flowy")

	def initUI(self):

		self.setBackground(Color(0, 50, 0))

		self.playButtonS = ImageIcon('bin/gui/media/' + "playButton.png")
		self.helpButtonS = ImageIcon('bin/gui/media/' + "helpButton.png")
		self.resetButtonS = ImageIcon('bin/gui/media/' + "resetButton.png")
		self.exitButtonS = ImageIcon('bin/gui/media/' + "exitButton.png")
		self.playButtonU = ImageIcon('bin/gui/media/' + "playButton_unselected.png")
		self.helpButtonU = ImageIcon('bin/gui/media/' + "helpButton_unselected.png")
		self.resetButtonU = ImageIcon('bin/gui/media/' + "resetButton_unselected.png")
		self.exitButtonU = ImageIcon('bin/gui/media/' + "exitButton_unselected.png")

		class MouseHoverAdap(MouseAdapter):
			def __init__(self, butt, entImage, leaImage):
				self.entImage = entImage
				self.leaImage = leaImage
				self.butt = butt
				self.butt.setIcon(self.leaImage)
			def mouseEntered(self, m):
				self.butt.setIcon(self.entImage)
				#self.butt.repaint()
			def mouseExited(self, m):
				self.butt.setIcon(self.leaImage)
				#self.butt.repaint()


		self.playButton = JButton(self.playButtonS)
		self.playButton.setForeground(Color(0, 245, 0))
		#self.playButton.setPreferredSize(Dimension(playButton.getIconWidth(), playButton.getIconHeight()))
		#self.playButton.setBackground(Color(125, 125, 25))
		self.playButton.setMaximumSize(Dimension(self.playButtonS.getIconWidth(), self.playButtonS.getIconHeight()))
		self.playButton.setContentAreaFilled(False)

		self.helpButton = JButton(self.helpButtonS)
		self.helpButton.setForeground(Color(0, 235, 0))
		self.helpButton.setMaximumSize(Dimension(self.helpButtonS.getIconWidth(), self.helpButtonS.getIconHeight()))
		self.helpButton.setContentAreaFilled(False)

		self.resetButton = JButton(self.resetButtonS)
		self.resetButton.setForeground(Color(0, 225, 0))
		self.resetButton.setMaximumSize(Dimension(self.resetButtonS.getIconWidth(), self.resetButtonS.getIconHeight()))
		self.resetButton.setContentAreaFilled(False)

		self.exitButton = JButton(self.exitButtonS)
		self.exitButton.setForeground(Color(0, 215, 0))
		self.exitButton.setContentAreaFilled(False)
		self.exitButton.setMaximumSize(Dimension(self.exitButtonS.getIconWidth(), self.exitButtonS.getIconHeight()))
		
		# self.playButton.addMouseListener(MouseHoverAdap(self.playButton, self.playButtonS, self.playButtonU))
		# self.helpButton.addMouseListener(MouseHoverAdap(self.helpButton, self.helpButtonS, self.helpButtonU))
		# self.resetButton.addMouseListener(MouseHoverAdap(self.resetButton, self.resetButtonS, self.resetButtonU))
		# self.exitButton.addMouseListener(MouseHoverAdap(self.exitButton, self.exitButtonS, self.exitButtonU))


		class PlayButtonActionListener(ActionListener):
			def actionPerformed(button, e):
				self.dialogPanel.speak(self.consolePanel.console.do_play(''))
		self.playButton.addActionListener(PlayButtonActionListener())

		class HelpBUttonActionListener(ActionListener):
			def actionPerformed(button, e):
				self.dialogPanel.speak(self.consolePanel.console.do_hint(''))
		self.helpButton.addActionListener(HelpBUttonActionListener())

		class ResetButtonActionListener(ActionListener):
			def actionPerformed(button, e):
				self.dialogPanel.speak(self.consolePanel.console.do_reset(''))
		self.resetButton.addActionListener(ResetButtonActionListener())

		class ExitButtonActionListener(ActionListener):
			def actionPerformed(button, e):
				System.exit(0)
		self.exitButton.addActionListener(ExitButtonActionListener())





	def addUI(self):
		self.add(self.playButton, "push, grow")
		self.add(self.helpButton, "push, grow")
		self.add(self.resetButton, "push, grow")
		self.add(self.exitButton, "push, grow")
示例#6
0
文件: demo.py 项目: fran-jo/SimuGUI
  def __init__(self):
    self.panel = JPanel()
    self.panel.setLayout(BorderLayout())
    frame = JFrame("GUI Development ")
    frame.setSize(800, 600)
    frame.setLayout(BorderLayout())

    splitPane = JSplitPane(JSplitPane.VERTICAL_SPLIT);

    self.textfield1 = JTextField('Type something here')
    self.textfield1.setColumns(40);
    #self.textfield1.setRows(5);
    #self.textfield2 = JTextField('Dont write anythong',30)
    label1 = JLabel("Command:")
    panel1 = JPanel()
    '''
    '''
    jMenuBar1 = JMenuBar()
    jMenu1 = JMenu()
    jMenu2 = JMenu()
    jMenuItem1 = JMenuItem('Open', actionPerformed=self.onClick)
    jMenuItem2 = JMenuItem()
    jMenu1.setText('File')
    jMenu2.setText('Simulation')
    
    #jMenuItem1.setText('Open')
    jMenuItem2.setText('Exit')
    jMenu1.add(jMenuItem1)
    jMenu1.add(jMenuItem2)
    jMenuBar1.add(jMenu1)
    
    jMenuItem21 = JMenuItem('Simulation Options',actionPerformed=self.writeText)
    jMenuItem22 = JMenuItem('Simulate',actionPerformed=self.writeText)
    jMenuItem23 = JMenuItem('Generate FMU',actionPerformed=self.writeText)
    
#     jMenuItem21.setText('Run Project')
#     jMenuItem22.setText('Generate FMU')
    jMenu2.add(jMenuItem21)
    jMenu2.add(jMenuItem22)
    jMenu2.add(jMenuItem23)
    jMenuBar1.add(jMenu2)
    frame.setJMenuBar(jMenuBar1)
    
    '''
    '''
    panel1.add(label1,BorderLayout.WEST)
    panel1.add(self.textfield1, BorderLayout.CENTER)
    copyButton = JButton('send',actionPerformed=self.copyText)
    panel1.add(copyButton, BorderLayout.EAST)
    #panel1.add(self.textfield2, BorderLayout.SOUTH)
    splitPane.setLeftComponent(panel1);
    '''
    
   image adding in the frame
    
    
    '''
    
    #imPanel.add(imPanel,BorderLayout.WEST)
    #imPanel.setBackground(Color(66, 66, 66))
    imPanel1 = JPanel()
    rot = ImageIcon("ballon.jpg")
    rotLabel = JLabel(rot)
    rotLabel.setBounds(0,0, rot.getIconWidth(), rot.getIconHeight())
    imPanel1.add(rotLabel, BorderLayout.SOUTH)
    frame.add(imPanel1, BorderLayout.SOUTH)
    
    '''
    panel for text area adding in split pan 
    
    '''
    tabPane = JTabbedPane(JTabbedPane.TOP)

    label = JLabel("<html><br>This is a tab1</html>")
    panel1 = JPanel()
    panel1.setBackground(Color.lightGray)
    panel23 = JPanel()
    panel23.setBackground(Color.black)
    panel1.add(panel23,BorderLayout.SOUTH)
    panel1.add(label,BorderLayout.NORTH)
    '''
    adding button in the panel1
    '''
    writeButton = JButton('write')
    panel1.add(writeButton, BorderLayout.WEST)
    tabPane.addTab("tab1", panel1)
    
    
    #frame.add(panel1,BorderLayout.EAST)
    #panel1.setBackground(Color(66, 66, 66))
#     rot1 = ImageIcon("ballon.jpg",BorderLayout.SOUTH)
#     rotLabel1 = JLabel(rot1)
#     rotLabel1.setBounds(0,0, rot.getIconWidth(), rot.getIconHeight())
#     panel1.add(rotLabel1)

    label2 = JLabel("This is a tab2")

    panel2 = JPanel()
    panel2.setBackground(Color.lightGray)
    panel2.add(label2)
    tabPane.addTab("tab2", panel2)

#     imPanel2 =JPanel()
    self.textarea = JTextArea('Write something from commandLine')
    self.textarea.setColumns(40);
    self.textarea.setRows(40);
 
    panel2.add(self.textarea, BorderLayout.NORTH)

    splitPane.setRightComponent(tabPane);
    splitPane.setDividerLocation(60);

    frame.add(splitPane)
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE)
    frame.setVisible(True)
示例#7
0
class ButtonPanel(Panel):

    playButton = None
    helpButton = None
    resetButton = None
    exitButton = None

    def __init__(self, inconsolePanel, dialogPanel):
        self.consolePanel = inconsolePanel
        self.dialogPanel = dialogPanel
        Panel.__init__(self, "gap 1px 1px, insets 0 0 0 0, flowy")

    def initUI(self):

        self.setBackground(Color(0, 50, 0))

        self.playButtonS = ImageIcon('bin/gui/media/' + "playButton.png")
        self.helpButtonS = ImageIcon('bin/gui/media/' + "helpButton.png")
        self.resetButtonS = ImageIcon('bin/gui/media/' + "resetButton.png")
        self.exitButtonS = ImageIcon('bin/gui/media/' + "exitButton.png")
        self.playButtonU = ImageIcon('bin/gui/media/' +
                                     "playButton_unselected.png")
        self.helpButtonU = ImageIcon('bin/gui/media/' +
                                     "helpButton_unselected.png")
        self.resetButtonU = ImageIcon('bin/gui/media/' +
                                      "resetButton_unselected.png")
        self.exitButtonU = ImageIcon('bin/gui/media/' +
                                     "exitButton_unselected.png")

        class MouseHoverAdap(MouseAdapter):
            def __init__(self, butt, entImage, leaImage):
                self.entImage = entImage
                self.leaImage = leaImage
                self.butt = butt
                self.butt.setIcon(self.leaImage)

            def mouseEntered(self, m):
                self.butt.setIcon(self.entImage)
                #self.butt.repaint()
            def mouseExited(self, m):
                self.butt.setIcon(self.leaImage)
                #self.butt.repaint()

        self.playButton = JButton(self.playButtonS)
        self.playButton.setForeground(Color(0, 245, 0))
        #self.playButton.setPreferredSize(Dimension(playButton.getIconWidth(), playButton.getIconHeight()))
        #self.playButton.setBackground(Color(125, 125, 25))
        self.playButton.setMaximumSize(
            Dimension(self.playButtonS.getIconWidth(),
                      self.playButtonS.getIconHeight()))
        self.playButton.setContentAreaFilled(False)

        self.helpButton = JButton(self.helpButtonS)
        self.helpButton.setForeground(Color(0, 235, 0))
        self.helpButton.setMaximumSize(
            Dimension(self.helpButtonS.getIconWidth(),
                      self.helpButtonS.getIconHeight()))
        self.helpButton.setContentAreaFilled(False)

        self.resetButton = JButton(self.resetButtonS)
        self.resetButton.setForeground(Color(0, 225, 0))
        self.resetButton.setMaximumSize(
            Dimension(self.resetButtonS.getIconWidth(),
                      self.resetButtonS.getIconHeight()))
        self.resetButton.setContentAreaFilled(False)

        self.exitButton = JButton(self.exitButtonS)
        self.exitButton.setForeground(Color(0, 215, 0))
        self.exitButton.setContentAreaFilled(False)
        self.exitButton.setMaximumSize(
            Dimension(self.exitButtonS.getIconWidth(),
                      self.exitButtonS.getIconHeight()))

        # self.playButton.addMouseListener(MouseHoverAdap(self.playButton, self.playButtonS, self.playButtonU))
        # self.helpButton.addMouseListener(MouseHoverAdap(self.helpButton, self.helpButtonS, self.helpButtonU))
        # self.resetButton.addMouseListener(MouseHoverAdap(self.resetButton, self.resetButtonS, self.resetButtonU))
        # self.exitButton.addMouseListener(MouseHoverAdap(self.exitButton, self.exitButtonS, self.exitButtonU))

        class PlayButtonActionListener(ActionListener):
            def actionPerformed(button, e):
                self.dialogPanel.speak(self.consolePanel.console.do_play(''))

        self.playButton.addActionListener(PlayButtonActionListener())

        class HelpBUttonActionListener(ActionListener):
            def actionPerformed(button, e):
                self.dialogPanel.speak(self.consolePanel.console.do_hint(''))

        self.helpButton.addActionListener(HelpBUttonActionListener())

        class ResetButtonActionListener(ActionListener):
            def actionPerformed(button, e):
                self.dialogPanel.speak(self.consolePanel.console.do_reset(''))

        self.resetButton.addActionListener(ResetButtonActionListener())

        class ExitButtonActionListener(ActionListener):
            def actionPerformed(button, e):
                System.exit(0)

        self.exitButton.addActionListener(ExitButtonActionListener())

    def addUI(self):
        self.add(self.playButton, "push, grow")
        self.add(self.helpButton, "push, grow")
        self.add(self.resetButton, "push, grow")
        self.add(self.exitButton, "push, grow")