Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set a Title for a jPanel on eclipse

I'm new to programming and I have a question about the window builder. I searched online looking for a way to set a title for a jPanel and not a Jframe, and all what I found was to use for the Jframe setVisible. I don't know if there is a way to set a title for jpanel. I need the user to always see which screen he accessed. I'm using eclipse java language. Please help

like image 824
Beginnerprogrammer Avatar asked Sep 13 '25 00:09

Beginnerprogrammer


1 Answers

This is What I did

JPanel mainPanel = new JPanel();

String title = "A titled border";
Border border = BorderFactory.createTitledBorder(title);
mainPanel.setBorder(border);
like image 136
Beginnerprogrammer Avatar answered Sep 15 '25 15:09

Beginnerprogrammer