📄 flightspanel.java
字号:
/* * SelectPanel.java * * Created on 3 novembre 2004, 13:42 */package reservation.system.panels;import reservation.system.functions.Functions;import reservation.system.Profile;import reservation.system.Flight;import reservation.system.Person;import reservation.system.Pos;import reservation.CustomDialog;import javax.swing.*;import javax.swing.border.*;import javax.swing.table.*;import java.awt.event.*;import java.util.Vector;import java.awt.Dimension;import java.util.StringTokenizer;/** * This class hold Flight structure. This object allows to see the flight present in the database. * It use a GUI that contains a form with the several field to fill. * @author Texier Mathieu and Frederic Bidon */public class FlightsPanel extends Panels { /** Creates new form FlightsPanel */ public FlightsPanel () { jScrollPane = new JScrollPane (); flightTable = new JTable (); jScrollPane.setBorder (new SoftBevelBorder (BevelBorder.RAISED)); flightTable.setRowSelectionAllowed (false); jScrollPane.setViewportView (flightTable); add (jScrollPane); } /** * Causes this container to lay out its components. */ public void doLayout () { jScrollPane.setBounds (20, 20, 500, 120); flightTable.setBounds (20, 20, 500, 120); } /** * Set the size of the panel * @return an instance of Dimension that represents the minimum size of this container. */ public Dimension getMinimumSize () { return new Dimension (550,160); } /** * Set the size of the panel * @return an instance of Dimension that represents the preferred size of this container. */ public Dimension getPreferredSize () { return new Dimension (550,160); } /** * Initialize the number of the field and fill them with default values. * Dispaly the label of the Window. */ public void init () { try { String[] listFlight = fs.getFlightList (); int size = listFlight.length; String listData[][] = new String[size][4]; String title[] = {"Name", "Rows", "Row length"}; for(int i = 0; i < size; i++) { Flight flight = fs.selectFlight (listFlight[i]); listData[i][0] = flight.getFlightName (); listData[i][1] = Integer.toString(flight.getDimension ().getRow ()); listData[i][2] = Integer.toString(flight.getDimension ().getCol ()); } flightTable.setModel (new DefaultTableModel (listData,title)); } catch (Exception e) {CustomDialog.alert(e);} } /** * Proceed the execution of the action * @return the result of the request. * @param unUsed not used * @throws Exception if the command is not executed. */ public String execute (String[] unUsed) throws Exception { return ""; } private JTable flightTable; private JScrollPane jScrollPane;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -