So I'm maing a 3D game editor in Java using LWJGL (Lightweight Java Game Library), I have the editor set up so that the user can create new levels, load up saved levels, save and quick save current levels, import textured models etc.. the basics.
I am now trying to implement a system that when a new model(s) is imported into the editor, a button (JButton) will appear on the bottom taskbar, therefore enabling the user to switch between different models.
I am however, having a little trouble. Here is the code which defines the JPanel where I want the buttons to go:
/* ----- */ /** * The componentsPanel will contain buttons that will set the current acvite model to be placed * within the editor. */ // This JPanel contains the list of models and textures for the current project. componentPanel = new JPanel(new GridLayout(0, 5)); // Gives the south (bottom) panel a black border. componentPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK)); //componentPanel.add(new JButton("This is a test")); /* ----- */
And here is the code I am trying to use to add a new button to the panel:
Put simply, it dosent work. Any and all help would be amazing!