资源简介
Write a Swing application for a video store named Video.java.Place the names of 10 of your favorite movies in a drop-down list.Let the user select the movie he or she wants to rent.
Charge $2 for most movies, and $2.50 for your personal favorite movie.
Display the rental fee.
代码片段和文件信息
import java.awt.*;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
public class Myframe extends Jframe implements ActionListener {
public static final long serialVersionUID = 0;
public static final int DEFAULT_WIDTH = 300;
public static final int DEFAULT_HEIGHT = 200;
String movies[] = { “none““盗梦空间““哈利波特7““海角七号““雏菊““山楂树之恋““剑雨““大笑江湖““赵氏孤儿““狄仁杰之通天帝国““大叔“ };
private final JTextField textFiesd = new JTextField();;
private JPanel northPanel;
private JComboBox video;
public Myframe(){
settitle(“Play It Again Videos“);
setSize(DEFAULT_WIDTHDEFAULT_HEIGHT);
setLocation(100100);
northPanel = new JPanel();
video = new JComboBox(movies);
video.setSelectedIndex(0); //设置默认项
video.addAction
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 301 2010-12-13 23:04 实验11\.classpath
文件 384 2010-12-13 23:04 实验11\.project
文件 629 2010-12-13 23:04 实验11\.settings\org.eclipse.jdt.core.prefs
文件 2357 2010-12-14 10:09 实验11\bin\Myfr
文件 512 2010-12-14 09:32 实验11\bin\Video.class
文件 1646 2010-12-14 10:09 实验11\src\Myfr
文件 297 2010-12-14 09:32 实验11\src\Video.java
目录 0 2011-01-02 11:53 实验11\.settings
目录 0 2011-01-02 11:53 实验11\bin
目录 0 2011-01-02 11:53 实验11\src
目录 0 2011-01-02 11:53 实验11
----------- --------- ---------- ----- ----
6126 11
评论
共有 条评论