Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package math;
- import java.applet.*;
- import java.awt.Color;
- import javax.swing.*;
- public class Area {
- public static void main(String[] args) {
- String[] ashapes = { "Circle", "Triangle", "Square", "Rectangle",
- "Parallelogram" };
- JLabel aunits = new JLabel("Choose your unit of measurment: ");
- JRadioButton ainches = new JRadioButton("Inches");
- JRadioButton acentimeters = new JRadioButton("Centimeters");
- JComboBox ashapesselection = new JComboBox(ashapes);
- JLabel wts = new JLabel("Choose your 2D shape:");
- JButton cancel = new JButton("Cancel");
- cancel.setBackground(Color.WHITE);
- JButton ganswer = new JButton("Get Answer!");
- ganswer.setBackground(Color.WHITE);
- JTextField an1 = new JTextField("", 5);
- JTextField an2 = new JTextField("", 5);
- JPanel aformat = new JPanel();
- aformat.setBackground(Color.WHITE);
- aformat.add(aunits);
- aformat.add(ainches);
- aformat.add(acentimeters);
- aformat.add(wts);
- aformat.add(ashapesselection);
- aformat.add(an1);
- aformat.add(an2);
- aformat.add(cancel);
- aformat.add(ganswer);
- JFrame area = new JFrame("Area - Version 1.1");
- area.add(aformat);
- area.setSize(375, 175);
- area.setResizable(false);
- area.setLocationRelativeTo(null);
- area.setVisible(true);
- area.setAlwaysOnTop(true);
- area.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- }
- public static void minor(String[] args) {
- String tai = "The answer is: ";
- String ac = " centimeters squared";
- String ai = " inches squared";
- // aatext = new JLabel();
- JButton aok = new JButton("OK");
- aok.setBackground(Color.WHITE);
- JPanel aaformat = new JPanel();
- // aaformat.add(aatext);
- aaformat.add(aok);
- aaformat.setBackground(Color.WHITE);
- JFrame answer = new JFrame("Answer");
- answer.add(aaformat);
- answer.setResizable(false);
- answer.setSize(275, 125);
- answer.setLocationRelativeTo(null);
- answer.setVisible(true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement