Advertisement
Nick-O-Rama

longDistance

Feb 25th, 2015
505
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.72 KB | None | 0 0
  1. package guiStuff;
  2. import javax.swing.*;
  3. import java.awt.*;
  4.  
  5. public class LongDistance extends JFrame{
  6.  
  7.     private JPanel panel;
  8.     private JPanel panel2;
  9.     private JLabel dayPrice;
  10.     private JLabel eveningPrice;
  11.     private JLabel offPrice;
  12.     private JLabel callPrice;
  13.     private JRadioButton day;
  14.     private JRadioButton evening;
  15.     private JRadioButton off;
  16.     private ButtonGroup bg;
  17.     private JTextField minutes;
  18.     private JTextField finalCost;
  19.     private JButton calc;
  20.     private JPanel panel3;
  21.    
  22.    
  23.     public LongDistance()
  24.     {
  25.         super("Long Distance Call Price Calculator");
  26.         setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  27.         setVisible(true);
  28.         buildPanel();
  29.         add(panel, BorderLayout.CENTER);
  30.        
  31.         add(panel2, BorderLayout.SOUTH);
  32.        
  33.         pack();
  34.     }
  35.    
  36.     public void buildPanel()
  37.     {
  38.         panel = new JPanel();
  39.         panel.setLayout(new GridLayout(4,2));
  40.         dayPrice = new JLabel("$0.07");
  41.         eveningPrice = new JLabel("$0.12");
  42.         offPrice = new JLabel("$0.05");
  43.         callPrice = new JLabel("Call Price");
  44.         bg = new ButtonGroup();
  45.         day = new JRadioButton("Daytime (6:00 a.m. through 5:59 p.m.)");
  46.         evening = new JRadioButton("Evening (6:00 p.m. through 11:59 p.m.)");
  47.         off = new JRadioButton("Off-Peak (12:00 a.m. through 5:59 a.m.)");
  48.         calc = new JButton();
  49.         minutes = new JTextField(5);
  50.         finalCost = new JTextField(5);
  51.         bg.add(day);
  52.         bg.add(evening);
  53.         bg.add(off);
  54.         panel.add(day);
  55.         panel.add(dayPrice);
  56.         panel.add(evening);
  57.         panel.add(eveningPrice);
  58.         panel.add(off);
  59.         panel.add(offPrice);
  60.         panel.add(callPrice);
  61.         panel.add(minutes);
  62.         panel2 = new JPanel();
  63.         panel3 = new JPanel();
  64.         panel3.setLayout(new FlowLayout(FlowLayout.CENTER));
  65.         panel3.add(finalCost);
  66.         panel2.add(panel3);
  67.        
  68.     }
  69.    
  70.    
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement