I need to design tabs shown in the attached document. I designed some but need your help with the rest. Could you create them using 'Pools Tab' code as a blueprint so the programming outline in all the tabs look similar if at all possible? Password for the document is 'J@V@'. Please let me know if you require any additional information or cannot open the document.
'Pools Tab' code -
import java.text.*;
import javax.swing.*;
import java.awt.event.*;
import java.awt.Container;
import java.awt.*;
public class Pools extends JPanel
{
//private JFrame mainFrame;
private JButton calculateButton;
private JButton exitButton;
private JTextField lengthField;
private JTextField widthField;
private JTextField depthField;
private JTextField volumeField;
private JLabel lengthLabel;
private JLabel widthLabel;
private JLabel depthLabel;
private JLabel volumeLabel;
public Pools()
{
//mainFrame = new JFrame("Pools");
calculateButton = new JButton("Calculate Volume");
exitButton = new JButton("Exit");
lengthLabel = new JLabel("Enter the pool's length (ft):");
widthLabel = new JLabel(" Enter the pool's width (ft):");
depthLabel = new JLabel("Enter the pool's depth (ft):");
volumeLabel = new JLabel("The pool's volume is (ft^3):");
lengthField = new JTextField(5);
widthField = new JTextField(5);
depthField = new JTextField(5);
volumeField = new JTextField(5);
//Container c = this.getContentPane();
//this.setLayout(new GridLayout(5,2));
this.setLayout(new FlowLayout());
this.add(lengthLabel);
this.add(lengthField);
this.add(widthLabel);
this.add(widthField);
this.add(depthLabel);
this.add(depthField);
this.add(calculateButton);
this.add(exitButton);
this.add(volumeLabel);
this.add(volumeField);
calculateButton.setMnemonic('C');
exitButton.setMnemonic('x');
calculateButtonHandler chandler = new calculateButtonHandler();
calculateButton.addActionListener(chandler);
ExitButtonHandler ehandler = new ExitButtonHandler();
exitButton.addActionListener(ehandler);
FocusHandler fhandler = new FocusHandler();
lengthField.addFocusListener(fhandler);
widthField.addFocusListener(fhandler);
depthField.addFocusListener(fhandler);
volumeField.addFocusListener(fhandler);
this.show();
}
class calculateButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
DecimalFormat num = new DecimalFormat(" , ###.## ");
double width, length, depth, volume;
String instring;
instring = lengthField.getText();
if (instring.equals(" "))
{
instring = " 0 ";
lengthField.setText(" 0 ");
}
length = Double.parseDouble(instring);
instring = widthField.getText();
if (instring.equals(" "))
{
instring = " 0 ";
widthField.setText(" 0 ");
}
width = Double.parseDouble(instring);
instring = depthField.getText();
if (instring.equals(" "))
{
instring = " 0 ";
depthField.setText(" 0 ");
}
depth = Double.parseDouble(instring);
volume = depth * length * width;
volumeField.setText(num.format(volume));
}
}
class ExitButtonHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
System.exit(0);
}
}
class FocusHandler implements FocusListener
{
public void focusGained(FocusEvent e)
{
if(e.getSource() == lengthField || e.getSource() == widthField || e.getSource() == depthField)
{
volumeField.setText(" ");
}
else if(e.getSource() == volumeField)
{
volumeField.setNextFocusableComponent(calculateButton);
calculateButton.grabFocus();
}
}
public void focusLost(FocusEvent e)
{
if(e.getSource() == widthField)
{
widthField.setNextFocusableComponent(calculateButton);
}
}
}
}