版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、中南大学JAVA课程设计专业班级:姓名:学号:指导老师:目录一设计背景3二.需求分析 33.1功能说明33.2布局说明43.3主要的工具包43.4程序主要流程图 4四系统功能模块结构 54.1登录相关模块54.2背景音乐模块 64.3相册相关模块74.4自动播放模块84.5相片相关模式8五. 系统实现105.1登录界面设计105.2相册界面设计115.3新建相册135.4照片界面设计145.5播放功能设计16六. 心得体会18一设计背景电子相册是现在时下很流行的一种网络元素, 它可以应用于很多 的领域。其以静态照片为素材,配合动感的背景、字幕等视频处理的 特殊效果,配上音乐就可制作成电子相册。
2、制作好的电子相册可以在 电脑上,各类影碟机上,以及手机和 MP4里都能观看。当然,如果 考虑到长期保存的话,也可以保存在硬盘上,也便于随时调阅、欣赏, 永久保存。1 需求分析1.采用的形式为:java applicatio n2需要实现的主要功能是:(1) 不同用户的登录模块(2) 播放方式设置,需要要实现手动播放和自动播放照片等功能(3) 附加背景音乐。(4) 设置照片标题。三概要设计3.1功能说明该程序可以实现用户登录、新建相册、新增照片、删除照片、打 开照片、播放照片等功能。3.2布局说明由于本程序采用的是Java swing编程,所以采用的是布局为: javax.sw in g.Gro
3、upLayout,即群组布局。3.3主要的工具包该程序中用到如下几个工具包,为:java.applet ,java.awt , java.io ,java.util 以及 javax.imageio 禾口 javax.swing 。3.4程序主要流程图注:该流程图中部分是根据用户可能出现的操作进行的打开程序相册界面1rf1T1F新建相册打开相册重命名相册删除相册r111r输入相册名进入相册界面输入相册名删除11F1fT1r1添加照片打开照片移动照片删除照片设置标题自动播放四系统功能模块结构该电子相册程序分为登录相关模块、背景音乐播放模块、相册 相关模块、照片相关模块、自动播放模块这五个模块。4
4、.1登录相关模块(1)业务描述:用户注册、登录功能。业务说明:当用admin用户登录时,进入管理员界面,可以 进行账户的添加、删除。应用普通账户登录,进入使用界面。4.2背景音乐模块(1)业务描述:自动播放音乐。业务说明:当用户打开某一相册,点选自动播放时,背景音 乐播出,退出背景音乐消失。(3)程序代码:public class autodisplayListener2 extends JFrame implementsActio nListe nerint i =-1;JDialog dialog =new JDialog();int in ttime =1;/ public autodi
5、splayListe ner()/new Timer(1000,this).start();/while(true);/ Overridepublic void actionPeformed(ActionEvente) autodisplayListe ner liste ner = new autodisplayListe ner();Timer t = new Timer(1000,liste ner);musicplay = new MusicPlay( "D:1.01.wav");playview = new PlayView( model, Controller.
6、thisuserView .getSelectedAlbum().getText();playview .getTimes().addActionListener(newActio nListe ner()Overridee) public void actionPeformed(ActionEventin ttime=Integer.parseInt ( playview .getTimes().getSelectedltem().toString();System. out .println( "inttime" +inttime ););4.3相册相关模块(1)业务描
7、述:相册及相关界面。业务流程:拥有新建、打开、重命名、删除相册的功能4.4自动播放模块No4.5相片相关模式(1) 业务描述:自动播放所导入的图片。(2) 业务流程:(1) 业务描述:照片管理界面。(2) 业务流程:拥有添加照片、打开照片、移动照片、删除照片、 设置标题、自动播放等功能五系统实现5.1登录界面设计public Logi nV iew(Stri ng super (title ); setPreferredSize( setM in imumSize(title ) new Dimension( WIN_WIDTH WIN_HEIGHD; new Dimension( WIN_W
8、IDTH WIN_HEIGHT);GridBagLayout gridbag = new GridBagLayout();=new GridBagConstraints();GridBagCo nstrai ntscon stra ints setLayout( gridbag );constraints . weightx = 1.0;constraints . weighty = 1.0;constraints . gridx = 0;constraints . gridy = 0;constraints . insets = new Insets(20,0,40,0);constrain
9、ts . gridwidth= GridBagConstraints.REMAINDERJLabel loginText = new JLabel("电子相册登录:");gridbag .setC on stra in ts(log in Text, con stra ints);add( log in Text );constraints . gridx = 0;constraints . gridy = 1;constraints . insets = new Insets(0,5,5,0);constraints . gridwidth = 1;JLabel user
10、nameText = new JLabel( "用户名:"); gridbag .setConstraints(usernameText , constraints);add( usernameText );con strai nts.gridx = 1;con strai nts.gridy = 1;con strai nts.anchor = GridBagConstraints.WESTusernameField = new JTextField( "”,10);gridbag .setConstraints(usernameField , constrai
11、nts);add( usernameField );constraints. gridx = 0;CENTERcon strai nts );constraints. gridy = 2;constraints . anchor = GridBagConstraints. logi nButton = new JButto n("登录"); gridbag .setC on stra in ts(log in Butt on,add( log in Butt on);constraints. gridx = 0;constraints. gridy = 3;constrai
12、nts. fill = GridBagConstraints.HORIZONTALconstraints. gridwidth= GridBagConstraints.REMAINDERerrorMessage = new JLabel("");gridbag .setConstraints(errorMessage , constraints);add( errorMessage );5.2相册界面设计public UserView(Model model , Controller controller ) super ("用户:"+ model .g
13、etUser().getUserlD(); this . controller= controller ;this . model = model;setPreferredSize(new Dimension( WIN_WIDTH WIN_HEIGHT);setMinimumSize( new Dimension( WIN_WIDTH WIN_HEIGHT); setResizable( false );getC onten tPa ne().setLayout(new BorderLayout();/Left panelbutt onPanel butt onPanel WIN_HEIGHT
14、);butt onPanel WIN_HEIGHT);butt onPanel 格布局=new JPa nel();.setPreferredSize(.setMi nim umSize(new Dime nsio n( WIN_WIDTH4,new Dime nsio n( WIN_WIDTH4,.setLayout( new GridLayout(0,1,0,20);/ 使用网getCo nten tPa ne().add(butt onPanel , BorderLayout. WEST;addAlbum = new JButton("新建相册”); buttonPanel .
15、add( addAlbum);openAlbum = new JButton("打开相册”);openAlbum .setEnabled( false );buttonPanel .add( openAlbum );renameAlbum = new JButton("重命名相册”); renameAlbum .setEnabled( false );buttonPanel .add( renameAlbum ); deleteAlbum = new JButton("删除相册"); deleteAlbum .setEnabled( false );bu
16、ttonPanel .add( deleteAlbum );logout = new JButton("登出"); buttonPanel .add( logout );/Right pa nelin foPa nel = new JPa nel();infoPanel .setBackground(Color.white );getCo nten tPa ne().add(in foPa nel , BorderLayout.CENTER;detailArea= new JTextArea( "");detailArea.setEditable( fa
17、lse );detailArea.setColu mn s(52);detailArea .setRows(6);detailArea.setBackgro un d(Color.LIGHT_GRAY;infoPanel .add( detailArea );albumPa nel = new JScrollPa ne();albumPanel .setMinimumSize(new Dimension(3* WIN_WIDTH4-20,3*WIN_HEIGHT4);albumPanel .setPreferredSize( newDime nsio n(3* WIN_WIDTH4-20, 3
18、* WIN_HEIGHT4);albumListPa nel albumListPa nelalbumListPa nel albumListPa nel=new JPa nel();.setLayout( new GridLayout(3,0,0,0);.setBackground(Color.white );.setMi nim umSize(newDime nsio n(3* WIN_WIDTH4-20, 2* WIN_HEIGHT4);albumListPa nel .setMaximumSize( new Dime nsio n(3* WIN_WIDTH4-20, 100* WIN_
19、HEIGHT);albumPanel .setViewportView( albumListPanel ); infoPanel .add( albumPanel );5.3新建相册*3:出團片文曲int 1=0;:U工旦旦Um:tlconHen/f EtypeGraphicsj_i用户;i相昨稼5出涼瞬片ISHSS: D slphoto pg 礙:时期 10172015-1135-43eghCjtoL:E賞T=判卄相册",冏屯曽5.4照片界面设计打开卿片自动曲股返回public albumview(Model model, Controllercontroller, Stringa
20、lbumName) super ("用户:"+ model .getUser().getUserlD() +"相册名称"" + albumName + """);this . controller= controller ;this . model = model;this . albumName = albumName;photoList =model .getUser().getAlbum( albumName).getPhotos();setPreferredSize(new Dimension( WIN_W
21、IDTH WIN_HEIGHD;setMinimumSize( new Dimension( WIN_WIDTH WIN_HEIGHT); setResizable( false );/Left panelbutt onPanel butt onPanel WIN_HEIGHT);butt onPanelWIN_HEIGHT);butt onPanelgetC onten tPa ne().setLayout(new BorderLayout();=new JPa nel();.setPreferredSize(new Dime nsio n( WIN_WIDTH4,.setMi nim um
22、Size(new Dime nsio n( WIN_WIDTH4,.setLayout( new GridLayout(8,1,0,12);getCo nten tPa ne().add(butt onPanel , BorderLayout. WEST; addPhoto = new JButton("添加照片"); buttonPanel .add( addPhoto );openPhoto =new JButton("打开照片");openPhoto .setEnabled( false );buttonPanel .add( openPhoto
23、); movePhoto = new JButton("移动照片"); movePhoto .setEnabled( false );buttonPanel .add( movePhoto);deletePhoto = new JButton("删除照片"); deletePhoto .setEnabled( false );buttonPanel .add( deletePhoto );recaption = new JButton( "设置标题"); recaption .setEnabled( false );buttonPan
24、el .add( recaption ); autodisplay = new JButton("自动播放"); buttonPanel .add( autodisplay );back = new JButto n("返回");buttonPanel .add( back);/Right pa nelin foPa nel = new JPa nel();infoPanel .setBackground(Color. white );getCo nten tPa ne().add(in foPa nel , BorderLayout.CENTER;de
25、tailArea= new JTextArea( "");detailArea.setEditable( false );detailArea.setColu mn s(52);detailArea .setRows(6);detailArea.setBackgro un d(Color.LIGHT_GRAY;infoPanel .add( detailArea );photoPa nel = new JScrollPa ne();photoPanel .setMinimumSize(new Dimension(3* WIN_WIDTH4-20,3*WIN_HEIGHT4)
26、;photoPanel .setPreferredSize( newDime nsio n(3* WIN_WIDTH4-20, 3* WIN_HEIGHT4);photoListPa nel = new JPa nel();photoListPanel.setBackground(Color.white );photoListPa nel.setMi nim umSize(newDime nsio n(3* WIN_WIDTH4-20, 2* WIN_HEIGHT4);photoListPa nel.setMaximumSize( newDime nsio n(3* WIN_WIDTH4-20
27、, 100* WIN_HEIGHT);photoPanel .setViewportView(photoListPanel);photoListPa nel .setLayout( new GridLayout(1,0, 0, 0); infoPanel .add( photoPanel );5.5播放功能设计“上一张”,“下一张”,“自动”,“延时时间”等设计如上面流 程图所示。国 用户;1相册茗称 M=131上一豪暫停邮丽间酬:1谨回public PlayView(Model albumName)super ("用户:""" + albumName
28、+ """this . controller,Stri ng"相册名称model ,Controller controller+ model .getUser().getUserlD() + );=con troller;this . albumName = albumName;setPreferredSize(new Dimension( WIN_WIDTH WIN_HEIGHD;setMinimumSize( new Dimension( WIN_WIDTH WIN_HEIGHT); setResizable( false );getC onten
29、tPa ne().setLayout(new BorderLayout();/Left panelbutt onPanel butt onPanel WIN_HEIGHT);butt onPanelWIN_HEIGHT);butt onPanel=new JPa nel();.setPreferredSize(.setMi nim umSize(new Dime nsio n( WIN_WIDTHnew Dime nsio n( WIN_WIDTH.setLayout( new GridLayout(1,8,0,12);getCo nten tPa ne().add(butt onPanel , BorderLayout. WEST;previous = new JButton("上张”);buttonPanel .add( previous );play =new JButton("播放”);buttonPanel .add( play );pause = new JButto n("暂停"); pause .setEnabled(false );buttonPanel .add( pause);next = new JButto n("下一张");间隔时间(秒):);buttonPanel .add( next )
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 护理课件曲线图:静脉血栓风险评估与预防
- 护理专业精神科护理与心理康复
- 湖北省鄂州市多校2025-2026学年高二下学期4月阶段检测历史试卷(含答案)
- 动物胶提胶浓缩工岗前岗位安全考核试卷含答案
- 工业炉及电炉机械装配工测试验证知识考核试卷含答案
- 可变电容器装校工岗前实操掌握考核试卷含答案
- 2026年新科教版高中高一历史下册第三单元辛亥革命历史功绩卷含答案
- 石油地震勘探工安全教育测试考核试卷含答案
- 2026年新科教版高中高二数学下册第一单元排列组合不相邻问题卷含答案
- 电光源外部件制造工岗前模拟考核试卷含答案
- 宜宾市筠连县国资国企系统2026年春季公开招聘管理培训生农业考试模拟试题及答案解析
- 2026年福建南平市八年级地生会考考试真题及答案
- 2025-2030非洲智能汽车零部件行业市场供需理解及投资潜力规划分析研究报告
- 2026季华实验室管理部门招聘3人(广东)建设笔试模拟试题及答案解析
- 北京市大兴区瀛海镇人民政府招聘劳务派遣4人考试参考试题及答案解析
- 4.7-北师数学二下第四单元《有多厚》课件
- 2026年人教版八年级英语下册UNIT 6同步检测试卷及答案
- 2025重庆联交所集团所属单位招聘1人笔试历年难易错考点试卷带答案解析
- 招聘会管理工作制度
- GB/T 47223-2026绿色产品评价无机肥料
- 2026年过期药品处理培训
评论
0/150
提交评论