package NewGui;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;
import java.awt.SystemColor;
import javax.swing.BorderFactory;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.SwingConstants;
import javax.swing.UIManager;
import javax.swing.UIManager.LookAndFeelInfo;
import javax.swing.border.BevelBorder;
import javax.swing.border.EtchedBorder;
public class NewGui extends JFrame {
JPanel mainGridBagPanel = new JPanel(new GridBagLayout());
JPanel topButtonPanel = new JPanel(new GridBagLayout());
JPanel helperAddressPanel = new JPanel(new GridBagLayout());
JPanel helperNamePanel = new JPanel(new GridBagLayout());
JPanel filerInfoPanel = new JPanel(new GridBagLayout());
JPanel dupPanel = new JPanel(new GridBagLayout());
JButton helpInformationButton = new JButton();
JButton returnPreviousButton = new JButton();
JButton viewErrorLogButton = new JButton();
JLabel listLabel = new JLabel();
JLabel helperAddressLabel = new JLabel();
JTextField helperAddressOne = new JTextField();
JTextField helperAddressTwo = new JTextField();
JTextField coLine = new JTextField();
JLabel codeLabel = new JLabel();
JTextField code = new JTextField();
JTextField phoneNbr = new JTextField();
JLabel helperNameLabel = new JLabel();
JTextField addressOne = new JTextField();
JTextField addressTwo = new JTextField();
JTextField city = new JTextField();
JTextField prov = new JTextField();
JTextField cntry = new JTextField();
JTextField postalCd = new JTextField();
JLabel dateLabel = new JLabel();
JTextField date = new JTextField();
JLabel helperDateLabel = new JLabel();
JTextField helperDate = new JTextField();
JLabel timeLabel = new JLabel();
JTextField time = new JTextField();
JLabel locationLabel = new JLabel();
JTextField location = new JTextField();
JLabel descriptionLabel = new JLabel();
JTextField description = new JTextField();
JLabel destinationLabel = new JLabel();
JTextField destination = new JTextField();
JLabel typeLabel = new JLabel();
JTextField type = new JTextField();
JLabel durationLabel = new JLabel();
JTextField duration = new JTextField();
public NewGui()
{
setPanelInfo();
setLabels();
setValues();
this.getContentPane().add(mainGridBagPanel);
GridBagConstraints gb = new GridBagConstraints();
gb.fill = GridBagConstraints.BOTH;
gb.gridx = 0;
gb.gridy = 0;
gb.weightx = 0.5;
gb.weighty = 0.5;
gb.gridwidth = 3;
gb.insets = new Insets(5,5,0,5);
mainGridBagPanel.add(topButtonPanel, gb);
gb.gridy = 1;
gb.gridwidth = 1;
gb.insets = new Insets(5,5,5,0);
mainGridBagPanel.add(helperAddressPanel, gb);
gb.gridx = 1;
gb.insets = new Insets(5,5,5,0);
mainGridBagPanel.add(helperNamePanel, gb);
gb.gridx = 2;
gb.insets = new Insets(5,5,5,5);
mainGridBagPanel.add(filerInfoPanel, gb);
// gb.gridx = 3;
// gb.insets = new Insets(10,10,10,10);
// mainGridBagPanel.add(dupPanel, gb);
gb.gridx = 0;
gb.gridy = 0;
gb.insets = new Insets(5,5,5,0);
topButtonPanel.add(helpInformationButton, gb);
gb.gridx = 1;
gb.insets = new Insets(5,5,5,0);
topButtonPanel.add(listLabel, gb);
gb.gridx = 2;
gb.insets = new Insets(5,5,5,0);
topButtonPanel.add(returnPreviousButton, gb);
gb.gridx = 3;
gb.insets = new Insets(5,5,5,5);
topButtonPanel.add(viewErrorLogButton, gb);
gb.gridx = 0;
gb.gridy = 0;
gb.insets = new Insets(5,5,5,0);
helperAddressPanel.add(helperAddressLabel, gb);
gb.gridy = 1;
gb.insets = new Insets(0,0,0,0);
helperAddressPanel.add(helperAddressOne, gb);
gb.gridy = 2;
helperAddressPanel.add(helperAddressTwo, gb);
gb.gridy = 3;
helperAddressPanel.add(coLine, gb);
gb.gridy = 4;
helperAddressPanel.add(codeLabel, gb);
gb.gridy = 5;
helperAddressPanel.add(code, gb);
gb.gridy = 6;
helperAddressPanel.add(phoneNbr, gb);
gb.gridx = 0;
gb.gridy = 0;
gb.gridwidth = 3;
gb.insets = new Insets(5,5,5,0);
helperNamePanel.add(helperNameLabel, gb);
gb.gridy = 1;
gb.insets = new Insets(0,0,0,0);
helperNamePanel.add(addressOne, gb);
gb.gridy = 2;
helperNamePanel.add(addressTwo, gb);
gb.gridy = 3;
helperNamePanel.add(city, gb);
gb.gridy = 4;
gb.gridwidth = 1;
helperNamePanel.add(prov, gb);
gb.gridx = 1;
helperNamePanel.add(cntry, gb);
gb.gridx = 2;
helperNamePanel.add(postalCd, gb);
gb.gridx = 0;
gb.gridy = 5;
gb.gridwidth = 3;
helperNamePanel.add(dateLabel, gb);
gb.gridy = 6;
helperNamePanel.add(date, gb);
gb.gridx = 0;
gb.gridy = 0;
gb.gridwidth = 1;
gb.insets = new Insets(5,5,5,0);
filerInfoPanel.add(helperDateLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(helperDate, gb);
gb.gridx = 0;
gb.gridy = 1;
gb.insets = new Insets(0,5,0,0);
filerInfoPanel.add(timeLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(time, gb);
gb.gridx = 0;
gb.gridy = 2;
gb.insets = new Insets(0,5,0,0);
filerInfoPanel.add(locationLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(location, gb);
gb.gridx = 0;
gb.gridy = 3;
gb.insets = new Insets(0,5,0,0);
filerInfoPanel.add(descriptionLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(description, gb);
gb.gridx = 0;
gb.gridy = 4;
gb.insets = new Insets(0,5,0,0);
filerInfoPanel.add(destinationLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(destination, gb);
gb.gridx = 0;
gb.gridy = 5;
gb.insets = new Insets(0,5,0,0);
filerInfoPanel.add(typeLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(type, gb);
gb.gridx = 0;
gb.gridy = 6;
gb.insets = new Insets(0,5,0,0);
filerInfoPanel.add(durationLabel, gb);
gb.gridx = 1;
gb.insets = new Insets(0,0,0,0);
filerInfoPanel.add(duration, gb);
}
public void setPanelInfo()
{
topButtonPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
topButtonPanel.setBackground(SystemColor.activeCaption);
helperAddressPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
helperAddressPanel.setBackground(SystemColor.activeCaption);
helperNamePanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
helperNamePanel.setBackground(SystemColor.activeCaption);
filerInfoPanel.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED));
filerInfoPanel.setBackground(SystemColor.activeCaption);
}
public void setLabels()
{
helpInformationButton.setText("Help with information");
returnPreviousButton.setText("Return to previous screen");
viewErrorLogButton.setText("View error log");
listLabel.setText("List");
listLabel.setHorizontalAlignment(SwingConstants.CENTER);
listLabel.setBorder(BorderFactory.createEtchedBorder(EtchedBorder.RAISED, Color.BLACK, Color.BLACK));
listLabel.setOpaque(true);
listLabel.setBackground(SystemColor.control);
helperAddressLabel.setText("Helper Address");
codeLabel.setText("Code");
helperNameLabel.setText("Helper Name");
dateLabel.setText("Data");
helperDateLabel.setText("Helper Date");
timeLabel.setText("Time");
locationLabel.setText("Location");
descriptionLabel.setText("Destination");
destinationLabel.setText("Description");
typeLabel.setText("Type");
durationLabel.setText("Duration");
}
public void setValues()
{
}
public static void main (String args[])
{
try {
for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (Exception e) {
// If Nimbus is not available, you can set the GUI to another look and feel.
}
NewGui gui = new NewGui();
gui.pack();
gui.setVisible(true);
}
}