package schedule; import java.util.*; import javax.swing.*; import java.awt.*; import java.awt.event.*; /**** * * Class RemindInfoSubDialog is a component of the ScheduleAppointment, * dialogs. RemindInfoSubDialog displays the row of remind information. *

* The information is composed as the default configuration consisting of a * remind checkbox, a time-before text field, a time-before combo box, and a * remind-location combo box. * */ public class RemindInfoSubdialog extends JPanel { /** * Construct this, per the design explained in the class comment. */ public RemindInfoSubdialog() { maxComponentHeight = 1.9; maxComponentWidth = 1200; Box hbox = Box.createHorizontalBox(); JLabel remindLabel = new JLabel("Remind? "); remindLabel.setForeground(Color.black); remindCheckBox = new JCheckBox(); remindTimeTextField = new JTextField(3); remindTimeTextField.setMaximumSize( new Dimension(3 * remindTimeTextField.getFont().getSize(), (int)(maxComponentHeight * remindTimeTextField.getFont().getSize()))); remindTimeTextField.setEnabled(false); String[] selections = {"minutes before", "hours before", "days before"}; remindTimeComboBox = new JComboBox(selections); remindTimeComboBox.setEnabled(false); remindTimeComboBox.setMaximumSize( new Dimension(maxComponentWidth, (int)(maxComponentHeight * remindTimeComboBox.getFont().getSize()))); String[] selections2 = {"on screen", "email"}; remindLocationComboBox = new JComboBox(selections2); remindLocationComboBox.setEnabled(false); remindLocationComboBox.setMaximumSize( new Dimension(maxComponentWidth, (int)(maxComponentHeight * remindLocationComboBox.getFont().getSize()))); hbox.add(Box.createHorizontalStrut(15)); hbox.add(remindLabel); hbox.add(remindCheckBox); hbox.add(remindTimeTextField); hbox.add(Box.createHorizontalStrut(5)); hbox.add(remindTimeComboBox); hbox.add(Box.createHorizontalStrut(15)); hbox.add(remindLocationComboBox); hbox.add(Box.createHorizontalStrut(15)); add(hbox); } /** The parent apppointment dialog view. */ ScheduleAppointmentDialog parentView; /** The checkbox that indicates whether there's a reminder. */ protected JCheckBox remindCheckBox; /** The remind time text field. */ protected JTextField remindTimeTextField; /** The remind time combo box. */ protected JComboBox remindTimeComboBox; /** The remind location combo box. */ protected JComboBox remindLocationComboBox; /** The max height of a text field or combobox; this is necessary since these components strech when the outer frame is resized, and look very funky when they do */ protected final double maxComponentHeight; /** The max width of any component; this is only necessary because the max height cannot be set separately, so we must pick some max width. */ protected final int maxComponentWidth; }