Changeset 44 in tmcsimulator for trunk/src/tmcsim/cadsimulator/viewer/DVDInfoPanel.java
- Timestamp:
- 06/23/2016 06:30:20 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/tmcsim/cadsimulator/viewer/DVDInfoPanel.java
r2 r44 2 2 3 3 import java.awt.Dimension; 4 5 4 import javax.swing.BorderFactory; 6 5 import javax.swing.Box; … … 10 9 import javax.swing.JTable; 11 10 import javax.swing.JTextField; 12 13 11 import tmcsim.cadsimulator.videocontrol.DVDStatusUpdate; 14 12 import tmcsim.cadsimulator.videocontrol.DVDTitleUpdate; … … 17 15 18 16 /** 19 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel20 * displays information regarding the DVD player's connection information. 21 * One table on the panel shows all DVD title that have been played or22 * repeated. A second table shows all DVD status updates that have been23 * received from the controller.24 * 17 * DVDInfoPanel is a GUI component used in the CADSimulatorViewer. The panel 18 * displays information regarding the DVD player's connection information. One 19 * table on the panel shows all DVD title that have been played or repeated. A 20 * second table shows all DVD status updates that have been received from the 21 * controller. 22 * 25 23 * @author Matthew Cechini 26 * @version 24 * @version 27 25 */ 28 26 @SuppressWarnings("serial") 29 public class DVDInfoPanel extends JPanel { 27 public class DVDInfoPanel extends JPanel 28 { 30 29 31 /** DVD player connection info. */ 32 private String connInfo = null; 33 34 /** Table model for the title table. */ 30 /** 31 * DVD player connection info. 32 */ 33 public final String connInfo; 34 /** 35 * Table model for the title table. 36 */ 35 37 private DVDTitleTableModel titleTableModel; 38 /** 39 * Table to display DVD title plays and repeats. 40 */ 41 private JTable titleTable; 42 /** 43 * Table model for the Status table. 44 */ 45 private DVDStatusTableModel statusTableModel; 46 /** 47 * Table to display DVD status updates. 48 */ 49 private JTable statusTable; 36 50 37 /** Table to display DVD title plays and repeats. */38 private JTable titleTable;39 40 /** Table model for the Status table. */41 private DVDStatusTableModel statusTableModel;42 43 /** Table to display DVD status updates. */44 private JTable statusTable;45 46 47 51 /** 48 * Constructor. Initialize the panel GUI components.49 * 52 * Constructor. Initialize the panel GUI components. 53 * 50 54 * @param connectionInfo DVD player connection info. 51 55 */ 52 public DVDInfoPanel(String connectionInfo) { 56 public DVDInfoPanel(String connectionInfo) 57 { 53 58 connInfo = connectionInfo; 54 59 55 60 initComponents(); 56 } 57 61 } 62 58 63 /** 59 64 * This method updates the DVD status table with the new update object. 65 * 60 66 * @param update Update DVD Status update. 61 67 */ 62 public void updateDVDStatus(DVDStatusUpdate update) { 68 public void updateDVDStatus(DVDStatusUpdate update) 69 { 63 70 statusTableModel.addStatusUpdate(update); 64 71 } … … 66 73 /** 67 74 * This method updates the DVD title table with the new update object. 75 * 68 76 * @param update Update DVD Status update. 69 77 */ 70 public void updateDVDTitle(DVDTitleUpdate update) { 78 public void updateDVDTitle(DVDTitleUpdate update) 79 { 71 80 titleTableModel.addTitleUpdate(update); 72 81 } 73 82 74 83 /** 75 84 * Initialize the GUI components. 76 85 */ 77 private void initComponents() { 86 private void initComponents() 87 { 78 88 79 89 connInfoLbl = new JLabel("Connection Info:"); 80 90 connInfoLbl.setAlignmentX(Box.LEFT_ALIGNMENT); 81 connInfoTF = new JTextField(connInfo);91 connInfoTF = new JTextField(connInfo); 82 92 connInfoTF.setColumns(30); 83 93 connInfoTF.setAlignmentX(Box.LEFT_ALIGNMENT); 84 94 connInfoTF.setEditable(false); 85 95 86 96 Box connInfoBox = Box.createVerticalBox(); 87 97 connInfoBox.add(connInfoLbl); 88 98 connInfoBox.add(connInfoTF); 89 99 connInfoBox.setAlignmentX(Box.CENTER_ALIGNMENT); 90 100 91 101 titleTableModel = new DVDTitleTableModel(); 92 titleTable = new JTable(titleTableModel); 93 titleTable.getTableHeader().setReorderingAllowed(false); 94 95 for(int c = 0; c < titleTable.getColumnCount(); c++) { 102 titleTable = new JTable(titleTableModel); 103 titleTable.getTableHeader().setReorderingAllowed(false); 104 105 for (int c = 0; c < titleTable.getColumnCount(); c++) 106 { 96 107 titleTable.getColumnModel().getColumn(c).setMinWidth( 97 108 titleTableModel.getColumnMinWidth(c)); … … 102 113 titleTable.getColumnModel().getColumn(c).setResizable(true); 103 114 } 104 105 titlePane = new JScrollPane();115 116 titlePane = new JScrollPane(); 106 117 titlePane.setAlignmentX(Box.CENTER_ALIGNMENT); 107 118 //titlePane.setMinimumSize(new Dimension(,)); 108 titlePane.setPreferredSize(new Dimension(425, 225)); 119 titlePane.setPreferredSize(new Dimension(425, 225)); 109 120 titlePane.setViewportView(titleTable); 110 121 titlePane.setBorder(BorderFactory.createTitledBorder( 111 BorderFactory.createRaisedBevelBorder(), "Title Updates"));122 BorderFactory.createRaisedBevelBorder(), "Title Updates")); 112 123 113 124 statusTableModel = new DVDStatusTableModel(); 114 statusTable = new JTable(statusTableModel); 115 statusTable.getTableHeader().setReorderingAllowed(false); 116 117 for(int c = 0; c < statusTable.getColumnCount(); c++) { 125 statusTable = new JTable(statusTableModel); 126 statusTable.getTableHeader().setReorderingAllowed(false); 127 128 for (int c = 0; c < statusTable.getColumnCount(); c++) 129 { 118 130 statusTable.getColumnModel().getColumn(c).setMinWidth( 119 131 statusTableModel.getColumnMinWidth(c)); … … 124 136 statusTable.getColumnModel().getColumn(c).setResizable(true); 125 137 } 126 127 statusPane = new JScrollPane();138 139 statusPane = new JScrollPane(); 128 140 statusPane.setAlignmentX(Box.CENTER_ALIGNMENT); 129 141 //statusPane.setMinimumSize(new Dimension(,)); 130 statusPane.setPreferredSize(new Dimension(425, 150)); 142 statusPane.setPreferredSize(new Dimension(425, 150)); 131 143 statusPane.setViewportView(statusTable); 132 144 statusPane.setBorder(BorderFactory.createTitledBorder( 133 145 BorderFactory.createRaisedBevelBorder(), "Status Updates")); 134 146 135 147 Box panelBox = Box.createVerticalBox(); 136 148 panelBox.add(connInfoBox); … … 139 151 panelBox.add(Box.createVerticalStrut(10)); 140 152 panelBox.add(statusPane); 141 panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5,5,5));142 153 panelBox.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); 154 143 155 add(panelBox); 144 156 } 145 146 157 private JScrollPane titlePane; 147 158 private JScrollPane statusPane; 148 149 159 private JLabel connInfoLbl; 150 151 160 private JTextField connInfoTF; 152 161 }
Note: See TracChangeset
for help on using the changeset viewer.
