The problem at this present time:
What the output should be:
I believe I have to simply add the main() within the bmiCalculatorFrame instead of the one I've made but not sure on how this is done as doing so causes many more errors.
code, http://pastebin.com/raw.php?i=svTUwufa
I know it is a lot of lines and not very specific but it is the best way to explain the predicament I am in.
The root of your evil, i guess, can be found in this lines:
private void initComponents() {
JFrame bmiCalculatorFrame = new JFrame();
You are adding all your components to bmiCalculatorFrame
, but in the main method, you instanciate your class which is extending JFrame
by itself. The shortest way to reach your goal is in my eyes to alter the following lines:
bmiCalculatorFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
bmiCalculatorFrame.setTitle("BMI Calculator");
Container bmiCalculatorFrameContentPane = bmiCalculatorFrame.getContentPane();
to use this
instead of bmiCalculatorFrame
.