473,385 Members | 1,474 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Font chooser using java

Hi friends,
Please help me in creating font chooser component
Feb 26 '07 #1
3 2659
r035198x
13,262 8TB
Hi friends,
Please help me in creating font chooser component
What do you have so far?
Feb 26 '07 #2
horace1
1,510 Expert 1GB
Hi friends,
Please help me in creating font chooser component
you could create a font menu, e.g.
Expand|Select|Wrap|Line Numbers
  1. // create the font menu
  2. protected void createFontMenu()
  3.         {
  4.         JMenuItem menuItem = new JMenuItem("10");
  5.         menuItem.addActionListener(this);
  6.         fontMenu.add(menuItem);
  7.         menuItem = new JMenuItem("12");
  8.         menuItem.addActionListener(this);
  9.         fontMenu.add(menuItem);
  10.         menuItem = new JMenuItem("14");
  11.         menuItem.addActionListener(this);
  12.         fontMenu.add(menuItem);
  13.         menuItem = new JMenuItem("16");
  14.         menuItem.addActionListener(this);
  15.         fontMenu.add(menuItem);
  16. ... etc
  17.  
then when the menu item is selected read the integer and set the font size, e.g.
Expand|Select|Wrap|Line Numbers
  1.     else
  2.     if( menuSelected == fontMenu) 
  3.         {
  4.          try { 
  5.               font = (new Integer((String)obj)).intValue();  
  6.               errorArea.setFont(new Font("Courier New", Font.BOLD,  font)) ;  
  7.  
otherwise you could use a popup menu, etc

see
http://java.sun.com/docs/books/tutorial/uiswing/
Feb 26 '07 #3
Friends actually i creating Word("similar to MSWORD application").... so i need to create Font Chooser dialog box...that contains "Styles, Fonts, size" etc.... i just want to know how to get all the fonts that are installed in the system.... and how to display....

thanks and regards,
sathya
Mar 4 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: hamacher | last post by:
I have a particular need to an application . . . I need users to specify a directory (with path) on their filesystem on an HTML page. All I need at the server is a string representation of the...
1
by: liberty | last post by:
Hello... To make a color chooser (like in photoshop, for example), how its possible?? Do you have a clue? Liberty ..
3
by: LEECURRY | last post by:
Hey I would like to create a combo box with some pregenerated numbers in say 1 to 24. I would like it for the user to select a number in the combo box like say 12 and then the font size for a text...
1
by: FLEMEF | last post by:
Hello All, I'm not very good at Java... With this piece of Java code, how could I modify the StyleOptions.java program to allow the user to specify the size of the font, while using the text...
53
by: Jonas Smithson | last post by:
In his book "CSS: The Definitive Guide" 2nd edition (pgs. 116-117), Eric Meyer has an interesting discussion about "font-size-adjust" that was evidently dropped in CSS 2.1 due to browser...
1
by: kiransasi | last post by:
Hi All, <input type = "file"> opens up a File Chooser on clicking on the Browse button, in that file chooser, the top title of it will be "Choose File" for IE and "File Upload" for Mozilla. I want...
3
by: Luyolo | last post by:
Hi guys, will someone help me on implementing the Directory chooser using C# in visual studio 2005. Help ASAP..
3
by: Phil Stanton | last post by:
Correct me if I'm wrong, but is it impossible to change the font in a report field when in print preview (MDE database) or can it only be done in design view in the MDB database. Part of my...
3
by: Akino877 | last post by:
Hello, I am trying to user a File Chooser with DIRECTORIES_ONLY set. And I would like to be able to hide the "Files of type" label and the associated combo box. I wonder if there is a way to do...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.