seventh theory

Greenhorn
+ Follow
since Mar 31, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by seventh theory

trying to do this UI which gives the customer 3 choices of payment.
worked on it for quite a few nites now ..
i jus need the label to change whenever a button is clicked..
i know that my name is not my real name .. i'll change it ..
can please help .. thanks in advance ..

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;
abstract public class abc implements ActionListener{

public static boolean RIGHT_TO_LEFT = false;

public static Container contentPane;
public static String label1;



contentPane.setLayout(new GridLayout(5,1));




/*
JButton[] def = new JButton[2];
def[0] = new JButton("Cash");
def[1] = new JButton("Cash Card");
def[2] = new JButton("ATM");
def[3] = new JButton("");
def[4] = new JButton("Submit");
*/

public static JButton[] def = { new JButton("Cash"),
new JButton("Cash Card"),
new JButton(""),
new JButton("Submit") }
;
for(int i = 0; i < def.length; i++)
{
def[i].addActionListener(this);

if(i == 0)
{

public void actionPerformed(ActionEvent e) {
String label1 = "Please Enter The Amount Inserted";
//return label1;
}
}
else if (i == 1)
{
public void actionPerformed(ActionEvent e) {
String label1 = "Please Insert Your Cashcard";
//return label1;
}
}

else if (i == 2)

{
public void actionPerformed(ActionEvent e) {
String label1 = "Please Enter Your PIN";


//return label1;
}

}

else (i == 4)

{
public void actionPerformed(ActionEvent e) {
String label1 = "Thank You For Using Our System";
//return label1;

}
}


}
contentPane.add(cash);
contentPane.add(cashcard);
contentPane.add(atm);

JTextField textfield = new JTextField(20);

JLabel label = new JLabel(label1);

contentPane.add(textfield);
contentPane.add(label);



/*
JButton cash = new JButton("Cash");
cash.addMouseListener();
JButton cashcard = new JButton("Cash Card");
cashcard.addActionListener();
JButton atm = new JButton("ATM");
atm.addActionListener();


public static void addComponents(Container contentPane) {



if (RIGHT_TO_LEFT) {
contentPane.setComponentOrientation(
ComponentOrientation.RIGHT_TO_LEFT);
}
contentPane.setLayout(new FlowLayout());

JTextField textfield = new JTextField(20);

JLabel label = new JLabel();

contentPane.add(textfield);
contentPane.add(label);

*/



/*
public void mousePressed extends addComponents(MouseEvent e) {

super.label = new JLabel("please enter amount inserted");

}
*/

/*

JButton cashcard = new JButton("Cash Card");

cashcard.addActionListener();


JButton atm = new JButton("ATM");

atm.addActionListener();



contentPane.add(cashcard);
contentPane.add(atm);



*/

/*
class Eavesdropper {

JTextField mytextfield;
public Eavesdropper(JTextField ta) {
mytextfield = ta;
mytextfield.getText();

}
}
*/
/*
public void addComponents()
{
cash.addActionLeader(this);
cash.addActionListener(new cash());

cashcard.addActionListener(this);
cashcard.addActionListener(new cashcard());

atm.addActionListener(this);
atm.addActionListener(new atm());
*/
/*
cash.addActionListener(new ActionListener()

{
public void actionPerformed(ActionEvent e) {

});


}
*/
/*
class cash implements ActionListener {
public void actionPerformed(ActionEvent e) {

}
}
class cashcard implements ActionListener {

public void actionPerformed(ActionEvent e) {

}
}

class atm implements ActionListener {

public void actionPerformed(ActionEvent e) {

}
}

*/
private static void createAndShowGUI() {

JFrame.setDefaultLookAndFeelDecorated(true);
//Create and set up the window.
//JFrames decorated by tahe Java look and feel
//can't get smaller than their minimum size.
//We specify a skinnier minimum size than the
//content pane will cause the frame to request,
//so that you can see what happens when you
//drag the window so that it's narrower than a
//single row.
JFrame frame = new JFrame("IT1290 Payment System")
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);


//addComponents(frame.getContentPane());

frame.setSize(500, 600);
frame.setVisible(true);
}
public static void main(String[] args) {

javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
20 years ago