Hi First of all let me tell you that my programming skill aren't great and I'm still learning java. Basically I'm trying to write a program that allow the user to enter a quantity in textfield1. Then when the confirm button is pressed, it'll display the result in textfield2

int amount = 35; 

int quantity = Integer.parseInt(quantTxt.getText()); 


if e.getSource() == Confirm && quantity >= 1 ) message.setText(pounds.format((amount / 100.0) * quantity));
else { 
message.setText(""); }

I know it isn't working as I tried it but I'd like to know if it is possible to perform this calculation differently.

That's not enough information for anyone to help. You need to post the whole code, and the complete text of any error messages. If there are no error messages but it's not working right, explain what it should do and what it actually does.

Hmm... I am quite sure you need to implement some of your code in actionPerformed() method somewhere but don't see it in your question... :P

Scanner keyboard = new scanner(System.in);
System.out.print("please enter a number: ");
textfieldone = keyboard.nextInt();
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.