Netbeans: how to put some title in the title bar

At Net Beans, I developed a small desktop application. When I launch my application, the title bar does not appear in the Windows title bar. Is there any way through which I will indicate some heading that will later appear in the Windows title bar? Below is my main method.

public static void main(String args[]) { java.awt.EventQueue.invokeLater(new Runnable() { public void run() { new MyJFrame().setVisible(true); } }); } 
+4
source share
5 answers

You can set the title bar at the time of initializing the JFrame as follows

 JFrame frame = new JFrame("My Title"); 

or you can create a public method for your custom class like

 public void setTitle(String title){ frame.setTitle(title); // for this you have declare the frame object as global for this class only } 

and use this method

 MyJFrame myframe = new MyJFrame(); myframe.setTitle("my new title"); myframe.setVisible(true); 
+3
source
 myTopLevelContainer = new myTopLevelContainer("myTitlaLabel"); 

or

 myTopLevelContainer.setTitle("myTitlaLabel"); 
+2
source

Header setting in JFrame Netbeans Swing

You can see the title property in the properties window (bottom right). You can set the title by clicking this property. If you cannot find the properties window, simply click on the Design tab and then on the empty JFrame GUI.

+2
source

From the NetBeans Wiki :

To give your application a title, right-click on the JFrame and open its properties dialog. Go to the properties tab.

On the Properties tab, find and change the title field. NetBeans does the rest.

+1
source

Ok, that worked for me ...

 public yourGUIname() { initComponents(); this.setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("your image here"))); this.setTitle("your title here"); // that is the code you looking for } 

what i did was put the above code in the generated public method.

0
source

All Articles