You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Graphics, AWT, Swing II part<br />
Receive our newsletter with new tips! Almost 6,000 subscribers (by June 2001) can not be<br />
wrong!<br />
They read our tips every week! To subscribe to The <strong>Java</strong> FAQ Daily send empty e-mail to:<br />
javafaq-tips-subscribe@topica.com or visit at:<br />
http://www.topica.com/lists/javafaq-tips/<br />
Graphics, AWT, Swing<br />
Q: I'm resetting the TitleBorder's title via setTitle, but no change occurs....<br />
I'm trying to make a dialog box containing a panel whose TitleBorder's text<br />
dynamically reflects the function of the list box within it. The title text and the list box<br />
contents should change according to the buttons pressed elsewhere in the dialog<br />
box. I'm resetting the TitleBorder's title via setTitle, but no change occurs. Do I need<br />
to update the dialog? If so, how do I do this?<br />
Answer: Yes, you need to update the dialog.<br />
How? Call the validate() and invalidate () methods<br />
Q: everytime you create a dialog-object, the dialog pops up in the upper left<br />
corner of the screen. Now I want it to be automatically placed in the center of the<br />
application's frame.<br />
Answer: private void center() {<br />
Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();<br />
setLocation( ( ( screenDim.width - getSize().width ) / 2 ),<br />
( ( screenDim.height - getSize().height ) / 2) );<br />
}<br />
You can call this anytime after calling pack() on the JDialog, before<br />
setVisible().<br />
--<br />
Dave Neuendorf<br />
Q: How can i disable the right click on the label?<br />
I have a JTree and a JPopup: i've forced the code to be able to select the node with<br />
file:///F|/350_t/350_tips/graphics-II.htm (1 of 6) [2002-02-27 21:18:10]<br />
Visit us here and you will find<br />
much more tips!