package guiStuff; import javax.swing.*; import java.awt.*; public class LongDistance extends JFrame{ private JPanel panel; private JPanel panel2; private JLabel dayPrice; private JLabel eveningPrice; private JLabel offPrice; private JLabel callPrice; private JRadioButton day; private JRadioButton evening; private JRadioButton off; private ButtonGroup bg; private JTextField minutes; private JTextField finalCost; private JButton calc; private JPanel panel3; public LongDistance() { super("Long Distance Call Price Calculator"); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); buildPanel(); add(panel, BorderLayout.CENTER); add(panel2, BorderLayout.SOUTH); pack(); } public void buildPanel() { panel = new JPanel(); panel.setLayout(new GridLayout(4,2)); dayPrice = new JLabel("$0.07"); eveningPrice = new JLabel("$0.12"); offPrice = new JLabel("$0.05"); callPrice = new JLabel("Call Price"); bg = new ButtonGroup(); day = new JRadioButton("Daytime (6:00 a.m. through 5:59 p.m.)"); evening = new JRadioButton("Evening (6:00 p.m. through 11:59 p.m.)"); off = new JRadioButton("Off-Peak (12:00 a.m. through 5:59 a.m.)"); calc = new JButton(); minutes = new JTextField(5); finalCost = new JTextField(5); bg.add(day); bg.add(evening); bg.add(off); panel.add(day); panel.add(dayPrice); panel.add(evening); panel.add(eveningPrice); panel.add(off); panel.add(offPrice); panel.add(callPrice); panel.add(minutes); panel2 = new JPanel(); panel3 = new JPanel(); panel3.setLayout(new FlowLayout(FlowLayout.CENTER)); panel3.add(finalCost); panel2.add(panel3); } }