Notes
![]() ![]() Notes - notes.io |
import java.awt.event.*;
import java.awt.Color;
import java.awt.BorderLayout;
class Sales extends JFrame implements ActionListener {
JLabel l1, l2, l3, l4, l5, l6, l7, l8;
JTextField t1, t2, t3, t4, t5;
JRadioButton r1, r2, r3;
JButton b1;
Sales() {
l1 = new JLabel("ITEM CODE");
l2 = new JLabel("ITEM NAME");
l3 = new JLabel("UNIT PRICE");
l4 = new JLabel("QUANTITY SOLD");
l5 = new JLabel("TOTAL AMOUNT :");
l6 = new JLabel("DISCOUNT");
l7 = new JLabel("");
l8 = new JLabel("");
this.setLayout(null);
this.setTitle("SALES REPORT");
this.setSize(800, 800);
this.setVisible(true);
//backgroundImage---
setContentPane(new JLabel(new ImageIcon("santa.png")));
l1.setBounds(1100, 70, 80, 70);
l2.setBounds(1100, 110, 80, 70);
l3.setBounds(1100, 150, 80, 70);
l4.setBounds(1100, 190, 100, 70);
l5.setBounds(1100, 230, 150, 70);
l6.setBounds(1100, 290, 80, 70);
l7.setBounds(1100, 330, 500, 70);
l8.setBounds(1100, 370, 500, 70);
this.add(l1);
this.add(l2);
this.add(l3);
this.add(l4);
this.add(l5);
this.add(l6);
this.add(l7);
this.add(l8);
t1 = new JTextField(20);
t2 = new JTextField(20);
t3 = new JTextField(20);
t4 = new JTextField(20);
t5 = new JTextField(20);
t1.setForeground(Color.white);
t1.setBackground(Color.decode("#22D0D1"));
t2.setForeground(Color.white);
t2.setBackground(Color.decode("#622A86"));
t3.setForeground(Color.white);
t3.setBackground(Color.decode("#CE1F6E"));
t4.setForeground(Color.white);
t4.setBackground(Color.decode("#081B74"));
t5.setForeground(Color.white);
t5.setBackground(Color.decode("#73D75E"));
t1.setBounds(1210, 90, 250, 30);
t2.setBounds(1210, 130, 250, 30);
t3.setBounds(1210, 170, 250, 30);
t4.setBounds(1210, 210, 250, 30);
t5.setBounds(1210, 250, 250, 30);
this.add(t1);
this.add(t2);
this.add(t3);
this.add(t4);
this.add(t5);
r1 = new JRadioButton("5%");
r2 = new JRadioButton("10%");
r3 = new JRadioButton("15%");
// r1.setForeground(Color.red);
r1.setForeground(Color.decode("#456f56"));
r2.setForeground(Color.blue);
r3.setForeground(Color.pink);
r1.setBounds(1200, 300, 50, 50);
r2.setBounds(1260, 300, 50, 50);
r3.setBounds(1320, 300, 50, 50);
ButtonGroup bg = new ButtonGroup();
bg.add(r1);
bg.add(r2);
bg.add(r3);
this.add(r1);
this.add(r2);
this.add(r3);
b1 = new JButton("CALCULATE");
b1.setForeground(Color.decode("#8AA868"));
b1.setBounds(1200, 450, 150, 30);
this.add(b1);
b1.addActionListener(this);
}
public void actionPerformed(ActionEvent ae) {
String s1 = t3.getText();
String s2 = t4.getText();
double x = Double.parseDouble(s1);
Double y = Double.parseDouble(s2);
if (r1.isSelected()) {
double z = x * y;
t5.setText(String.valueOf(z));
double d = z * 0.05;
double pa = z - d;
l7.setText(String.valueOf("DISCOUNTED AMOUNT : " + d));
l8.setText(String.valueOf("PAYABLE AMOUNT : " + pa));
l7.setForeground(Color.red);
l8.setForeground(Color.green);
} else if (r2.isSelected()) {
double z = x * y;
t5.setText(String.valueOf(z));
double d = z * 0.10;
double pa = z - d;
l7.setText(String.valueOf("DISCOUNTED AMOUNT : " + d));
l8.setText(String.valueOf("PAYABLE AMOUNT : " + pa));
l7.setForeground(Color.red);
l8.setForeground(Color.green);
} else {
double z = x * y;
t5.setText(String.valueOf(z));
double d = z * 0.15;
double pa = z - d;
l7.setText(String.valueOf("DISCOUNTED AMOUNT : " + d));
l8.setText(String.valueOf("PAYABLE AMOUNT : " + pa));
l7.setForeground(Color.red);
l8.setForeground(Color.green);
}
}
public static void main(String args[]) {
new Sales();
}
}
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team