I'm probably just an idiot. Anyways, I was trying out multiple things and eventually I got my code to work but my panel won't let me place the buttons and components where I want them to go. Since I'm new, all I've really used are the basics such as content pane, set size, and flow layout.
Anyways, here's what's happening:
without the frame pack
I feel it's something simple but I've been looking online for answers and either I already came across it and didn't realize, it's a small mistake, or I forgot a line somewhere.
Either way, thanks to those who can help me.
Code Below:
package CourseProject;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class EngineerCalculator extends JFrame {
//Frame
JFrame frame = new JFrame();
//Create the object
JTabbedPane jtp = new JTabbedPane();
//panel
JPanel panel = new JPanel();
Pools pools = new Pools();
HotTubs hotTubs = new HotTubs();
public EngineerCalculator() {
//This creates the template on the windowed application that we will be using
frame.getContentPane().add(jtp);
//Tab Creation
JPanel pTemperature = new JPanel();
JPanel pLength = new JPanel();
JPanel pEdit = new JPanel();
JPanel pCustInfo = new JPanel();
JPanel pCoInfo = new JPanel();
JPanel pGeneral = new JPanel();
//Label additions
JLabel lTemperature = new JLabel();
JLabel lLength = new JLabel();
JLabel lEdit = new JLabel();
JLabel lCustInfo = new JLabel();
JLabel lCoInfo = new JLabel();
JLabel lGeneral = new JLabel();
//Label editing
lGeneral.setText("Date, time, and job informaiton will go here");
pGeneral.add(lGeneral);
//Adds the first tabs to our tab pane objects
jtp.addTab("Pools", pools);
jtp.addTab("Hot Tub", hotTubs);
jtp.addTab("Temp Convert", pTemperature);
jtp.addTab("Length Convert", pLength);
jtp.addTab("Edit", pEdit);
jtp.addTab("Customers", pCustInfo);
jtp.addTab("Company", pCoInfo);
jtp.addTab("General", pGeneral);
//This will create the title you see in the upper left of the window
setTitle("Engineer Specifications Calculator");
//Set size
frame.setSize(345, 400);
frame.setVisible(true);
}
public static void main (String []args){
EngineerCalculator tab = new EngineerCalculator();
Temperature temperature = new Temperature();
Length length = new Length();
Edit edit = new Edit();
CustInfo custInfo = new CustInfo();
CoInfo coInfo = new CoInfo();
General general = new General();
}
}