⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 videotable.java

📁 Its video trNSMITT FILE USING JMF
💻 JAVA
字号:
/*  VideoTable.java * *  Table that displays all the videos archived for a given location. * *  Copyright (C) 2002 by Frank McCown *  University of Arkansas at Little Rock *  July 2002 */import javax.swing.*;import javax.swing.table.*;import java.awt.*;import java.awt.event.*;import rowc.*;public class VideoTable extends JTable{	private boolean editable = false;   // Indicates if values can be changed or not	private VideoTableModel model;			public VideoTable() 	{		model = new VideoTableModel();		this.setModel(model);			// Make timestamp col wider		TableColumn column = this.getColumnModel().getColumn(0);		column.setPreferredWidth(250);  	} 	 	public String getVideoName(int row)	{		return model.getVideoName(row);	}		 	public void populateVideoTable(String location, Object mediaStore)	{		System.out.println("Getting new data for location: "+location);				VideoClip videos[] = getVideoClips(location, mediaStore);				model.populateVideoTable(videos);	}	private VideoClip[] getVideoClips(String location, Object mediaStore)	{		rowc.MediaStorePackage.ClipsHolder videos = null;						if (mediaStore == null)		{			System.out.println("mediaStore is null... can't access videos.");			return null;		}		else		{			videos = new rowc.MediaStorePackage.ClipsHolder();						// Must cast Object into proper MediaStore object.  			// MediaStoreImpl is not a remote object, but MediaStore is.						if (mediaStore instanceof MediaStoreImpl)			{				// Local object method invocation				MediaStoreImpl ms = (MediaStoreImpl) mediaStore;				ms.getAllVideoDetails(location, videos);			}			else			{				// Remote object method invocation				MediaStore ms = (MediaStore) mediaStore;				ms.getAllVideoDetails(location, videos);			}		}				return videos.value;	}	/***************************************************************************	 *	 *  Inner class for representing table model	 *	 ***************************************************************************/	 	class VideoTableModel extends AbstractTableModel 	{    final String[] columnNames = {"Timestamp","Length","Size"};		private Object data[][] = {};		private String videoNames[];  // For remembering names- used when selecting a video						public void populateVideoTable(VideoClip videos[])		{			if (videos == null)				return;							// Make array big enough to handle new data			data = new Object[videos.length][columnNames.length];			videoNames = new String[videos.length];						for (int i = 0; i < videos.length; i++)			{				videoNames[i] = videos[i].name;				data[i][0] = new java.sql.Timestamp(videos[i].timeStamp).toString();				data[i][1] = new Integer(videos[i].length);				data[i][2] = new Integer(videos[i].size);			}						super.fireTableDataChanged();		}						public String getVideoName(int row)		{			return videoNames[row];		}		    public int getColumnCount()     {      return columnNames.length;    }    public int getRowCount()     {      return data.length;    }    public String getColumnName(int col)     {      return columnNames[col];    }    public Object getValueAt(int row, int col)     {      return data[row][col];    }    public boolean isCellEditable(int row, int col)     {      return editable;    }        public void setValueAt(Object value, int row, int col)     {      if (!(value instanceof Integer))       {        try         {        	// If nothing entered, make it a 0 be default        	if (value.toString().length() == 0)        		value = "0";        		          data[row][col] = new Integer(value.toString());          fireTableCellUpdated(row, col);        }         catch (NumberFormatException e)         {          JOptionPane.showMessageDialog(VideoTable.this,            "You may only enter integer values.");        }      }       else       {        data[row][col] = value;        fireTableCellUpdated(row, col);      }    }	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -