Having multiple font styles in a menuitem

I am just trying to apply different "font styles" to a menu item available in a menubar.Font style include the three parameters which is passed to a font constructor.
Font(java.lang.String name, int style, int size).
say i want to have a Font("Script",Font.BOLD,20) to a particular menu item which i have created using JMenuBar.
this is the prob. exactly.
needed valuable suggestions.(if possible the code)
regards,
Ranjit Singh

Here's a possible Swing solution, if I understand you correctly:
import java.awt.*;
import javax.swing.*;
public class Test
     public static void main(String args[])
          new Test();
     public Test()
          JFrame f = new JFrame("Menu Item Test");
          JMenuBar menu = new JMenuBar();
          JMenu menuFile = new JMenu("File");
          menu.add(menuFile);
          JMenuItem menuItemOpen = new JMenuItem("Open");
          menuItemOpen.setFont(new Font("Serif", Font.BOLD, 16));
          JMenuItem menuItemClose = new JMenuItem("Close");
          menuItemClose.setFont(new Font("Monospaced", Font.ITALIC, 14));
          JMenuItem menuItemExit = new JMenuItem("Exit");
          menuItemExit.setFont(new Font("Dialog", Font.ITALIC, 12));
          menuFile.add(menuItemOpen);
          menuFile.add(menuItemClose);
          menuFile.add(menuItemExit);
          f.setJMenuBar(menu);
          f.pack();
          f.show();
}

