daily pastebin goal
46%
SHARE
TWEET

Untitled

a guest Feb 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package math;
  2.  
  3. import java.applet.*;
  4. import java.awt.Color;
  5. import javax.swing.*;
  6.  
  7. public class Area {
  8.     public static void main(String[] args) {
  9.         String[] ashapes = { "Circle", "Triangle", "Square", "Rectangle",
  10.                 "Parallelogram" };
  11.         JLabel aunits = new JLabel("Choose your unit of measurment: ");
  12.         JRadioButton ainches = new JRadioButton("Inches");
  13.         JRadioButton acentimeters = new JRadioButton("Centimeters");
  14.         JComboBox ashapesselection = new JComboBox(ashapes);
  15.         JLabel wts = new JLabel("Choose your 2D shape:");
  16.         JButton cancel = new JButton("Cancel");
  17.         cancel.setBackground(Color.WHITE);
  18.         JButton ganswer = new JButton("Get Answer!");
  19.         ganswer.setBackground(Color.WHITE);
  20.         JTextField an1 = new JTextField("", 5);
  21.         JTextField an2 = new JTextField("", 5);
  22.  
  23.         JPanel aformat = new JPanel();
  24.         aformat.setBackground(Color.WHITE);
  25.         aformat.add(aunits);
  26.         aformat.add(ainches);
  27.         aformat.add(acentimeters);
  28.         aformat.add(wts);
  29.         aformat.add(ashapesselection);
  30.         aformat.add(an1);
  31.         aformat.add(an2);
  32.         aformat.add(cancel);
  33.         aformat.add(ganswer);
  34.  
  35.         JFrame area = new JFrame("Area - Version 1.1");
  36.         area.add(aformat);
  37.         area.setSize(375, 175);
  38.         area.setResizable(false);
  39.         area.setLocationRelativeTo(null);
  40.         area.setVisible(true);
  41.         area.setAlwaysOnTop(true);
  42.         area.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  43.  
  44.     }
  45.  
  46.     public static void minor(String[] args) {
  47.         String tai = "The answer is: ";
  48.         String ac = " centimeters squared";
  49.         String ai = " inches squared";
  50.         // aatext = new JLabel();
  51.         JButton aok = new JButton("OK");
  52.         aok.setBackground(Color.WHITE);
  53.         JPanel aaformat = new JPanel();
  54.         // aaformat.add(aatext);
  55.         aaformat.add(aok);
  56.         aaformat.setBackground(Color.WHITE);
  57.         JFrame answer = new JFrame("Answer");
  58.         answer.add(aaformat);
  59.         answer.setResizable(false);
  60.         answer.setSize(275, 125);
  61.         answer.setLocationRelativeTo(null);
  62.         answer.setVisible(true);
  63.     }
  64. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top