I developed a small desktop application in Net Beans. When i run my application there appears no title in the Windows Title bar. Is there anyway through which i specify some title which later on will appear in Windows title bar? Following is my Main method
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new MyJFrame().setVisible(true);
}
});
}
You can see title property in properties window (Bottom right side). You can set title upon clicking that property. If you are unable to find property window, just click on Design tab and then on blank JFrame GUI.
You can set the title bar at JFrame initialization time like this
JFrame frame = new JFrame("My Title");
or you can create 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 like this way
MyJFrame myframe = new MyJFrame();
myframe.setTitle("my new title");
myframe.setVisible(true);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With