aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes please help .. please Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "please help .. please" Watch "please help .. please" New topic
Author

please help .. please

seventh theory
Greenhorn

Joined: Mar 31, 2004
Posts: 1
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();
}
});
}
}
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
I can't work out what a lot of your code is trying to do, but here's
something based on what I *think* I can see.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Hi "Seventh Theory" I am no the bartender in this forum, but, ouch, you are killing me.
First I'd like to welcome you to Javaranch. Please feel free to ask all your Java questions here, we really like helping everyone out, and we are really very friendly here.
And here is my "but", I understand being new, mistakes can happen, and don't think I am mad, casue I am not, but you seem to have broken almost all the rules. I know you said you will change your name, so here is the link.
1. First, we will start out with the JavaRanch Naming Policy.
You can change it
here.
2. The title of your thread should be more meaningful towards what you are going to actually post. please help is just very very vague.
3. Under the "Add Reply" button you will find many helpful buttons that can format your post to be more readable. For instance the button titled "CODE" can create tags that when wrapped around actual code will have the code retain all its formatting, including most importantly, your indentation. This makes is readable, and therefore easier for the reader to help you solve your problem.
Mark
p.s read your private messages.


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help .. please
 
Similar Threads
Won't Display
FlowLayout Display Problems
Implementing scanner into a simple login page
JButton and general swing problems
Componet Allignment