0

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:

Main.getEditorGui().getComponentPanel().add(new JButton(this.modelName));

Put simply, it dosent work. Any and all help would be amazing!

Edited by CJMW

2
Contributors
2
Replies
16
Views
11 Months
Discussion Span
Last Post by CJMW
0

Not it dosent throw any errors, it simply does nothing. I know that the line of code is being executed too as I have written a simple 'system.out.println("test");' and checked the console, and sure enough 'test' is written.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.