Similar Messages

  • Jtable cell having multiple font colors

    Is it possible to have text in a cell with multiple colors (e.g. using html)?
    -Jim

    Should be possible:
    http://java.sun.com/docs/books/tutorial/uiswing/components/html.html
    I was able to do different colors by adding HTML to one of my table cell data items:
    <html><center><b>Enable</b> <font color=#ff00dd>middle button</font>

  • Creating a Textlayout with multiple font styles

    I am trying to build a textlayout with different fonts. I know how to build a textlayout with 1 font, but after that i can't find a way to add styled text to it.
    Please help

    Use html-text.
    e.g.
    JLabel label = new JLabel();
    String html = "<html><font size=+1 face=\"sans-serif\"> xxxxxx </font></html>";
    label.setText(html);

  • Is there a way to apply all the font styles before importing the file

    Hi,
    I've some text as below in a text file that needs to be imported into InDesign.
    "Law of Civil Procedures"
    And in InDesign this is to be made bold. I want to know if there is a way to make it bold directly and then import it into InDesign, I'm asking this as I have approximately 200 pages that needed with all the font styles applied. This would be very helpful if i can first apply the font styles and then import it into InDesign.

    Hi Salah,
    Thanks for your Answer. I'm completely new to indesign, i'm basically an XSLT Developer. My question in brief is as below.
    We have to make books in InDesign, and the content we receive would be in XML Format and also an RTF file is given with same content, what we do currently is copy and paste the text in InDesign document and start formatting te content accordingly. But we are having huge volumes like more than 6000 pages and similarly we are having 8-12 vilumes, i want to know if we can get the styles directly in InDesign and start working on  them.
    For eg: we have the below content
    <para style="left"><num style="bold">1(1)</num>   <b>[Short title and commencement]</b></para>
    Here there should be a para created and the number should be bold. I'm really unable to understand how to do it. please help me with this. And also our vendors need the IDML file along with the PDF. please let me know how i can do this.
    Also please suggest me some good tutorials regarding this.
    Thanks.

  • How to change header font style in Spark DataGrid?

    I'm looking since last week for a way how to change the font style of the header in a Spark DataGrid. It drive me nuts that I can't find a way to do this. Have anyone one an idea how to achieve it? Any help is appreciated.
    Thanks,
    - Artur

    Hi,
    Some styles won't work because some text styles got hardcoded into the DefaultGridHeaderRenderer's Label. You'll run into this issue not just with the DataGrid headers but also things like the Panel's title and other places where we have text. One way to get around this issue is to create your own custom headerRenderer based on the default one and then redefine the headerRenderer skin part in the skin.
    First, create a subclass of the DefaultGridHeaderRenderer and tweak the "labelDisplay" to your liking (or even just take out all the styles and style it on your own as you had earlier using your custom header renderer's name). Example below (I named it "CustomHeaderRenderer"):
    <?xml version="1.0" encoding="utf-8"?>
    <skins:DefaultGridHeaderRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
                                     xmlns:s="library://ns.adobe.com/flex/spark"
                                     xmlns:mx="library://ns.adobe.com/flex/mx"
                                     xmlns:skins="spark.skins.spark.*"
                                     xmlns:comps="comps.*">
        <fx:Declarations>
            <!-- Remove fontweight="bold" and other styles as you wish
                 Must be a component and not a factory. -->
            <s:Label id="labelDisplay"
                     verticalCenter="1" left="0" right="0" top="0" bottom="0"
                     textAlign="start"
                     verticalAlign="middle"
                     maxDisplayedLines="1"
                     showTruncationTip="true" />
        </fx:Declarations>
    </skins:DefaultGridHeaderRenderer>
    Next, create a simple DataGrid skin by creating a subclass of the  spark.skins.spark.DataGridSkin in MXML and defining a new headerRenderer  component in the fx:Declarations section. Example below (I named it "CustomDataGridSkin"):
    <?xml version="1.0" encoding="utf-8"?>
    <skins:DataGridSkin xmlns:fx="http://ns.adobe.com/mxml/2009"
                    xmlns:s="library://ns.adobe.com/flex/spark"
                    xmlns:mx="library://ns.adobe.com/flex/mx"
                    xmlns:skins="spark.skins.spark.*"
                    xmlns:comps="comps.*">
        <fx:Declarations>
            <!-- Must be a factory with the right id for the skin part -->
            <fx:Component id="headerRenderer">
                <comps:CustomHeaderRenderer />
            </fx:Component>
        </fx:Declarations>
    </skins:DataGridSkin>
    Last, assign your new skin as the skinClass of your DataGrid (either in MXML or as a style):
    <s:DataGrid skinClass="comps.CustomDataGridSkin">
    I know it's not pretty, but it's the result of trading off between having completely custom skinning vs. having knobs to tweak every style. Hope this helps.
    -Kevin

  • Setting font style and size

    I have created a form in Acrobat 9 Pro with multiple text fields for which I would like to make sure only a certain font style & size is used (e.g., Arial 10). I have set this in the properties of the text box, but when I test it by cutting and pasting from a Word document (which our applicants are likely to do), it keeps the original formatting and does not follow the settings I created. Is there a way to allow the cutting and pasting, but only into the settings I've made?
    Thanks for any help!

    Probably. Try doing the same with the field that doesn't have this setting
    turned on, and you'll know for sure...

  • How to copy a Specific Font Style from one instance to another?

    I am using RoboHelp HTML V.7.
    I need to change multiple instances of one style to another. Is there a way to assign a specific font style from one instance of the style to another location (like MS Word style painter), or add the specific style to a shortcut key, or add the specific style the toolbar, or any other suggestions which may expedite my plight?

    Identify the "class=MyStyle" string in the MTML code, and use the Multi-File Find and Replace feature to step through each topic and change the specific instances to "class=MyOtherStyle." (I doubt that you'll want to "Replace All".)
    Sorry, there's no silver bullet!
    Good luck,
    Leon

  • Multiple link styles

    I have multiple link styles defined for a site, the links in the left column should underline on hover - I defined the style sheet a couple of months ago and it works. Here's the problem, I created a new page and added the link - it won't underline on hover. I have tried removing the style, adding the link, adding back the style, applying the style to just that one link, for some reason no matter what I try that one link won't take the style. Makes no sense to me. I have the same problem on another site - any help would be greatly appreciated!
    this is the page: www.yhpark.com/gallery.html
    and how I defined the link style:
    .LeftColNav a:link {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #3F3F3F;
    text-decoration: none;
    text-align: LEFT;
    .LeftColNav a:visited {
    color: #3f3f3f;
    text-decoration: none;
    .LeftColNav a:active {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #3f3f3f;
    text-decoration: none;
    .LeftColNav a:hover {
    font-family: Arial, Helvetica, sans-serif;
    font-size: 12px;
    color: #3f3f3f;
    text-decoration: underline;

    Atania wrote:
    thank you! thank you! I switched the sequence and now all of the links 
    are behaving correctly (all of the time) -
    You're welcome.  :-)
    Nadia
    Adobe® Community Expert : Dreamweaver
    http://www.perrelink.com.au
    Unique CSS Templates | Tutorials | SEO Articles
    http://www.DreamweaverResources.com
    http://twitter.com/nadiap

  • Font style changes when making a book in iphoto

    I am trying to make a book and the inner cover I wrote a little about our vacation. I wanted to make the font size larger so I clicked on the settings button below and this window popped up with "cover title:" "Cover Subtitle:" etc with the font style/Plain/and font size. When I went to change the "Flap Body" font size to make it larger to a size 14 and then clicked ok everyone of those options went from Helvetica Neue to the next font in the list which is ugly. I try to set it to Helvetica Neue and then they all change to another font??????? I ended up just doing open apple z to undo to the original. I use iphoto 7.1.4 and I use the 10.4.11 operating system. I have an imac g5 powerpc. It's not a life or death situation but it is annoying that I cannot change the font size of one thing without having it change the font style of all the options. Any suggestion would be great!!

    I once overshot the limit by marking too many photos to fit within 99 pages, but I could never figure out how to fool the application and had to give up trying to add those 14 extra photos.
    I asked a friend (who practically lives in Terminal) if he had any way of modifying that limit, but he reminded me that if their printing services are set up to bind books and bill for only 99 pages, fooling the application might be useless if the service only prints me a 99 page book and discards the additional pages.
    I can understand that you wouldn't want to let people print 1000 page books, but I sent feedback anyway to allow me to increase the limit. Anyone know of any service that lets you print beyond iPhoto's limits?

  • Font Book will not print multiple fonts

    I am having an issue with Font Book.  I can print one font at a time but if I select multiple fonts (from a collection) it will not print, it just locks up and the print dialog box never opens.  Does anyone know why or is there another free application that will print fonts?

    Font Management in OS X

  • Splitting of text fields when using multiple fonts within a text field and exporting it to XFL.

    Hi All,
    I have been trying out  InDesign and exported files to XFL for use in Flash. If I use a single font for a text box then everything looks fine in flash, but if  I use multiple fonts for the same text box its split into multiple text boxes. For making this more clear I have attached an image.
    Any help to resolve this!!!

    Paragraph styles are tied to the paragraph, not the page.
    You don't say which version you are using, but here's something you could try in CS3 or CS4. Set up a baseline grid in the preferences to match the main pages. The spacing should match the leading of the body text. Make a special paragraph style (you can base it on the body text style) that you will apply to text onthe chapter start page, and as part of that style set it to align to baseline grid. Now for the trick. Select the  text frame onthe start page and define a custom baseline grid with the spacing you want. Save it as an object style, too, while you're at it. The strating text should align to the custom grid on the start page and the documetn grid on the next page.
    Peter

  • Show Font Styles in Drop Dow

    Is there a way to show the font styles in the drop down box? It wastes a LOT of time having to click on each font to see how it appears, then having to go to repeat the process again and again to locate a font I want to use.

    Hello
    Is there a way … to obtain that posters respect the Terms of Use which they must read before entering the forum?
    They states:
    +to help you resolve issues, ask questions, get tips and advice, and more.+
    +If you have a technical question about an Apple product, be sure to check out Apple's support resources first by consulting the application Help menu on your computer and visiting our Support site to view articles and more on our product support pages.+
    +How do I post a question? ‚+
    +_If you searched the forums and didn't find an answer to your question or issue_, click the Post New Topic link at the top of a relevant forum page to post your own question.+
    Taking care of that and using the Search tool:
    clicking on "more options" just below "Search Discussions"
    and filling the fields you would have get:
    your question was asked many times and responded the same.
    Yvan KOENIG (from FRANCE dimanche 30 mars 2008 20:25:46)

  • In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph?

    In Pages (5.5.1) can I create multiple Paragraph Styles within one paragraph. 
    I need to make a table of contents for my Mater's Thesis and want to use the automatic table of contents feature.  I want the first sentence of a paragraph to have a different paragraph setting than the rest of the paragraph.  Is this possible?
    Thanks!

    Nice of you to be doing this for your Mother's Thesis.
    There are several issues here:
    1. A Paragraph Style is what it says, the style for the paragraph
    2. You can format text within a paragraph by applying a Character Style
    3. Pages 5.5.1 lets you apply formatting to overall text for the T.O.C. but not parts of it and you can not retain that formatting as a Paragraph style
    So in answer to your question, no.
    You will need to create the T.O.C. manually and unfortunately as Pages 5.5.1 can't create bookmarks (just one of over 100 missing features) you will be unable to link the T.O.C. to the referred pages in the list.
    Peter
    Apple's marketing slogan:
    Pages 5.5.1 - Can't Do That!

  • How to discover all available font styles for a given family?

    I'm using InDesign CS3 and need to discover all of the available styles for any given font. I've found Application.Fonts.itemByName(), but this only returns a single font by the full name. Using ExtentScript in CS3 How can I ask for ALL font styles for any given font family (as displayed in the styles drop-down?)
    Thanks!

    hey,
    I was just searching the web trying to find why this piece of code:
    for (var i = 0; i <app.fonts.length;i++) {
         app.fonts[i]..... some other code
    take 4+ minutes to execute.
    app.fonts.everyItem().getElements(); did the trick, sweet!!
    However, I would like to ask you whether you know if there is some handout or some guide (possibly online page) for such advanced scripting...
    or how did you find this solution?
    thank you very much for this post, anyway
    regards
    jenda

  • MM: PO Not Picking up PR Having Multiple Line Items

    Hi All,
    When Creating PO with Reference to PR Having multiple line items, not picking up the line items and also the vendor and also the where in we  have to select  input tax code.
    CASE1: Created PR 760001340 with single line item and also could able to create PO.
    Case2: Created PR 760001341 with multiple line items, When creating PO with reference to PR the line items and Vendor are not picking Up.
    Plz. Advise a solution.
    Thanks in Advance.....
    Regards
    Sudheer

    HI SHWN,
    Thanks for prompt response.
    ERROR Message: When referencing a requisition, please also enter a requisition item no.
    Regards
    Sudheer

Maybe you are looking for

  • FiOS Quantum Gateway Router - Intermittent Dropped Connections

    I just got this router and incredibly disappointed!! I had the Arcotec.. Excuse my spelling and was having intermittent problems with that but this new a Gateway is herendous!!! I can't believe they charge you a 199 for this. Wifi signal lost constan

  • Distiller Doesn't See PS File...

    After creating a pdf from a ps file in a particular folder, if I save another ps in that same folder and return to make another pdf file, Distiller doesn't see it. I have to quit distiller in order to go back to that same folder to see the ps. This i

  • How to count direct plus indirect roles assigned per user (8.1.7.4) ?

    Hi, because of the 148 max roles limit in 8.1.7.4 (and because we use Noetix that generates many roles !), we would like to build a query that can be used as an alert and that tells us the following: Number of roles (direct and get from inheritance o

  • Yaourt suddenly asking for root password, pacman-color [NEVERMIND]

    So just a few days ago I started getting the following whenever I try to install something from yaourt: ==> Continue building boxee-source ? [Y/n] ==> -------------------------------------- ==> ==> Building and installing package ==> Install or build

  • Help with jdbc - mysql

    os windows 2000 mysql installed. code below: import javax.swing.*; import javax.swing.event.*; import java.awt.*; import java.awt.event.*; import java.util.*; public class mainFrame { JPanel mainPane; JButton theButton; Action e; public void mainFram