Have been trying to manually write a GUI the past few days and am having a pretty elementary issues. I have a JFrame as the main window and them trying to add JPanels within it with other components in them. Individually the pieces work but having issues adding them together. In the code the issue is in adding a toolbar to a JPanel and then the combination of the two to the JFrame. Followed oracles example on building the toolbar (http://docs.oracle.com/javase/tutorial/uiswing/components/toolbar.html) but I think the issue is either how I am adding it to the frame or the general approach of adding components to a JPanel and then the Frame. Code below.....any thoughts
Frame Class
import javax.swing.*;
import java.awt.*;
public class frmMainMenu {
public static void main(String main[]){
//Create Frame
JFrame frmMainMenu = new JFrame();
//Size Frame
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int Width = screenSize.width;
int Height = screenSize.height;
frmMainMenu.setSize(Width,Height);
//Add Components
comLeftToolBar obj1 = new comLeftToolBar();
frmMainMenu.add(obj1);
//Display Frame
frmMainMenu.setVisible(true);
}
}
Toolbar Class
import java.awt.*;
import javax.swing.*;
public class comLeftToolBar extends JFrame{
//Create ToolBar
public void comCreateNavBar() {
JToolBar comNavToolBar = new JToolBar();
Toolkit kit = Toolkit.getDefaultToolkit();
Dimension screenSize = kit.getScreenSize();
int Height = screenSize.height;
comNavToolBar.setSize(50, Height - 100);
comNavButtons(comNavToolBar);
}
//Create Buttons
public void comNavButtons(JToolBar comNavToolBar) {
JButton comNavButton = new JButton();
JButton comProButton = new JButton();
comNavToolBar.add(comNavButton);
comNavToolBar.add(comProButton);
}
//Create Navigation Bar
public void comLeftNavBar() {
JPanel comNavBar = new JPanel();
comNavBar.add(new comLeftToolBar());
}
}
Thanks for whatever guidance you all have it is appreciated