Jim,
Sorry for hanging onto this. You said
You can still print out what the width and height fields of the Dimension minimumSize are. I think that the values will be in pixels, not rows or columns - though those should be somewhat proportional. I tested this with various fonts and with various size related methods like getSize(),getMinimumSize(),getMinimumSize(int col),getPreferredSize(..) etc. We get SAME result NOT
propotional as you mentioned. Did u want me to get this
strange result again?

<pre>
For Button
----------
Monospaced,Font.PLAIN,24 getSize():Width=0Height=0
Monospaced,Font.ITALIC,44 getSize():Width=0Height=0
For TextField
-------------
Monospaced,Font.PLAIN,24 getSize():Width=0Height=0
Monospaced,Font.PLAIN,24 getMinimumSize():Width=0Height=0
Monospaced,Font.PLAIN,24 getMinimumSize(int):Width=0Height=0
Monospaced,Font.PLAIN,24 getPreferred():Width=0Height=0
Monospaced,Font.PLAIN,24 getPreferred(int):Width=0Height=0
Monospaced,Font.PLAIN,44 :Width=0Height=0
Serif,Font.PLAIN,44 :Width=0Height=0
Serif,Font.ITALIC,44 :Width=0Height=0 </pre>
<pre>
import java.awt.*;
class mframe extends Frame{
public mframe(){
super("maha");
setLayout(new FlowLayout());
Button b1 = new Button("Button1");
b1.setFont(new Font("Monospaced",Font.PLAIN,24));
System.out.println("Monospaced,Font.PLAIN,24 getSize():"
+"Width="+b1.getSize().width
+"Height="+b1.getSize().height);
b1.setFont(new Font("Monospaced",Font.ITALIC,44));
System.out.println("Monospaced,Font.ITALIC,44 getSize():"
+"Width="+b1.getSize().width
+"Height="+b1.getSize().height);
TextField tf1 = new TextField("12345",5);
TextField tf2 = new TextField("12345",5);
TextField tf3 = new TextField("12345",5);
TextField tf4 = new TextField("12345",5);
tf1.setFont(new Font("Monospaced",Font.PLAIN,24));
System.out.println("Monospaced,Font.PLAIN,24 getSize():"
+"Width="+tf1.getSize().width
+"Height="+tf1.getSize().height);
System.out.println("Monospaced,Font.PLAIN,24 getMinimumSize():"
+"Width="+tf1.getMinimumSize().width
+"Height="+tf1.getMinimumSize().height);
System.out.println("Monospaced,Font.PLAIN,24 getMinimumSize(int):"
+"Width="+tf1.getMinimumSize(5).width
+"Height="+tf1.getMinimumSize(5).height);
System.out.println("Monospaced,Font.PLAIN,24 getPreferred():"
+"Width="+tf1.getPreferredSize().width
+"Height="+tf1.getPreferredSize().height);
System.out.println("Monospaced,Font.PLAIN,24 getPreferred(int):"
+"Width="+tf1.getPreferredSize(5).width
+"Height="+tf1.getPreferredSize(5).height);
tf2.setFont(new Font("Monospaced",Font.PLAIN,44));
System.out.println("Monospaced,Font.PLAIN,44 :"
+"Width="+tf2.getMinimumSize().width
+"Height="+tf2.getMinimumSize().height);
tf3.setFont(new Font("Serif",Font.PLAIN,44));
System.out.println("Serif,Font.PLAIN,44 :"
+"Width="+tf3.getMinimumSize().width
+"Height="+tf3.getMinimumSize().height);
tf4.setFont(new Font("Serif",Font.ITALIC,44));
System.out.println("Serif,Font.ITALIC,44 :"
+"Width="+tf3.getMinimumSize().width
+"Height="+tf3.getMinimumSize().height);
add(b1);
add(tf1);
add(tf2);
add(tf3);
add(tf4);
setSize(200,100);
setVisible(true);
}
public static void main(String args[]){
new mframe();
}
}
</pre>
regds
maha anna
[I split up some of the longer lines of the program to avoid forcing a scrollbar to appear on the browser - Jim]
[This message has been edited by Jim Yingst (edited April 04, 2000).]