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;
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;
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) {
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.