In a project of mine I have been trying to add a JConsonle to a JPanel witch is contained by another JPanel.
The problem is that the JConsole keeps being set 5px from the top of the JPanel.At first I tought it was the container that wasent beeing set up right but after giving it a red background I realised that the console is being set 5px from the top.
I've also tried to use BorderLayout to set it in the NORTH or CENTER of the JPanel but that dosent work either.
This is my code:
public class MonopolyPanel extends JPanel {
JPanel consoleP = new JPanel();
JConsole console = new JConsole();
MonopolyPanel(){
this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
console.setPreferredSize(new Dimension(530, 300));
consoleP.add(console);
this.add(consoleP);
}
}
JConsolecontrol come from?