473,461 Members | 1,316 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Separate program that instantiates the VideoStore class

1
Hi,
I am lost and confused. I need to write a class to test the following program, and I don't have a clue where to start. Any help would be appreciated.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class VideoStore extends JApplet implements ActionListener {

public JButton button1, button2, button3;
public JLabel header, movie1, movie2, movie3;
public JTextField selection;
Font headerFont = new Font("Times New Roman", Font.BOLD, 24);
Font labelFont = new Font("Courier", Font.BOLD, 14);

public void init()
{
button1 = new JButton("Buy");
button2 = new JButton("Buy");
button3 = new JButton("Buy");
header = new JLabel("CCAC Video Store");
movie1 = new JLabel("Johnson Family Vacation");
movie2 = new JLabel("Pitch Black");
movie3 = new JLabel("Meet the Folkers");
selection = new JTextField(20);

FlowLayout flow = new FlowLayout();

setLayout(flow);

header.setFont(headerFont);
add(header);
movie1.setFont(labelFont);
add(movie1);
add(button1);
movie2.setFont(labelFont);
add(movie2);
add(button2);
movie3.setFont(labelFont);
add(movie3);
add(button3);
selection.setEditable(false);
add(selection);

button1.addActionListener(this);
button2.addActionListener(this);
button3.addActionListener(this);
}

public void actionPerformed(ActionEvent e)
{
if(e.getSource() == button1)
{
selection.setText("Johnson Family Vacation");
}
else if(e.getSource() == button2)
{
selection.setText("Pitch Black");
}
else if(e.getSource() == button3)
{
selection.setText("Meet the Folkers");
}
}
}
Apr 27 '10 #1
0 986

Sign in to post your reply or Sign up for a free account.

Similar topics

18
by: Erik Arner | last post by:
Hi, I really need some help here. After upgrading to g++ 3.4 I have run into all sorts of troubles that I'm sure depends on my lack of proper understanding of C++. I would now like to get it right...
1
by: Tarscher | last post by:
Hi all, My application starts in a class Controller (contaning the Main()). When the program starts the Main is called but is the the Main() called before or after the constructor of Controller?...
6
by: mister.mwa | last post by:
Hello, I have the following problem: I have a class Foo, and a class Bar. I want Foo to inherit from Bar, but i want to put them in separate files Foo.vb and Bar.vb. Then i will use the Foo...
5
by: RWF | last post by:
I have a form, and from the form when a user clicks a button, it instantiates control that will be doing a lot of logic. I am trying to use System.Threading.ThreadPool.QueueUserWorkItem to spawn a...
5
by: =?iso-8859-1?q?Erik_Wikstr=F6m?= | last post by:
The following code works: #include <iostream> template<class T> struct Test { T t; template<class T, template<class U = Tclass V> Test<T>& foo(V<T>& f)
12
by: titan nyquist | last post by:
I have a class with data and methods that use it. Everything is contained perfectly THE PROBLEM: A separate thread has to call a method in the current instantiation of this class. There is...
2
by: Alistair George | last post by:
Hi. Can assign global hotkeys, but I desire to have middle mouse button a global event, which instantiates a menu. However, Firefox, and a few other programs use the same button as well. I would...
28
by: gnuist006 | last post by:
I have some code like this: (if (test) (exit) (do something)) or (if (test)
10
by: Pavel Shved | last post by:
Is there a program of wide use that automatically extracts template parameters requirements from source code of template functions? I mean the following: assume we have a template function that...
9
by: koschwitz | last post by:
Hi, I hope you guys can help me make this simple application work. I'm trying to create a form displaying 3 circles, which independently change colors 3 times after a random time period has...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.