hi, pls,i'am a beginner in java and have being trying to write a code to (1).change the font size of a text.(2). change the font style of a text.(3)use dialog boxes effectively but failed.pls i need to tell me how to go about it and if you can help me with the code
hi, The 1st two problems that you've mentioned involve the use of the Font class found in package "java.awt.*"
To change the Font Style and The Font Size use the following constructor of the Font class :
Font font=new Font(String name, int style, int size);
where, name - is the required font name like Lucida, Arial etc(if you're on Windows) style - can be PLAIN, or a bitwise union of BOLD and/or ITALIC(for example, ITALIC or BOLD|ITALIC) size - is the integer value that specifies theh size on the font.
An example of using the above would be :
Font font=new Font("Comic Sans Ms",PLAIN,12);
Once you've created the Font object you can set the font of a Label, TextArea, etc to the perticular Font using the setFont(Font); method. Here's How....
TextArea ta=new TextArea("www.ParthSoft.cjb.net"); Font font=new Font("Comic Sans Ms",PLAIN,12);
The above call would work even if ta was an object of the Label class. As the method setFont is inherited from java.awt.Component, it can be applied to all the classes that are inherited from the Component class...
Your Second question relates to using Dialogs. Since your question is not very specific. Here is an example of how to create a Dialog :