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)
def createMainWindow(): # Create window frame = JFrame('Epiphany Core Visualisation', defaultCloseOperation=JFrame.EXIT_ON_CLOSE, size=(660, 675)) # Main layout mainLayout = JPanel() frame.add(mainLayout) # Title #title = JLabel('hello', JLabel.CENTER) #mainLayout.add(title) # Cores corepanel = JPanel(GridLayout(8, 8)) global cores cores = [] for i in range(0, 64): core = JPanel(GridLayout(2, 1)) core.setPreferredSize(Dimension(80, 80)) corename = '(' + str(i % 8) + ',' + str(i / 8) + ')' namelabel = JLabel(corename, JLabel.CENTER) namelabel.setFont(Font("Dialog", Font.PLAIN, 18)) portname = str(i + MINPORT) portlabel = JLabel(portname, JLabel.CENTER) portlabel.setFont(Font("Dialog", Font.PLAIN, 16)) core.add(namelabel) core.add(portlabel) core.setBackground(Color.BLACK) corepanel.add(core) cores.append(core) mainLayout.add(corepanel) frame.visible = True
def initUI(self): """ Finished Dialog box Simple dialog box that says "Finished", to bw displayed when all image analysis has finished. When OK button is pressed all ImageJ windows are closed. """ panel = JPanel() self.getContentPane().add(panel) panel.setBackground(Color.WHITE) panel.setLayout(None) self.setTitle("Analysis has finished") self.setSize(300, 150) OKbutton = JButton("OK", actionPerformed=self.onOK) OKbutton.setBackground(Color.BLACK) OKbutton.setBounds(80, 50, 100, 30) panel.add(OKbutton) Title = JTextArea("Analysis has finised!! :-)") Title.setBounds(15, 10, 250, 20) panel.add(Title) self.setLocationRelativeTo(None) self.setLocation(int(IJ.getScreenSize().width * 0.01), int(IJ.getScreenSize().height * 3 / 10)) self.setVisible(True)
def initMenuPanel(self): buttonPanel = JPanel(GridLayout(10, 1, 5, 5)) addAdmin = JButton('Add Admin', actionPerformed=self.addAdminPanel) deleteAdmin = JButton('Delete Admin', actionPerformed=self.addDeleteAdminPanel) regUser = JButton('Register User', actionPerformed=self.addRegPanel) deRegUser = JButton('De-Register User', actionPerformed=self.addDeregisterPanel) emgBypass = JButton('Emergency Bypass', actionPerformed=self.addEmergencyPanel) viewLogs = JButton('View Logs', actionPerformed=self.addViewLogsPanel) login = JButton('Login', actionPerformed=self.addLoginForm) logout = JButton('Logout', actionPerformed=self.logout) quit = JButton('Quit', actionPerformed=dialog.quitApplicationMsg) about = JButton('About', actionPerformed=self.addDefaultPanel) # buttonPanel.setPreferredSize(Dimension(200,350)) # self.setPreferredSize(Dimension(250,250)) #add widgets buttonPanel.setBackground(Color.decode('#3d4968')) buttonPanel.add(addAdmin) buttonPanel.add(deleteAdmin) buttonPanel.add(regUser) buttonPanel.add(deRegUser) buttonPanel.add(emgBypass) buttonPanel.add(viewLogs) buttonPanel.add(login) buttonPanel.add(logout) buttonPanel.add(quit) buttonPanel.add(about) self.menuPanel.add(buttonPanel)
def changePasswordForm(check): global frame global tfOldPassword global tfNewPassword global tfConfirmPassword global value value = check frame = JFrame("Change Password") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 350) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 350) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("Change Password") heading.setBounds(200, 30, 150, 40) lbOldPassword = JLabel("Old Password") lbNewPassword = JLabel("New Password") lbConfirmPassword = JLabel("Confirm Password") tfOldPassword = JTextField() tfNewPassword = JTextField() tfConfirmPassword = JTextField() lbOldPassword.setBounds(50, 100, 150, 30) lbNewPassword.setBounds(50, 150, 150, 30) lbConfirmPassword.setBounds(50, 200, 150, 30) tfOldPassword.setBounds(220, 100, 150, 30) tfNewPassword.setBounds(220, 150, 150, 30) tfConfirmPassword.setBounds(220, 200, 150, 30) btnSave = JButton("Save", actionPerformed=clickSave) btnCancel = JButton("Cancel", actionPerformed=clickCancel) btnSave.setBounds(350, 280, 100, 30) btnCancel.setBounds(50, 280, 100, 30) panel.add(heading) panel.add(lbOldPassword) panel.add(lbNewPassword) panel.add(lbConfirmPassword) panel.add(tfOldPassword) panel.add(tfNewPassword) panel.add(tfConfirmPassword) panel.add(btnSave) panel.add(btnCancel) frame.add(panel)
def addCourse(): global tfCourseName global tfCourseId global tfCourseFee global frame global btnEnter frame = JFrame("Add Course ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(450, 450) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(450, 450) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("ADD COURSE") heading.setBounds(200, 30, 150, 40) lbCourseName = JLabel("Course Name ") lbCourseId = JLabel("Course Id") lbCourseFee = JLabel(" Course Fee") tfCourseName = JTextField() tfCourseId = JTextField() tfCourseFee = JTextField() lbCourseName.setBounds(70, 120, 130, 30) lbCourseId.setBounds(70, 170, 130, 30) lbCourseFee.setBounds(70, 220, 130, 30) tfCourseName.setBounds(220, 120, 150, 30) tfCourseId.setBounds(220, 170, 150, 30) tfCourseFee.setBounds(220, 220, 150, 30) btnEnter = JButton("Enter", actionPerformed=clickAddCourseFee) btnEnter.setBounds(300, 300, 100, 40) btnCancel = JButton("Cancel", actionPerformed=clickCancel) btnCancel.setBounds(70, 300, 100, 40) panel.add(heading) panel.add(lbCourseName) panel.add(lbCourseId) panel.add(lbCourseFee) panel.add(tfCourseFee) panel.add(tfCourseName) panel.add(tfCourseId) panel.add(tfCourseFee) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
def studentLogined(stObj): global panel global table global heading global frame frame = JFrame("Student Page ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) panel = JPanel() panel.setSize(500, 580) panel.setLocation(0, 20) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.WHITE) heading = JLabel() heading.setBounds(210, 10, 200, 30) table = JTable() table.setBounds(0, 50, 500, 470) sp = JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) bar = JMenuBar() profile = JMenu("Profile") showProfile = JMenuItem("Show Profile", actionPerformed=clickShowStudentProfile) changePassword = JMenuItem("Change Password", actionPerformed=changeStudentPassword) profile.add(showProfile) profile.add(changePassword) bar.add(profile) attendence = JMenu("Attendence") showAllAttendence = JMenuItem("Show All Attendence", actionPerformed=clickAllAttendence) showAttendenceInMonth = JMenuItem("show attendence in month", actionPerformed=clickAttendenceInMonth) attendence.add(showAllAttendence) attendence.add(showAttendenceInMonth) bar.add(attendence) logout = JMenuItem("logout", actionPerformed=clickLogout) bar.add(logout) panel.add(table) frame.setJMenuBar(bar) frame.add(panel) frame.setVisible(True)
def addNotice(self): """ Add a panel that notifies the user about the model view not being ready yet. """ panel = JPanel() panel.setBackground(Color.yellow) label = JLabel("Please note Nammu's model view is under " "construction.") panel.add(label) return panel
def hhwindow(): #creates a function called hhwindow, this is a function we will call whenever we want to create a new window global win,mytext #the global statement creates variables “win” and “mytext” that can be referenced outside of just this function win = swing.JFrame("Inside the Haunted House") #creates a window as a variable we named “win”, the title of the window is inside the quotes panel = JPanel() #creates a panel inside the window for text as a variable we named “panel” panel.setLayout(None) #controls layout of panel panel.setBackground(Color(0, 0, 0)) #sets background color of window win.setSize(600,400) #sets window size win.setVisible(True) #makes window visible mytextLabel = JLabel(mytext) #adds text to the window in the form of a variable, yet to be defined, called “mytext” mytextLabel.setBounds(20, 20, 500, 400) #sets boundaries for the text, text will be centered by default within these boundaries panel.add(mytextLabel) #add the label to the panel win.add(panel) #add the panel to the window win.show() #show the window
def initUI(self): panel = JPanel() panel.setLayout(None) panel.setBackground(Color(66,66,66)) self.getContentPane().add(panel) #rot = ImageIcon() #rotLabel = JLabel(rot) #rotLabel.setBounds(40, 160, min.getIconWidth(), rot.getIconHeight()) self.setTitle("Layout Absoluto") self.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) self.setSize(350, 300) self.setLocationRelativeTo(None) self.setVisible(True)
def showLoginIdPassword(data): global frame frame = JFrame("Show Id Password ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500,350) frame.setLocation(200,200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500,350) panel.setLocation(0,0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("LoginId AND Password") heading.setBounds(200,30,150,40) lbLoginId = JLabel("LoginId") lbPassword = JLabel("password") tfLoginId = JTextField(data[0].encode('ascii')) tfPassword = JTextField(data[1].encode('ascii')) tfLoginId.setEditable(False) tfPassword.setEditable(False) lbLoginId.setBounds(50,100,150,30) lbPassword.setBounds(50,150,150,30) tfLoginId.setBounds(220,100,150,30) tfPassword.setBounds(220,150,150,30) btnOk = JButton("Ok",actionPerformed=clickOk) btnOk.setBounds(250,220,100,30) panel.add(heading) panel.add(lbLoginId) panel.add(lbPassword) panel.add(tfLoginId) panel.add(tfPassword) panel.add(btnOk) frame.add(panel)
def getCourseName(check): global frame global tfStudentCourseChoice global value value = check frame = JFrame("Course Name ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500,250) frame.setLocation(200,200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500,250) panel.setLocation(0,0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("Get Course Name") heading.setBounds(200,30,150,40) lbStudentCourseChoice = JLabel("Student course name") tfStudentCourseChoice = JTextField() lbStudentCourseChoice.setBounds(50,70,150,30) tfStudentCourseChoice.setBounds(220,70,150,30) btnEnter = JButton("Enter",actionPerformed=clickStudentCourseChoice) btnCancel = JButton("Cancel",actionPerformed=clickBtnCancel) btnEnter.setBounds(350,150,100,30) btnCancel.setBounds(50,150,100,30) panel.add(heading) panel.add(lbStudentCourseChoice) panel.add(tfStudentCourseChoice) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
def showAttendenceSheet(): global table global heading global frame global panel global btnSave global btnCancel frame = JFrame("Teacher Attendence Sheet ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 600) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.WHITE) heading = JLabel() heading.setBounds(200, 10, 150, 30) table = JTable() table.setBounds(0, 50, 500, 450) panel.add(table) btnSave = JButton("Save", actionPerformed=clickSaveBtn) btnCancel = JButton("Cancel", actionPerformed=clickCancelBtn) btnSave.setBounds(350, 540, 100, 40) btnCancel.setBounds(70, 540, 100, 40) panel.add(heading) panel.add(table) panel.add(btnSave) panel.add(btnCancel) frame.add(panel)
def showStudentAttendenceSheetAdminLogined(): global table global heading global frame global panel global btnok frame = JFrame("Student Attendence Sheet ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 600) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.WHITE) heading = JLabel("Student Attendence") heading.setBounds(200, 10, 150, 30) table = JTable() table.setBounds(0, 50, 500, 450) panel.add(table) btnOk = JButton("Ok", actionPerformed=clickOk) btnOk.setBounds(200, 540, 100, 40) panel.add(heading) panel.add(table) panel.add(btnOk) frame.add(panel)
def createMainWindow(): # Create window frame = JFrame('Epiphany Core Visualisation', defaultCloseOperation = JFrame.EXIT_ON_CLOSE, size = (660,675) ) # Main layout mainLayout = JPanel() frame.add(mainLayout) # Title #title = JLabel('hello', JLabel.CENTER) #mainLayout.add(title) # Cores corepanel = JPanel(GridLayout(8,8)) global cores cores = [] for i in range(0,64): core = JPanel(GridLayout(2,1)) core.setPreferredSize(Dimension(80,80)) corename = '(' + str(i%8) + ',' + str(i/8) + ')' namelabel = JLabel(corename, JLabel.CENTER) namelabel.setFont(Font("Dialog", Font.PLAIN, 18)) portname = str(i+MINPORT) portlabel = JLabel(portname, JLabel.CENTER) portlabel.setFont(Font("Dialog", Font.PLAIN, 16)) core.add(namelabel) core.add(portlabel) core.setBackground(Color.BLACK) corepanel.add(core) cores.append(core) mainLayout.add(corepanel) frame.visible = True
def reloadJPanel(game,dialog,node): c = JPanel() c.setBackground(Color.BLACK) layout = createLayoutManager(c,node.getAttribute("layout") if node.hasAttribute("layout") else "flow") c.setLayout(layout) c.setOpaque(False) if node.getAttribute("opaque"): c.setOpaque(node.getAttribute("opaque")=="true") if node.getAttribute("background"): if(node.getAttribute("background")=="orange"): c.setBackground(Color.ORANGE) elif(node.getAttribute("background")=="green"): c.setBackground(Color.GREEN) for child in node.childNodes: if child.nodeName!="#text": if node.getAttribute("layout")=="gridbag": c.add(reloadComponent(game,dialog,child),getGridBagConstraints(game,child)) else: c.add(reloadComponent(game,dialog,child))
def __init__(self, kconfig_file="Kconfig", config_file=".config", systemLogger=None): """[summary] Parameters ---------- kconfig_file : string (default: "Kconfig") The Kconfig configuration file config_file : string (default: ".config") The save file which will be used for loading and saving the settings systemLogger (default: None) A system logger object. If None then print statements are used for logging. """ global log if systemLogger: log = systemLogger # Load Kconfig configuration files self.kconfig = Kconfig(kconfig_file) setKConfig(self.kconfig) if os.path.isfile(config_file): log.info(self.kconfig.load_config(config_file)) elif os.path.isfile(".config"): log.info(self.kconfig.load_config(".config")) self.tree = KConfigTree(self.kconfig) self.tree.addTreeSelectionListener(self.treeSelectionChanged) jTreeSP = JScrollPane(self.tree) self.jta = JTextArea() self.jta.setEditable(False) jTextSP = JScrollPane(self.jta) toolPanel = JPanel() toolPanel.setLayout(BoxLayout(toolPanel, BoxLayout.X_AXIS)) toolPanel.setBorder(BorderFactory.createEmptyBorder(2, 0, 2, 0)) toolPanel.add(JLabel("Search: ")) jSearchPanel = JPanel() jSearchPanel.setLayout(BoxLayout(jSearchPanel, BoxLayout.X_AXIS)) self.jSearchField = JTextField() jSearchPanel.setBackground(self.jSearchField.getBackground()) jSearchPanel.setBorder(self.jSearchField.getBorder()) self.jSearchField.setBorder(None) self.jSearchField.getDocument().addDocumentListener( SearchListener(self.tree)) jSearchPanel.add(self.jSearchField) clearSearchButton = JButton(u'\u00d7', actionPerformed=self.clearSearch) d = clearSearchButton.getPreferredSize() clearSearchButton.setPreferredSize(Dimension(d.height, d.height)) clearSearchButton.setBackground(self.jSearchField.getBackground()) clearSearchButton.setBorder(None) clearSearchButton.setOpaque(False) clearSearchButton.setContentAreaFilled(False) clearSearchButton.setFocusPainted(False) jSearchPanel.add(clearSearchButton) toolPanel.add(jSearchPanel) self.showAllCheckBox = JCheckBox("Show all", actionPerformed=self.OnShowAllCheck) toolPanel.add(self.showAllCheckBox) splitPane = JSplitPane(JSplitPane.VERTICAL_SPLIT, jTreeSP, jTextSP) splitPane.setOneTouchExpandable(True) splitPane.setDividerLocation(300) treePanel = JPanel(BorderLayout()) treePanel.add(toolPanel, BorderLayout.NORTH) treePanel.add(splitPane, BorderLayout.CENTER) loadSavePanel = JPanel() loadSavePanel.setLayout(BoxLayout(loadSavePanel, BoxLayout.X_AXIS)) loadSavePanel.add( JButton("Load", actionPerformed=self.loadConfigDialog)) loadSavePanel.add( JButton("Save as", actionPerformed=self.writeConfigDialog)) self.rootPanel = JPanel() self.rootPanel.setLayout(BorderLayout()) self.rootPanel.add(loadSavePanel, BorderLayout.PAGE_START) self.rootPanel.add(treePanel, BorderLayout.CENTER)
timeReporter += str(hackTimer1 - hackTimer0) timeReporter += " s" JOptionPane.showMessageDialog(mainForm, timeReporter, "Pemberitahuan", JOptionPane.ERROR_MESSAGE) except: JOptionPane.showMessageDialog(mainForm, "Gagal memecahkan kunci", "Pemberitahuan", JOptionPane.ERROR_MESSAGE) mainForm = JFrame("Hacker Form", size=(987, 610)) myPanel = JPanel() myPanel.setOpaque(True) myPanel.setBackground(Color.WHITE) myPanel.setLayout(None) # All Events Belong Here # All Buttons Belong Here hackButton = JButton("Pecahkan Kunci", actionPerformed=react) hackButton.setSize(243, 55) hackButton.setLocation(62, 307) hackButton.setFont(regFont) laporan = JLabel("Laporan Pemecahan Kunci") laporan.setSize(200, 21) laporan.setLocation(26, 376) laporan.setFont(boldenFont)
) - 2 # don't show neither the full filepath nor the notes in the table def getValueAt(self, row, col): return table_entries[row][col] def isCellEditable(self, row, col): return False # none editable def setValueAt(self, value, row, col): pass # none editable # Create the GUI: a 3-column table and a text area next to it # to show and write notes for any selected row, plus some buttons and a search field all = JPanel() all.setBackground(Color.white) gb = GridBagLayout() all.setLayout(gb) c = GridBagConstraints() # For regular expression-based filtering of the table rows def filterTable(): global table_entries # flag global variable as one to modify here try: text = search_field.getText() if 0 == len(text): table_entries = entries # reset: show all rows else: pattern = re.compile(text) # Search in filepath and notes
#meinFont.setColor(Color.WHITE) #myICTable = JTable() tabbedPane = JTabbedPane() tabbedPane.setSize(377, 377) tabbedPane.setLocation(15, 5) tabbedPane.setVisible(True) #panel1 p1 = JPanel() p1.setOpaque(True) p1.setBackground(Color.WHITE) p1.setLayout(None) p1.setSize(357, 337) p1.setLocation(0, 0) p1.setVisible(True) generatedMatrix = awt.TextArea("-",7,7) scrollPane1 = JScrollPane(generatedMatrix) try: generatedMatrix.text = string1#myIOControl.derDrucker(gIC, gFB, gGamma) except: print "Gagal melaporkan tahap 1" generatedMatrix.setSize(393, 331) generatedMatrix.setLocation(5, 5) generatedMatrix.setBackground(Color.GRAY)
def updateStudent(stObj): global studentId global tfStudentName global tfStudentPhone global tfStudentEmail global taStudentAddress global tfCourseName global cbStudentAssignTeacher global frame frame = JFrame("Update student ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500,500) frame.setLocation(200,200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500,500) panel.setLocation(0,0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) studentId = getattr(stObj,'studentId') studentName= getattr(stObj,'studentName') studentPhone = getattr(stObj,'studentPhone') studentEmail = getattr(stObj,'studentEmail') studentAddress = getattr(stObj,'studentAddress') studentCourse = getattr(stObj,'courseName') teachersName = srv.showStudentChoiceCourse(studentCourse) v = Vector() for d in teachersName: v.add(d[0].encode('ascii')) heading = JLabel("Update TEACHER") heading.setBounds(200,30,150,40) lbStudentName = JLabel("Student name ") lbStudentPhone = JLabel("Phone") lbStudentEmail = JLabel("Email Id") lbStudentAddress = JLabel("Address") lbStudentAssignTeacher = JLabel("Student Assign teacher ") tfStudentName = JTextField(studentName) tfStudentPhone = JTextField(studentPhone) tfStudentEmail = JTextField(studentEmail) taStudentAddress = JTextArea(studentAddress) cbStudentAssignTeacher = JComboBox(v) lbStudentName.setBounds(70,100,130,30) lbStudentPhone.setBounds(70,150,130,30) lbStudentEmail.setBounds(70,200,130,30) lbStudentAddress.setBounds(70,250,130,30) lbStudentAssignTeacher.setBounds(70,350,130,30) tfStudentName.setBounds(220,100,130,30) tfStudentPhone.setBounds(220,150,130,30) tfStudentEmail.setBounds(220,200,130,30) taStudentAddress.setBounds(220,250,130,80) cbStudentAssignTeacher.setBounds(220,350,130,30) btnEnter = JButton("Update",actionPerformed=clickUpdateStudent) btnEnter.setBounds(350,420,100,40) btnCancel = JButton("Cancel",actionPerformed=clickbtnCancel) btnCancel.setBounds(50,420,100,40) panel.add(heading) panel.add(lbStudentName) panel.add(lbStudentPhone) panel.add(lbStudentEmail) panel.add(lbStudentAddress) panel.add(lbStudentAssignTeacher) panel.add(tfStudentName) panel.add(tfStudentPhone) panel.add(tfStudentEmail) panel.add(taStudentAddress) panel.add(cbStudentAssignTeacher) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
def updateTeacherForm(data): global heading global tfTeacherName global tfTeacherPhone global taTeacherAddress global tfTeacherEmail global tfTeacherCourse global tfTeacherPayment global frame global btnEnter frame = JFrame(" Teacher ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 600) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel(" TEACHER PROFILE") heading.setBounds(200, 30, 150, 40) lbTeacherName = JLabel("Teacher Name ") lbTeacherPhone = JLabel("Phone") lbTeacherEmail = JLabel("Email") lbTeacherAddress = JLabel("Address") lbTeacherCourse = JLabel("Teacher Course ") lbTeacherPayment = JLabel("Teacher Payment") teacherName = data[0].encode('ascii') teacherPhone = data[1].encode('ascii') teacherEmail = data[2].encode('ascii') teacherAddress = data[3].encode('ascii') teacherCourse = data[4].encode('ascii') teacherPayment = data[5] tfTeacherName = JTextField(teacherName) tfTeacherPhone = JTextField(teacherPhone) taTeacherAddress = JTextArea(teacherAddress) tfTeacherEmail = JTextField(teacherEmail) tfTeacherCourse = JTextField(teacherCourse) tfTeacherPayment = JTextField(str(teacherPayment)) tfTeacherCourse.setEditable(False) tfTeacherPayment.setEditable(False) tfTeacherName.setEditable(False) lbTeacherName.setBounds(70, 100, 130, 30) lbTeacherPhone.setBounds(70, 150, 130, 30) lbTeacherEmail.setBounds(70, 200, 130, 30) lbTeacherAddress.setBounds(70, 250, 130, 30) lbTeacherCourse.setBounds(70, 350, 130, 30) lbTeacherPayment.setBounds(70, 400, 130, 30) tfTeacherName.setBounds(220, 100, 130, 30) tfTeacherPhone.setBounds(220, 150, 130, 30) tfTeacherEmail.setBounds(220, 200, 130, 30) taTeacherAddress.setBounds(220, 250, 130, 80) tfTeacherCourse.setBounds(220, 350, 130, 30) tfTeacherPayment.setBounds(220, 400, 130, 30) btnEnter = JButton("Update", actionPerformed=clickUpdateTeacher) btnEnter.setBounds(350, 450, 100, 40) btnCancel = JButton("Cancel", actionPerformed=clickCancel) btnCancel.setBounds(100, 450, 100, 40) panel.add(heading) panel.add(lbTeacherName) panel.add(lbTeacherPhone) panel.add(lbTeacherEmail) panel.add(lbTeacherAddress) panel.add(lbTeacherCourse) panel.add(lbTeacherPayment) panel.add(tfTeacherName) panel.add(tfTeacherPhone) panel.add(tfTeacherEmail) panel.add(taTeacherAddress) panel.add(tfTeacherCourse) panel.add(tfTeacherPayment) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
def createColorPanel(self, color, pane): colorPanel = JPanel() colorPanel.setBackground(color) colorPanel.addMouseListener(MouseProcessor(self, colorPanel)) pane.add(colorPanel) return colorPanel
class CenterPanel(JPanel): def __init__(self): self.initComponents() self.addDefaultPanel(None) def initComponents(self): self.menuPanel = JPanel() self.initMenuPanel() self.currentPanel = AboutPanel() # colors for testing # self.menuPanel.setBackground(Color.PINK) self.menuPanel.setBackground(Color.decode('#3d4968')) self.setBackground(Color.YELLOW) # self.setLayout(GridLayout(1,2)) self.setLayout(BorderLayout()) self.add(self.menuPanel, BorderLayout.LINE_START) def initMenuPanel(self): buttonPanel = JPanel(GridLayout(10, 1, 5, 5)) addAdmin = JButton('Add Admin', actionPerformed=self.addAdminPanel) deleteAdmin = JButton('Delete Admin', actionPerformed=self.addDeleteAdminPanel) regUser = JButton('Register User', actionPerformed=self.addRegPanel) deRegUser = JButton('De-Register User', actionPerformed=self.addDeregisterPanel) emgBypass = JButton('Emergency Bypass', actionPerformed=self.addEmergencyPanel) viewLogs = JButton('View Logs', actionPerformed=self.addViewLogsPanel) login = JButton('Login', actionPerformed=self.addLoginForm) logout = JButton('Logout', actionPerformed=self.logout) quit = JButton('Quit', actionPerformed=dialog.quitApplicationMsg) about = JButton('About', actionPerformed=self.addDefaultPanel) # buttonPanel.setPreferredSize(Dimension(200,350)) # self.setPreferredSize(Dimension(250,250)) #add widgets buttonPanel.setBackground(Color.decode('#3d4968')) buttonPanel.add(addAdmin) buttonPanel.add(deleteAdmin) buttonPanel.add(regUser) buttonPanel.add(deRegUser) buttonPanel.add(emgBypass) buttonPanel.add(viewLogs) buttonPanel.add(login) buttonPanel.add(logout) buttonPanel.add(quit) buttonPanel.add(about) self.menuPanel.add(buttonPanel) def addDefaultPanel(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel.setVisible(False) self.currentPanel = AboutPanel() self.currentPanel.setVisible(True) self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def addAdminPanel(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel.setVisible(False) self.currentPanel = AddAdminForm() self.currentPanel.setVisible(True) self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def addRegPanel(self, e): client.make_reg_true() self.remove(self.currentPanel) self.currentPanel = RegForm() self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def addDeleteAdminPanel(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel = DeleteAdminForm() self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def addDeregisterPanel(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel = DeregisterForm() self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def addEmergencyPanel(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel = EmergencyBypassForm() self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def addLoginForm(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel = LoginForm() self.add(self.currentPanel, BorderLayout.CENTER) self.validate() def logout(self, e): client.make_reg_false() result = dialog.dispQuestion('Do you want to logout?', 'Logut') if result: client.logout() # dialog.dispInformationMsg('Sucessfully Logout') self.addDefaultPanel(None) def addViewLogsPanel(self, e): client.make_reg_false() self.remove(self.currentPanel) self.currentPanel = ViewLogsPanel() self.add(self.currentPanel, BorderLayout.CENTER) self.validate()
def addStudent(courseName, courseFee, v): global tfStudentName global tfStudentPhone global tfStudentEmail global taStudentAddress global tfCourseName global tfCourseFee global cbStudentAssignTeacher global frame frame = JFrame("Add Student ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 600) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("ADD STUDENT") heading.setBounds(200, 30, 150, 40) lbCourseName = JLabel(" Course name") lbCourseFee = JLabel(" Course Fee") lbStudentName = JLabel("Student name ") lbStudentPhone = JLabel("Phone") lbStudentEmail = JLabel("Email Id") lbStudentAddress = JLabel("Address") lbStudentAssignTeacher = JLabel("Student Assign teacher ") tfCourseName = JTextField(courseName) tfCourseFee = JTextField(str(courseFee)) tfStudentName = JTextField() tfStudentPhone = JTextField() tfStudentEmail = JTextField() taStudentAddress = JTextArea() cbStudentAssignTeacher = JComboBox(v) tfCourseName.setEditable(False) tfCourseFee.setEditable(False) lbCourseName.setBounds(70, 100, 130, 30) lbCourseFee.setBounds(70, 150, 130, 30) lbStudentName.setBounds(70, 200, 130, 30) lbStudentPhone.setBounds(70, 250, 130, 30) lbStudentEmail.setBounds(70, 300, 130, 30) lbStudentAddress.setBounds(70, 350, 130, 80) lbStudentAssignTeacher.setBounds(70, 450, 130, 30) tfCourseName.setBounds(220, 100, 130, 30) tfCourseFee.setBounds(220, 150, 130, 30) tfStudentName.setBounds(220, 200, 130, 30) tfStudentPhone.setBounds(220, 250, 130, 30) tfStudentEmail.setBounds(220, 300, 130, 30) taStudentAddress.setBounds(220, 350, 130, 80) cbStudentAssignTeacher.setBounds(220, 450, 130, 30) btnEnter = JButton("ADD", actionPerformed=clickAddStudent) btnEnter.setBounds(350, 510, 100, 40) btnCancel = JButton("Cancel", actionPerformed=clickbtnCancelForm) btnCancel.setBounds(50, 510, 100, 40) panel.add(heading) panel.add(lbCourseName) panel.add(lbCourseFee) panel.add(lbStudentName) panel.add(lbStudentPhone) panel.add(lbStudentEmail) panel.add(lbStudentAddress) panel.add(lbStudentAssignTeacher) panel.add(tfCourseName) panel.add(tfCourseFee) panel.add(tfStudentName) panel.add(tfStudentPhone) panel.add(tfStudentEmail) panel.add(taStudentAddress) panel.add(cbStudentAssignTeacher) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
class BottomPanel(JPanel): def __init__(self): self.holdPanel = JPanel() self.topPanel = JPanel() self.bottomPanel = JPanel() self.holdPanel.setBackground(Color.decode('#dddee6')) self.topPanel.setBackground(Color.decode('#dddee6')) self.bottomPanel.setBackground(Color.decode('#dddee6')) self.topPanel.setPreferredSize(Dimension(300, 30)) self.regBar = JProgressBar() self.gatePassBar = JProgressBar() self.regLabel = JLabel('Register : ') self.gatepassLabel = JLabel(' Gate Pass : '******'') self.gatePercentlabel = JLabel('') self.refreshButton = JButton('Refresh', actionPerformed=self.updateProgress) self.regBar.setMinimum(0) self.regBar.setMaximum(100) self.regBar.setStringPainted(True) self.gatePassBar.setMinimum(0) self.gatePassBar.setMaximum(100) self.gatePassBar.setStringPainted(True) self.setLayout(BorderLayout()) self.updateProgress(None) def updateProgress(self, e): progress = client.get_progress() regTotal = progress[0] regRecog = progress[1] gateTotal = progress[2] gateRecog = progress[3] regPercent = int((regRecog * 100) / regTotal) gatePercent = int((gateRecog * 100) / gateTotal) self.regBar.setValue(regPercent) self.gatePassBar.setValue(gatePercent) self.regBar.setString(str(regPercent) + '%') self.gatePassBar.setString(str(gatePercent) + '%') self.regPercentlabel.setText(str(regRecog) + '/' + str(regTotal)) self.gatePercentlabel.setText( str(gateRecog) + '/' + str(gateTotal) + ' ') if regPercent <= 30: regColor = Color.RED elif regPercent > 30 and regPercent < 50: regColor = Color.ORANGE elif regPercent >= 50 and regPercent <= 100: regColor = Color.GREEN if gatePercent <= 30: gateColor = Color.RED elif gatePercent > 30 and gatePercent < 50: gateColor = Color.ORANGE elif gatePercent >= 50 and gatePercent <= 100: gateColor = Color.GREEN self.regBar.setForeground(regColor) self.gatePassBar.setForeground(gateColor) self.holdPanel.add(self.regLabel) self.holdPanel.add(self.regBar) self.holdPanel.add(self.regPercentlabel) self.holdPanel.add(self.gatepassLabel) self.holdPanel.add(self.gatePassBar) self.holdPanel.add(self.gatePercentlabel) self.holdPanel.add(self.refreshButton) self.add(self.holdPanel, BorderLayout.CENTER) self.add(self.topPanel, BorderLayout.PAGE_START) self.add(self.bottomPanel, BorderLayout.PAGE_END) self.validate()
def reloadComponent(game,dialog,node): c = None text = node.getAttribute("text") if node.hasAttribute("text") else "" align = int(node.getAttribute("align")) if node.hasAttribute("align") else 0 #Components if node.nodeName=="jpanel": c = JPanel() c.setBackground(Color.BLACK) layout = createLayoutManager(c,node.getAttribute("layout") if node.hasAttribute("layout") else "flow") c.setLayout(layout) c.setOpaque(False) if node.getAttribute("opaque"): c.setOpaque(node.getAttribute("opaque")=="true") if node.getAttribute("background"): if(node.getAttribute("background")=="orange"): c.setBackground(Color.ORANGE) elif(node.getAttribute("background")=="green"): c.setBackground(Color.GREEN) for child in node.childNodes: if child.nodeName!="#text": if node.getAttribute("layout")=="gridbag": c.add(reloadComponent(game,dialog,child),getGridBagConstraints(game,child)) else: c.add(reloadComponent(game,dialog,child)) elif node.nodeName=="jlabel": c = JLabel(text,align) elif node.nodeName=="jbutton": c = JButton(text) if node.hasAttribute("enabled"): c.setEnabled(node.getAttribute("enabled")=="true"); elif node.nodeName=="settingspanel": c = SettingsPanel(game) for g in node.childNodes: if g.nodeName=="group": c.addGroup(int(g.getAttribute("id")),g.getAttribute("label")) for h in g.childNodes: if h.nodeName=="heading": c.addHeading(int(g.getAttribute("id")),h.getAttribute("label")) for s in h.childNodes: if s.nodeName=="setting": #<setting id="1" name="DISPLAY_REAL_WORLD_TIME" type="checkbox" label="Show Real-World Time"></setting> if s.getAttribute("items")!="": c.addSettingWithItems(int(g.getAttribute("id")),int(s.getAttribute("id")),s.getAttribute("label"),s.getAttribute("type"),s.getAttribute("items").split(",")) else: c.addSetting(int(g.getAttribute("id")),int(s.getAttribute("id")),s.getAttribute("label"),s.getAttribute("type")) c.finalizeSettingsPanel() dialog.registerSettingsPanel(int(node.getAttribute("id")),c) elif node.nodeName=="logspanel": c = LogsPanel(game) for g in node.childNodes: if g.nodeName=="group": c.addLog(int(g.getAttribute("id")),g.getAttribute("label")) c.finalizeLogsPanel() dialog.registerLogsPanel(int(node.getAttribute("id")),c) elif node.nodeName=="nglcanvas": c = NGLCanvas(game,int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height"))) dialog.registerCanvas(int(node.getAttribute("id")),c) #Layout if node.parentNode.getAttribute("layout")=="absolute": c.setBounds(getBounds(game,node)) elif node.parentNode.getAttribute("layout")=="box-y": c.setAlignmentX(Component.CENTER_ALIGNMENT); if node.hasAttribute("width") and node.hasAttribute("height"): c.setPreferredSize(Dimension(int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height")))) if node.hasAttribute("minWidth") and node.hasAttribute("minHeight"): c.setMinimumSize(Dimension(int(node.getAttribute("minWidth")),int(node.getAttribute("minHeight")))) if node.hasAttribute("maxWidth") and node.hasAttribute("maxHeight"): c.setMaximumSize(Dimension(int(node.getAttribute("maxWidth")),int(node.getAttribute("maxHeight")))) elif node.parentNode.getAttribute("layout")=="box-x": c.setAlignmentY(Component.CENTER_ALIGNMENT); if node.hasAttribute("width") and node.hasAttribute("height"): c.setPreferredSize(Dimension(int(getCascadingAttribute(game,node,"width")),int(getCascadingAttribute(game,node,"height")))) if node.hasAttribute("minWidth") and node.hasAttribute("minHeight"): c.setMinimumSize(Dimension(int(node.getAttribute("minWidth")),int(node.getAttribute("minHeight")))) if node.hasAttribute("maxWidth") and node.hasAttribute("maxHeight"): c.setMaximumSize(Dimension(int(node.getAttribute("maxWidth")),int(node.getAttribute("maxHeight")))) if node.nodeName!="nglcanvas" and node.nodeName!="jpanel" and node.nodeName!="settingspanel": addListeners(game,c,node) return c;
def loginPage(): global heading global rbAdmin global rbTeacher global rbStudent global frame global tfLoginId global tfPassword frame = JFrame("Login Form ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 500) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 500) panel.setLocation(0, 0) panel.setLayout(None) panel.setBackground(Color.BLUE) heading = JLabel("Admin Login") heading.setBounds(200, 50, 150, 30) rbAdmin = JRadioButton("Admin", actionPerformed=clickRadio) rbTeacher = JRadioButton("Teacher", actionPerformed=clickRadio) rbStudent = JRadioButton("Student", actionPerformed=clickRadio) rbAdmin.setBounds(100, 150, 100, 20) rbTeacher.setBounds(200, 150, 100, 20) rbStudent.setBounds(300, 150, 100, 20) btnGroup = ButtonGroup() btnGroup.add(rbAdmin) btnGroup.add(rbTeacher) btnGroup.add(rbStudent) lbLoginId = JLabel("LoginId") lbPassword = JLabel("Password") lbLoginId.setBounds(100, 230, 150, 30) lbPassword.setBounds(100, 300, 150, 30) tfLoginId = JTextField() tfPassword = JTextField() tfLoginId.setBounds(250, 230, 150, 30) tfPassword.setBounds(250, 300, 150, 30) btnLogin = JButton("Login", actionPerformed=clickLogin) btnLogin.setBounds(350, 350, 100, 30) btnReg = JButton("New Institute Registration", actionPerformed=clickReg) btnReg.setBounds(350, 400, 100, 30) panel.add(heading) panel.add(rbAdmin) panel.add(rbTeacher) panel.add(rbStudent) panel.add(lbLoginId) panel.add(lbPassword) panel.add(tfLoginId) panel.add(tfPassword) panel.add(btnLogin) panel.add(btnReg) panel.setVisible(True) frame.add(panel)
def addTeacher(): global heading global tfTeacherName global tfTeacherPhone global taTeacherAddress global tfTeacherEmail global tfTeacherCourse global tfTeacherPayment global frame global btnEnter frame = JFrame("Add Teacher ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 600) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 600) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("ADD TEACHER") heading.setBounds(200, 30, 150, 40) lbTeacherName = JLabel("Teacher Name ") lbTeacherPhone = JLabel("Phone") lbTeacherEmail = JLabel("Email") lbTeacherAddress = JLabel("Address") lbTeacherCourse = JLabel("Teacher Course ") lbTeacherPayment = JLabel("Teacher Payment") tfTeacherName = JTextField() tfTeacherPhone = JTextField() taTeacherAddress = JTextArea() tfTeacherEmail = JTextField() tfTeacherCourse = JTextField() tfTeacherPayment = JTextField() lbTeacherName.setBounds(70, 100, 130, 30) lbTeacherPhone.setBounds(70, 150, 130, 30) lbTeacherEmail.setBounds(70, 200, 130, 30) lbTeacherAddress.setBounds(70, 250, 130, 30) lbTeacherCourse.setBounds(70, 350, 130, 30) lbTeacherPayment.setBounds(70, 400, 130, 30) tfTeacherName.setBounds(220, 100, 130, 30) tfTeacherPhone.setBounds(220, 150, 130, 30) tfTeacherEmail.setBounds(220, 200, 130, 30) taTeacherAddress.setBounds(220, 250, 130, 80) tfTeacherCourse.setBounds(220, 350, 130, 30) tfTeacherPayment.setBounds(220, 400, 130, 30) btnEnter = JButton("ADD", actionPerformed=clickAddTeacher) btnEnter.setBounds(350, 450, 100, 40) panel.add(heading) panel.add(lbTeacherName) panel.add(lbTeacherPhone) panel.add(lbTeacherEmail) panel.add(lbTeacherAddress) panel.add(lbTeacherCourse) panel.add(lbTeacherPayment) panel.add(tfTeacherName) panel.add(tfTeacherPhone) panel.add(tfTeacherEmail) panel.add(taTeacherAddress) panel.add(tfTeacherCourse) panel.add(tfTeacherPayment) panel.add(btnEnter) frame.add(panel)
def doall(locations, fileobs, filerun1, filerun2, stime, etime, imageDir='d:/temp', weights=None, filter_type="AVE", normalize=False): obs = HecDss.open(fileobs, True) obs.setTimeWindow(stime, etime) run1 = HecDss.open(filerun1, True) run1.setTimeWindow(stime, etime) if filerun2 != None: run2 = HecDss.open(filerun2, True) run2.setTimeWindow(stime, etime) else: run2 = None rms1 = 0 rms1_min, rms1_max = 0, 0 rms2 = 0 rms2_min, rms2_max = 0, 0 rmsmap = {} #run2=None sumwts = 0 average_interval = None for l in locations: data1 = get_matching(obs, 'A=%s C=%s E=15MIN' % (l, type)) if data1 == None: data1 = get_matching(obs, 'A=%s C=%s E=1DAY' % (l, type)) if data1 == None: data1 = get_matching(obs, 'A=%s C=%s E=IR-DAY' % (l, type)) if data1 == None: data1 = get_matching(obs, 'A=%s C=%s E=1HOUR' % (l, type)) drun1 = get_matching(run1, 'B=%s C=%s' % (l, type)) if run2 != None: drun2 = get_matching(run2, 'B=%s C=%s' % (l, type)) else: drun2 = None avg_intvl = "1DAY" if data1 != None: if average_interval != None: dobsd = TimeSeriesMath(data1).transformTimeSeries( average_interval, None, filter_type, 0) else: dobsd = TimeSeriesMath(data1) if normalize: dobsd = dobsd.divide(TimeSeriesMath(data1).mean()) dobsm = TimeSeriesMath(data1).transformTimeSeries( avg_intvl, None, filter_type, 0) dobsm_max = TimeSeriesMath(data1).transformTimeSeries( avg_intvl, None, "MAX", 0) dobsm_max.data.fullName = dobsm_max.data.fullName + "MAX" dobsm_min = TimeSeriesMath(data1).transformTimeSeries( avg_intvl, None, "MIN", 0) dobsm_min.data.fullName = dobsm_min.data.fullName + "MIN" if normalize: dobsm = dobsm.divide(TimeSeriesMath(data1).mean()) if drun1 == None: continue else: if average_interval != None: drun1d = TimeSeriesMath(drun1).transformTimeSeries( average_interval, None, filter_type, 0) else: drun1d = TimeSeriesMath(drun1) if normalize: drun1d = drun1d.divide(TimeSeriesMath(drun1).mean()) if drun2 != None: if average_interval != None: drun2d = TimeSeriesMath(drun2).transformTimeSeries( average_interval, None, filter_type, 0) else: drun2d = TimeSeriesMath(drun2) if normalize: drun2d = drun2d.divide(TimeSeriesMath(drun2).mean()) drun1m = TimeSeriesMath(drun1).transformTimeSeries( avg_intvl, None, filter_type, 0) drun1m_max = TimeSeriesMath(drun1).transformTimeSeries( avg_intvl, None, "MAX", 0) drun1m_min = TimeSeriesMath(drun1).transformTimeSeries( avg_intvl, None, "MIN", 0) if normalize: drun1m = drun1m.divide(TimeSeriesMath(drun1).mean()) if drun2 != None: drun2m = TimeSeriesMath(drun2).transformTimeSeries( avg_intvl, None, filter_type, 0) drun2m_max = TimeSeriesMath(drun2).transformTimeSeries( avg_intvl, None, "MAX", 0) drun2m_min = TimeSeriesMath(drun2).transformTimeSeries( avg_intvl, None, "MIN", 0) if normalize: drun2m = drun2m.divide(TimeSeriesMath(drun2).mean()) else: drun2m = None if weights != None: sumwts = sumwts + weights[l] lrms1 = calculate_rms(drun1m.data, dobsm.data) * weights[l] lrms1_min = calculate_rms(drun1m_min.data, dobsm_min.data) * weights[l] lrms1_max = calculate_rms(drun1m_max.data, dobsm_max.data) * weights[l] rms1 = rms1 + lrms1 rms1_min = rms1_min + lrms1_min rms1_max = rms1_max + lrms1_max lrms2 = calculate_rms(drun2m.data, dobsm.data) * weights[l] lrms2_min = calculate_rms(drun2m_min.data, dobsm_min.data) * weights[l] lrms2_max = calculate_rms(drun2m_max.data, dobsm_max.data) * weights[l] rmsmap[ l] = lrms1, lrms2, lrms1_min, lrms2_min, lrms1_max, lrms2_max rms2 = rms2 + lrms2 rms2_min = rms2_min + lrms2_min rms2_max = rms2_max + lrms2_max plotd = newPlot("Hist vs New Geom [%s]" % l) if data1 != None: plotd.addData(dobsd.data) plotd.addData(drun1d.data) if drun2 != None: plotd.addData(drun2d.data) plotd.showPlot() legend_label = plotd.getLegendLabel(drun1d.data) legend_label.setText(legend_label.getText() + " [" + str(int(lrms1 * 100) / 100.) + "," + str(int(lrms1_min * 100) / 100.) + "," + str(int(lrms1_max * 100) / 100.) + "]") legend_label = plotd.getLegendLabel(drun2d.data) legend_label.setText(legend_label.getText() + " [" + str(int(lrms2 * 100) / 100.) + "," + str(int(lrms2_min * 100) / 100.) + "," + str(int(lrms2_max * 100) / 100.) + "]") plotd.setVisible(False) xaxis = plotd.getViewport(0).getAxis("x1") vmin = xaxis.getViewMin() + 261500. # hardwired to around july 1, 2008 xaxis.setViewLimits(vmin, vmin + 10000.) if data1 != None: pline = plotd.getCurve(dobsd.data) pline.setLineVisible(1) pline.setLineColor("blue") pline.setSymbolType(Symbol.SYMBOL_CIRCLE) pline.setSymbolsVisible(0) pline.setSymbolSize(3) pline.setSymbolSkipCount(0) pline.setSymbolFillColor(pline.getLineColorString()) pline.setSymbolLineColor(pline.getLineColorString()) g2dPanel = plotd.getPlotpanel() g2dPanel.revalidate() g2dPanel.paintGfx() plotm = newPlot("Hist vs New Geom Monthly [%s]" % l) plotm.setSize(1800, 1200) if data1 != None: plotm.addData(dobsm.data) #plotm.addData(dobsm_max.data) #plotm.addData(dobsm_min.data) plotm.addData(drun1m.data) #plotm.addData(drun1m_max.data) #plotm.addData(drun1m_min.data) if drun2 != None: plotm.addData(drun2m.data) #plotm.addData(drun2m_max.data) #plotm.addData(drun2m_min.data) plotm.showPlot() if data1 != None: pline = plotm.getCurve(dobsm.data) pline.setLineVisible(1) pline.setLineColor("blue") pline.setSymbolType(Symbol.SYMBOL_CIRCLE) pline.setSymbolsVisible(0) pline.setSymbolSize(3) pline.setSymbolSkipCount(0) pline.setSymbolFillColor(pline.getLineColorString()) pline.setSymbolLineColor(pline.getLineColorString()) plotm.setVisible(False) if data1 != None: plots = do_regression_plots(dobsm, drun1m, drun2m) if plots != None: spanel = plots.getPlotpanel() removeToolbar(spanel) mpanel = plotm.getPlotpanel() removeToolbar(mpanel) dpanel = plotd.getPlotpanel() removeToolbar(dpanel) from javax.swing import JPanel, JFrame from java.awt import GridBagLayout, GridBagConstraints mainPanel = JPanel() mainPanel.setLayout(GridBagLayout()) c = GridBagConstraints() c.fill = c.BOTH c.weightx, c.weighty = 0.5, 1 c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 0, 10, 4 if data1 != None: if plots != None: pass #mainPanel.add(spanel,c) c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 0, 10, 4 c.weightx, c.weighty = 1, 1 mainPanel.add(mpanel, c) c.gridx, c.gridy, c.gridwidth, c.gridheight = 0, 4, 10, 6 mainPanel.add(dpanel, c) fr = JFrame() fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) fr.getContentPane().add(mainPanel) fr.setSize(1100, 850) fr.show() mainPanel.setSize(1100, 850) mainPanel.setBackground(Color.WHITE) #import time; time.sleep(5) saveToPNG(mainPanel, imageDir + l + ".png") if weights != None: rms1 = (rms1 + rms1_min + rms1_max) / sumwts rms2 = (rms2 + rms2_min + rms2_max) / sumwts print 'RMS Run 1: %f' % rms1 print 'RMS Run 2: %f' % rms2 for loc in rmsmap.keys(): print loc, rmsmap[loc]
def doall(locations, fileobs,filerun1,filerun2,stime,etime,imageDir='d:/temp',weights=None,filter_type="AVE",normalize=False): obs=HecDss.open(fileobs,True) obs.setTimeWindow(stime,etime) run1=HecDss.open(filerun1,True) run1.setTimeWindow(stime,etime) if filerun2 != None: run2=HecDss.open(filerun2,True) run2.setTimeWindow(stime,etime) else: run2=None rms1=0 rms1_min,rms1_max=0,0 rms2=0 rms2_min,rms2_max=0,0 rmsmap={} #run2=None sumwts=0 average_interval=None; for l in locations: data1=get_matching(obs,'A=%s C=%s E=15MIN'%(l,type)) if data1 == None: data1=get_matching(obs,'A=%s C=%s E=1DAY'%(l,type)) if data1 == None: data1=get_matching(obs,'A=%s C=%s E=IR-DAY'%(l,type)) if data1 == None: data1=get_matching(obs,'A=%s C=%s E=1HOUR'%(l,type)) drun1=get_matching(run1,'B=%s C=%s'%(l,type)) if run2 != None: drun2=get_matching(run2, 'B=%s C=%s'%(l,type)) else: drun2=None avg_intvl="1DAY" if data1 != None: if average_interval != None: dobsd=TimeSeriesMath(data1).transformTimeSeries(average_interval, None, filter_type, 0) else: dobsd=TimeSeriesMath(data1) if normalize: dobsd=dobsd.divide(TimeSeriesMath(data1).mean()) dobsm=TimeSeriesMath(data1).transformTimeSeries(avg_intvl, None, filter_type, 0) dobsm_max=TimeSeriesMath(data1).transformTimeSeries(avg_intvl, None, "MAX", 0) dobsm_max.data.fullName=dobsm_max.data.fullName+"MAX" dobsm_min=TimeSeriesMath(data1).transformTimeSeries(avg_intvl, None, "MIN", 0) dobsm_min.data.fullName=dobsm_min.data.fullName+"MIN" if normalize: dobsm=dobsm.divide(TimeSeriesMath(data1).mean()) if drun1==None: continue; else: if average_interval != None: drun1d=TimeSeriesMath(drun1).transformTimeSeries(average_interval, None, filter_type, 0) else: drun1d=TimeSeriesMath(drun1) if normalize: drun1d=drun1d.divide(TimeSeriesMath(drun1).mean()) if drun2 != None: if average_interval != None: drun2d=TimeSeriesMath(drun2).transformTimeSeries(average_interval, None, filter_type, 0) else: drun2d=TimeSeriesMath(drun2) if normalize: drun2d=drun2d.divide(TimeSeriesMath(drun2).mean()) drun1m=TimeSeriesMath(drun1).transformTimeSeries(avg_intvl, None, filter_type, 0) drun1m_max=TimeSeriesMath(drun1).transformTimeSeries(avg_intvl, None, "MAX", 0) drun1m_min=TimeSeriesMath(drun1).transformTimeSeries(avg_intvl, None, "MIN", 0) if normalize: drun1m=drun1m.divide(TimeSeriesMath(drun1).mean()) if drun2 != None: drun2m=TimeSeriesMath(drun2).transformTimeSeries(avg_intvl, None, filter_type, 0) drun2m_max=TimeSeriesMath(drun2).transformTimeSeries(avg_intvl, None, "MAX", 0) drun2m_min=TimeSeriesMath(drun2).transformTimeSeries(avg_intvl, None, "MIN", 0) if normalize: drun2m=drun2m.divide(TimeSeriesMath(drun2).mean()) else: drun2m=None if weights != None: sumwts=sumwts+weights[l] lrms1 = calculate_rms(drun1m.data, dobsm.data)*weights[l] lrms1_min=calculate_rms(drun1m_min.data,dobsm_min.data)*weights[l] lrms1_max=calculate_rms(drun1m_max.data,dobsm_max.data)*weights[l] rms1=rms1+lrms1 rms1_min=rms1_min+lrms1_min rms1_max=rms1_max+lrms1_max lrms2 = calculate_rms(drun2m.data,dobsm.data)*weights[l] lrms2_min=calculate_rms(drun2m_min.data,dobsm_min.data)*weights[l] lrms2_max=calculate_rms(drun2m_max.data,dobsm_max.data)*weights[l] rmsmap[l] = lrms1,lrms2,lrms1_min,lrms2_min,lrms1_max,lrms2_max rms2=rms2+lrms2 rms2_min=rms2_min+lrms2_min rms2_max=rms2_max+lrms2_max plotd = newPlot("Hist vs New Geom [%s]"%l) if data1 != None: plotd.addData(dobsd.data) plotd.addData(drun1d.data) if drun2 != None: plotd.addData(drun2d.data) plotd.showPlot() legend_label = plotd.getLegendLabel(drun1d.data) legend_label.setText(legend_label.getText()+" ["+str(int(lrms1*100)/100.)+","+str(int(lrms1_min*100)/100.)+","+str(int(lrms1_max*100)/100.)+"]") legend_label = plotd.getLegendLabel(drun2d.data) legend_label.setText(legend_label.getText()+" ["+str(int(lrms2*100)/100.)+","+str(int(lrms2_min*100)/100.)+","+str(int(lrms2_max*100)/100.)+"]") plotd.setVisible(False) xaxis=plotd.getViewport(0).getAxis("x1") vmin =xaxis.getViewMin()+261500. # hardwired to around july 1, 2008 xaxis.setViewLimits(vmin,vmin+10000.) if data1 != None: pline = plotd.getCurve(dobsd.data) pline.setLineVisible(1) pline.setLineColor("blue") pline.setSymbolType(Symbol.SYMBOL_CIRCLE) pline.setSymbolsVisible(0) pline.setSymbolSize(3) pline.setSymbolSkipCount(0) pline.setSymbolFillColor(pline.getLineColorString()) pline.setSymbolLineColor(pline.getLineColorString()) g2dPanel = plotd.getPlotpanel() g2dPanel.revalidate(); g2dPanel.paintGfx(); plotm = newPlot("Hist vs New Geom Monthly [%s]"%l) plotm.setSize(1800,1200) if data1 != None: plotm.addData(dobsm.data) #plotm.addData(dobsm_max.data) #plotm.addData(dobsm_min.data) plotm.addData(drun1m.data) #plotm.addData(drun1m_max.data) #plotm.addData(drun1m_min.data) if drun2 != None: plotm.addData(drun2m.data) #plotm.addData(drun2m_max.data) #plotm.addData(drun2m_min.data) plotm.showPlot() if data1 != None: pline = plotm.getCurve(dobsm.data) pline.setLineVisible(1) pline.setLineColor("blue") pline.setSymbolType(Symbol.SYMBOL_CIRCLE) pline.setSymbolsVisible(0) pline.setSymbolSize(3) pline.setSymbolSkipCount(0) pline.setSymbolFillColor(pline.getLineColorString()) pline.setSymbolLineColor(pline.getLineColorString()) plotm.setVisible(False) if data1 != None: plots=do_regression_plots(dobsm,drun1m,drun2m) if plots != None: spanel = plots.getPlotpanel() removeToolbar(spanel) mpanel = plotm.getPlotpanel() removeToolbar(mpanel) dpanel = plotd.getPlotpanel() removeToolbar(dpanel) from javax.swing import JPanel,JFrame from java.awt import GridBagLayout, GridBagConstraints mainPanel = JPanel() mainPanel.setLayout(GridBagLayout()) c=GridBagConstraints() c.fill=c.BOTH c.weightx,c.weighty=0.5,1 c.gridx,c.gridy,c.gridwidth,c.gridheight=0,0,10,4 if data1 != None: if plots != None: pass #mainPanel.add(spanel,c) c.gridx,c.gridy,c.gridwidth,c.gridheight=0,0,10,4 c.weightx,c.weighty=1,1 mainPanel.add(mpanel,c) c.gridx,c.gridy,c.gridwidth,c.gridheight=0,4,10,6 mainPanel.add(dpanel,c) fr=JFrame() fr.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) fr.getContentPane().add(mainPanel) fr.setSize(1100,850); fr.show(); mainPanel.setSize(1100,850); mainPanel.setBackground(Color.WHITE); #import time; time.sleep(5) saveToPNG(mainPanel,imageDir+l+".png") if weights != None: rms1=(rms1+rms1_min+rms1_max)/sumwts rms2=(rms2+rms2_min+rms2_max)/sumwts print 'RMS Run 1: %f'%rms1 print 'RMS Run 2: %f'%rms2 for loc in rmsmap.keys(): print loc, rmsmap[loc]
def createStudentFeeForm(stFeeObj): global tfStudentId global tfStudentName global tfTotalAmount global tfPaidAmount global tfRemainingAmount global frame frame = JFrame("Student Fee Form ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500,500) frame.setLocation(200,200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500,500) panel.setLocation(0,0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("STUDENT FEE") heading.setBounds(200,30,150,40) lbStudentId = JLabel(" Student id") lbStudentName = JLabel(" student name") lbTotalAmount = JLabel("Total Amount ") lbPaidAmount = JLabel("Paid Amount") lbRemainingAmount = JLabel("Remaining amount") studentId =getattr(stFeeObj,'studentId') studentName =getattr(stFeeObj,'studentName') totalAmount =getattr(stFeeObj,'totalAmount') paidAmount =getattr(stFeeObj,'paidAmount') remainingAmount =getattr(stFeeObj,'remainingAmount') tfStudentId = JTextField(str(studentId)) tfStudentName = JTextField(str(studentName)) tfTotalAmount = JTextField(str(totalAmount)) tfPaidAmount = JTextField(str(paidAmount)) tfRemainingAmount = JTextField(str(remainingAmount)) tfStudentId.setEditable(False) tfStudentName.setEditable(False) tfTotalAmount.setEditable(False) tfRemainingAmount.setEditable(False) lbStudentId.setBounds(70,100,130,30) lbStudentName.setBounds(70,150,130,30) lbTotalAmount.setBounds(70,200,130,30) lbPaidAmount.setBounds(70,250,130,30) lbRemainingAmount.setBounds(70,300,130,30) tfStudentId.setBounds(220,100,130,30) tfStudentName.setBounds(220,150,130,30) tfTotalAmount.setBounds(220,200,130,30) tfPaidAmount.setBounds(220,250,130,30) tfRemainingAmount.setBounds(220,300,130,30) btnPay = JButton("Paid",actionPerformed=clickPay) btnPay.setBounds(350,410,100,40) btnCancel = JButton("Cancel",actionPerformed=clickbtnCancelForm) btnCancel.setBounds(50,410,100,40) panel.add(heading) panel.add(lbStudentId) panel.add(lbStudentName) panel.add(lbTotalAmount) panel.add(lbPaidAmount) panel.add(lbRemainingAmount) panel.add(tfStudentId) panel.add(tfStudentName) panel.add(tfTotalAmount) panel.add(tfPaidAmount) panel.add(tfRemainingAmount) panel.add(btnPay) panel.add(btnCancel) frame.add(panel)
def instReg(): global frame global tfName global tfPhone global taAddress global tfAdminLoginId global tfAdminPassword frame = JFrame("Registration Form ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500,550) frame.setLocation(200,200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500,550) panel.setLocation(0,0) panel.setLayout(None) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel("Institute Registration Form ") heading.setBounds(200,30,150,30) lbName = JLabel("Name") lbPhone =JLabel("Phone no ") lbAddress = JLabel("Address") lbAdminLoginId = JLabel("Admin login ") lbAdminPassword =JLabel("Admin Password") font = Font("Courier",Font.PLAIN,16) tfName = JTextField() tfPhone = JTextField() taAddress =JTextArea() tfAdminLoginId = JTextField() tfAdminPassword = JTextField() lbName.setBounds(70,100,150,40) lbPhone.setBounds(70,150,150,40) lbAddress.setBounds(70,200,150,40) lbAdminLoginId.setBounds(70,310,150,40) lbAdminPassword.setBounds(70,360,150,40) tfName = JTextField() tfPhone = JTextField() taAddress = JTextArea() tfAdminLoginId = JTextField() tfAdminPassword = JTextField() tfName.setBounds(250,100,200,40) tfPhone.setBounds(250,150,200,40) taAddress.setBounds(250,200,200,100) tfAdminLoginId.setBounds(250,310,200,40) tfAdminPassword.setBounds(250,360,200,40) tfName.setFont(font) tfPhone.setFont(font) taAddress.setFont(font) tfAdminLoginId.setFont(font) tfAdminPassword.setFont(font) sp = JScrollPane(taAddress) c = frame.getContentPane() btnSave = JButton("Save",actionPerformed=clickAdminReg) btnSave.setBounds(350,420,80,30) #panel.add(lbName) #panel.add(lbPhone) #panel.add(lbAddress) #panel.add(lbAdminLoginId) #panel.add(lbAdminPassword) #panel.add(tfName) #panel.add(tfPhone) #panel.add(c) #panel.add(tfAdminLoginId) #panel.add(tfAdminPassword) #panel.add(btnSave) #panel.add(btnLogin) c.add(lbName) c.add(lbPhone) c.add(lbAddress) c.add(lbAdminLoginId) c.add(lbAdminPassword) c.add(tfName) c.add(tfPhone) c.add(taAddress) c.add(tfAdminLoginId) c.add(tfAdminPassword) c.add(btnSave) frame.add(c)
def studentProfileForm(data): global heading global tfStudentName global tfStudentPhone global taStudentAddress global tfStudentEmail global tfCourseName global tfCourseFee global tfStudentAssignTeacher global frame global btnEnter frame = JFrame(" Student ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(500, 620) frame.setLocation(200, 200) frame.setLayout(None) frame.setVisible(True) panel = JPanel() panel.setSize(500, 620) panel.setLocation(0, 0) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.LIGHT_GRAY) heading = JLabel(" STUDENT PROFILE") heading.setBounds(200, 30, 150, 40) lbStudentName = JLabel("Student Name ") lbStudentPhone = JLabel("Phone") lbStudentEmail = JLabel("Email") lbStudentAddress = JLabel("Address") lbCourseName = JLabel("Course Name ") lbCourseFee = JLabel("Course Fee") lbStudentAssignTeacher = JLabel("Teacher") studentName = data[0].encode('ascii') studentPhone = data[1].encode('ascii') studentEmail = data[2].encode('ascii') studentAddress = data[3].encode('ascii') courseName = data[4].encode('ascii') courseFee = data[5] studentAssignTeacher = data[6].encode('ascii') tfStudentName = JTextField(studentName) tfStudentPhone = JTextField(studentPhone) taStudentAddress = JTextArea(studentAddress) tfStudentEmail = JTextField(studentEmail) tfCourseName = JTextField(courseName) tfCourseFee = JTextField(str(courseFee)) tfStudentAssignTeacher = JTextField(studentAssignTeacher) tfCourseName.setEditable(False) tfCourseFee.setEditable(False) tfStudentAssignTeacher.setEditable(False) tfStudentName.setEditable(False) lbStudentName.setBounds(70, 100, 130, 30) lbStudentPhone.setBounds(70, 150, 130, 30) lbStudentEmail.setBounds(70, 200, 130, 30) lbStudentAddress.setBounds(70, 250, 130, 30) lbCourseName.setBounds(70, 350, 130, 30) lbCourseFee.setBounds(70, 400, 130, 30) lbStudentAssignTeacher.setBounds(70, 450, 130, 30) tfStudentName.setBounds(220, 100, 130, 30) tfStudentPhone.setBounds(220, 150, 130, 30) tfStudentEmail.setBounds(220, 200, 130, 30) taStudentAddress.setBounds(220, 250, 130, 80) tfCourseName.setBounds(220, 350, 130, 30) tfCourseFee.setBounds(220, 400, 130, 30) tfStudentAssignTeacher.setBounds(220, 450, 130, 30) btnEnter = JButton("Update", actionPerformed=clickUpdateStudent) btnEnter.setBounds(350, 530, 100, 40) btnCancel = JButton("Cancel", actionPerformed=clickCancel) btnCancel.setBounds(100, 530, 100, 40) panel.add(heading) panel.add(lbStudentName) panel.add(lbStudentPhone) panel.add(lbStudentEmail) panel.add(lbStudentAddress) panel.add(lbCourseName) panel.add(lbCourseFee) panel.add(lbStudentAssignTeacher) panel.add(tfStudentName) panel.add(tfStudentPhone) panel.add(tfStudentEmail) panel.add(taStudentAddress) panel.add(tfCourseName) panel.add(tfCourseFee) panel.add(tfStudentAssignTeacher) panel.add(btnEnter) panel.add(btnCancel) frame.add(panel)
Created on Sep 23, 2016 @author: win3a1 ''' from javax.swing import JFrame, JLabel, JPanel, ImageIcon from java.awt import Color, Font theFont = Font("Arial", Font.BOLD, 19) elFont = Font("Arial", Font.BOLD, 23) aboutForm = JFrame("About", size=(610, 610)) aboutPanel = JPanel() aboutPanel.setOpaque(True) aboutPanel.setBackground(Color.WHITE) aboutPanel.setLayout(None) judul1Label = JLabel( "<html><center>TEKNIK PEMECAHAN KUNCI ALGORITMA ELGAMAL<br>DENGAN METODE INDEX CALCULUS</html>", JLabel.CENTER) #judul1Label.setOpaque(True) judul1Label.setFont(theFont) judul1Label.setSize(610, 70) judul1Label.setLocation(0, 10) skripsiLabel = JLabel("SKRIPSI", JLabel.CENTER) skripsiLabel.setFont(theFont) skripsiLabel.setSize(610, 50) #skripsiLabel.setOpaque(True) skripsiLabel.setLocation(0, 80)
def adminLogined(instObj): global panel global table global heading global btnUpdate global frame frame = JFrame("Admin Page ") frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) frame.setSize(700, 640) frame.setLocation(200, 200) frame.setLayout(None) panel = JPanel() panel.setSize(700, 620) panel.setLocation(0, 20) panel.setLayout(None) panel.setVisible(True) panel.setBackground(Color.WHITE) heading = JLabel() heading.setBounds(310, 10, 200, 30) table = JTable() table.setBounds(0, 50, 700, 450) sp = JScrollPane(table, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS) btnUpdate = JButton("Update", actionPerformed=clickUpdate) btnUpdate.setBounds(300, 530, 100, 30) bar = JMenuBar() courses = JMenu("Course") addCourse = JMenuItem("Add Course", actionPerformed=clickAddCourse) showCourseList = JMenuItem("Show Course List", actionPerformed=clickShowCourseList) courses.add(addCourse) courses.add(showCourseList) bar.add(courses) teacher = JMenu("Teacher") addTeacher = JMenuItem("Add Teacher", actionPerformed=clickAddTeacher) showTeacherList = JMenuItem("Show Teacher List", actionPerformed=clickShowTeacherList) showTeacherIdPassword = JMenuItem( "Show Teacher Id Password", actionPerformed=clickShowTeacherIdPassword) teacher.add(addTeacher) teacher.add(showTeacherList) teacher.add(showTeacherIdPassword) bar.add(teacher) student = JMenu("Student") addStudent = JMenuItem("Add Student", actionPerformed=clickAddStudent) showAllStudentList = JMenuItem("Show All Student", actionPerformed=clickShowAllStudent) showStudentsByCourse = JMenuItem("Show Student By course", actionPerformed=clickShowStudentByCourse) showStudentsByTeacher = JMenuItem( "Show Student By Teacher", actionPerformed=clickShowStudentByTeacher) showStudentIdPassword = JMenuItem( "Show Student Id Password", actionPerformed=clickShowStudentIdPassword) student.add(addStudent) student.add(showAllStudentList) student.add(showStudentsByCourse) student.add(showStudentsByTeacher) student.add(showStudentIdPassword) bar.add(student) attendence = JMenu(" Teacher Attendence") teacherAttendence = JMenuItem(" Take Teacher Attendence", actionPerformed=clickTotalAttendence) specificTeacherAttendence = JMenuItem( "Show Specific Teacher Attendence", actionPerformed=clickShowSpecificTeacherAttendence) allTeacherAttendenceMonth = JMenuItem( "All Teacher Attendence In Month", actionPerformed=clickShowAllSTeacherAttendenceMonth) specificTeacherAttendenceInMonth = JMenuItem( "Specific Teacher Attendence In Month", actionPerformed=clickShowSpecificSTeacherAttendenceMonth) allTeacherAttendenceStatisticsInMonth = JMenuItem( "All Teacher Attendence Statistics In Month", actionPerformed=clickShowAllTeacherAttendenceStatisticsMonth) attendence.add(teacherAttendence) attendence.add(specificTeacherAttendence) attendence.add(allTeacherAttendenceMonth) attendence.add(specificTeacherAttendenceInMonth) attendence.add(allTeacherAttendenceStatisticsInMonth) bar.add(attendence) studentAttendence = JMenu(" Student Attendence") specificTeacherStudentsAttendence = JMenuItem( "Show Specific Teacher Students Attendence", actionPerformed=clickShowSpecificTeacherStudentsAttendence) specificCourseStudentsAttendence = JMenuItem( "Show Specific course Students Attendence", actionPerformed=clickShowSpecificCourseStudentsAttendence) specificTeacherStudentsAttendenceInMonth = JMenuItem( "Show Specific teacher Students Attendence In month", actionPerformed=clickShowSpecificTeacherStudentsAttendenceInMonth) specificCourseStudentsAttendenceInMonth = JMenuItem( "Show Specific course Students Attendence In month", actionPerformed=clickShowSpecificCourseStudentsAttendenceInMonth) allStudentsAttendenceStatisticsInMonth = JMenuItem( "All Students Attendence Statistics In month", actionPerformed=clickShowAllStudentsAttendenceStatisticsInMonth) specificTeacherStudentsAttendenceStatisticsInMonth = JMenuItem( "Specific Teacher Students Attendence Statistics In month", actionPerformed= clickShowSpecificTeacherStudentsAttendenceStatisticsInMonth) specificCourseStudentsAttendenceStatisticsInMonth = JMenuItem( "Specific Course Students Attendence Statistics In month", actionPerformed= clickShowSpecificCourseStudentsAttendenceStatisticsInMonth) specificStudentAttendenceInMonth = JMenuItem( "Specific Student Attendence In month", actionPerformed=clickShowSpecificStudentAttendenceInMonth) studentAttendence.add(specificTeacherStudentsAttendence) studentAttendence.add(specificCourseStudentsAttendence) studentAttendence.add(specificTeacherStudentsAttendenceInMonth) studentAttendence.add(specificCourseStudentsAttendenceInMonth) studentAttendence.add(allStudentsAttendenceStatisticsInMonth) studentAttendence.add(specificTeacherStudentsAttendenceStatisticsInMonth) studentAttendence.add(specificCourseStudentsAttendenceStatisticsInMonth) studentAttendence.add(specificStudentAttendenceInMonth) bar.add(studentAttendence) studentFee = JMenu("Student Fee ") payStudentFee = JMenuItem("Pay", actionPerformed=clickPayStudentFee) showStudentFeeListByCourse = JMenuItem( "Student Fee list By Course", actionPerformed=clickShowStudentFeeListByCourse) studentFee.add(payStudentFee) studentFee.add(showStudentFeeListByCourse) bar.add(studentFee) logout = JMenuItem("logout", actionPerformed=clickLogout) bar.add(logout) btnUpdate.setVisible(False) panel.add(table) panel.add(btnUpdate) frame.setJMenuBar(bar) frame.add(panel) frame.setVisible(True)