Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use Eclipse+Java+Swing+Mysql to realize Movie ticketing system

Shulou Source: shulou.com Published: 2022-06-02 01:47:31 09月20日 Update

9. Administrator-Home

10. Administrator-operate on user

11. Administrator-operate the cinema

twelve。 Administrator-operate the venue

13. Administrator-operate the event

14. Administrator-operate on the movie

Part of the code AdminMainView.javapackage view; import java.awt.BorderLayout;import java.awt.Color;import java.awt.EventQueue;import java.awt.Font;import java.awt.GridLayout;import java.awt.event.ActionEvent;import java.awt.event.ActionListener; import javax.swing.BorderFactory;import javax.swing.ImageIcon;import javax.swing.JButton;import javax.swing.JDesktopPane;import javax.swing.JFrame;import javax.swing.JLabel;import javax.swing.JPanel; import entity.User Public class AdminMainView extends JFrame {private JPanel main_panel = null; private JPanel fun_panel = null; private JDesktopPane fundesk = null; private JButton oper_User = null; private JButton oper_Cinema = null; private JButton oper_Hall = null; private JButton oper_Session = null; private JButton oper_Movie = null; private JButton back = null; private JLabel lb_welcome = null; private JLabel lb_image = null; private User admin = null Public AdminMainView () {init (); RegisterListener ();} public AdminMainView (User admin) {this.admin = admin; init (); RegisterListener ();} private void init () {main_panel = new JPanel (new BorderLayout ()); fun_panel = new JPanel (new GridLayout (8,1,0,18)) Oper_User = new JButton ("operate on the user"); oper_Cinema = new JButton ("operate on the cinema"); oper_Hall = new JButton ("operate on the venue"); oper_Session = new JButton ("operate on the show"); oper_Movie = new JButton ("operate on the movie"); back = new JButton ("return") Fun_panel.add (new JLabel ()); fun_panel.add (oper_User); fun_panel.add (oper_Cinema); fun_panel.add (oper_Hall); fun_panel.add (oper_Session); fun_panel.add (oper_Movie); fun_panel.add (back); fun_panel.add (new JLabel ()) / / set the appearance of the panel fun_panel.setBorder (BorderFactory.createTitledBorder (BorderFactory.createRaisedBevelBorder (), "functional area"); lb_welcome = new JLabel ("Huan Ying" + admin.getUname () + "enter the functional interface of the manager"); lb_welcome.setFont ("Font.BOLD", 34); lb_welcome.setForeground (Color.BLUE) Fundesk = new JDesktopPane (); ImageIcon img = new ImageIcon (ClassLoader.getSystemResource ("image/beijjing3.jpg")); lb_image = new JLabel (img); lb_image.setBounds (10,10, img.getIconWidth (), img.getIconHeight ()); fundesk.add (lb_image, new Integer (Integer.MIN_VALUE)); main_panel.add (lb_welcome, BorderLayout.NORTH) Main_panel.add (fun_panel, BorderLayout.EAST); main_panel.add (fundesk, BorderLayout.CENTER); / / to prevent the thread from blocking, call the thread / / put EventQueue.invokeLater (new Runnable () {public void run () {new Thread (new thread ()). Start ()) }}); this.setTitle ("Manager function Interface"); this.getContentPane (). Add (main_panel); this.setSize (880,600); this.setResizable (false); this.setVisible (true); this.setLocationRelativeTo (null); this.setDefaultCloseOperation (JFrame.EXIT_ON_CLOSE) } / / start the thread to make the welcome tag move / / this is a single-threaded private class thread implements Runnable {@ Override public void run () {while (true) {/ / the endless loop keeps it moving for (int I = 900; I >-700; iMel -) {/ / for (int iTunel 100) I getColumnClass (int columnIndex) {return String.class;} / / is the cell editable @ Override public boolean isCellEditable (int rowIndex, int columnIndex) {return false;} / / the data displayed in each row of cells @ Override public Object getValueAt (int rowIndex, int columnIndex) {Hall hall = hallList.get (rowIndex) Cinema cinema = null; if (columnIndex = = 0) {return hall.getHall_id ();} else if (columnIndex = = 1) {return hall.getHname ();} else if (columnIndex = = 2) {List cinemaList = cinemabiz.queryAllCinema (); for (int I = 0; I < cinemaList.size () ) {if (hall.getCinema_id () = = cinemaList.get (I) .getCinema_id ()) {cinema = cinemaList.get (I); break;}} return cinema.getCname (); / / return hall.getCid () } else if (columnIndex = = 3) {return hall.getCapacity ();} else {return "error" } @ Override public void setValueAt (Object aValue, int rowIndex Int columnIndex) {/ / TODO Auto-generated method stub} @ Override public void addTableModelListener (TableModelListener l) {/ / TODO Auto-generated method stub} @ Override public void removeTableModelListener (TableModelListener l) {/ / TODO Auto-generated method stub}} private void refreshTable (List hallList) {infoTableModel = new HallInfoTableModel (hallList) Table.setModel (infoTableModel); table.setRowHeight (20);}} read here, this article "how to use Eclipse+Java+Swing+Mysql to achieve movie ticketing system" has been introduced. If you want to master the knowledge of this article, you still need to practice and use it to understand it. If you want to know more about related articles, welcome to follow the industry information channel.

Tags: Cinema information user movie name query system administrator management show data interface ownership thread input capacity typeface success content function Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia vpn MySQL Shulou Tech Info MariaDB