Graphics, AWT, Swing II part
Visit us here and  you will find
much more tips!
Receive our  newsletter with new tips!  Almost 6,000 subscribers (by June 2001) can not be
wrong! 
They read our tips every week! 
 To subscribe to The Java FAQ Daily send empty e mail to:
javafaq tips subscribe@topica.com
  or visit at:
http://www.topica.com/lists/javafaq tips/
 Graphics, AWT, Swing
Q: I m resetting the TitleBorder s title via setTitle, but no change occurs....
I m trying to make a dialog box containing a panel whose TitleBorder s text
dynamically reflects the function of the list box within it. The title text and the list box
contents should change according to the buttons pressed elsewhere in the dialog
box. I m resetting the TitleBorder s title via setTitle, but no change occurs. Do I need
to update the dialog? If so, how do I do this?
Answer: Yes, you need to update the dialog. 
How? Call the validate() and invalidate () methods
 Q: everytime you create a dialog object, the dialog pops up in the upper left
corner of the screen. Now I want it to be automatically placed in the center of the
application s frame.
Answer: private void center() {
   Dimension screenDim = Toolkit.getDefaultToolkit().getScreenSize();
   setLocation( ( ( screenDim.width   getSize().width ) / 2 ),
   ( ( screenDim.height   getSize().height ) / 2) );
}
You can call this anytime after calling pack() on the JDialog, before
setVisible().
  
Dave Neuendorf
Q: How can i disable the right click on the label?
I have a JTree and a JPopup: i ve forced the code to be able to select the node with
a right click and show the popup. The problem is that i can right click on the popup
labels to select them, but i d like to select them only with a left click. How can i
disable the right click on the label? Can somebody help me please?
Answer: You can add in an if loop that only executes if the left mouse button is down
using code like the following:
file:///F|/a_jsite/350_tips/graphics II.htm (1 of 5) [2001 07 08 11:24:55]






footer




 

 

 

 

 Home | About Us | Network | Services | Support | FAQ | Control Panel | Order Online | Sitemap | Contact

java web hosting

 

Visionwebhosting.net Business web hosting division of Web Design Plus. All rights reserved