Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

MY Logo on JDailog  RSS feed

 
Karan Galhotra
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody,

Can somebody tell me, how to put a logo(Image) on a JDialog with its title name. Here is my code i want to put a logo(Image) before the title name of my dialog viz is ("my dialog")... plzzz can any body help me out.

public void Dialog2()
{
JDialog dialog = new JDialog(frame);
dialog.setTitle("my dialog");
dialog.setModal(true);
dialog.setResizable(false);

JPanel passPanel = getPassPanel();
dialog.add(passPanel, BorderLayout.NORTH);

JPanel buttonsPanel = getButtonsPanel();
dialog.add(buttonsPanel, BorderLayout.CENTER);
dialog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
dialog.setSize(300,130);
dialog.setVisible(true);
dialog.setLocationRelativeTo(frame);
}


Thanks in advance

Karan Galhotra
 
Balasubramanian Chandrasekaran
Ranch Hand
Posts: 215
Firefox Browser Linux VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can use

setIconImage(Image)

to get your task done
 
Ulf Dittmer
Rancher
Posts: 42972
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can't put an image in the title - it's text only. You'll need to find space for it in the dialog itself.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!