Two fon colors in JTextField

Is it posible to have two different font colors in a JTextField?
Show me how please!
Thanks.
Pedro

hi,
rsolod is right, it is not possible to do so with a TextField. I would not use the EditorPane, that's more for browsing html's and such. JTextPane is more suited for displaying styled text. I have to warn you though it's a whole different approach then with a simple JTextField.
You can download this great examples which demonstrates all the different TextComponents:
http://java.sun.com/docs/books/tutorial/uiswing/components/example-swing/TextSamplerDemo.java
hope this helps,
Stijn

Similar Messages

  • Is it possible to put two different colors in tree parent node background and child nodes background?

    Is it possible to put two different colors in tree parent
    node background and child nodes background?
    Any help will be very helpful.
    Thanks

    Hi PanosE,
    Yes, you can set up another Standard Edition Server in child domain and then deploy pool pairing.
    You need to deploy a new Front End Pool for the new Standard Edition Server.
    A similar case for your reference.
    https://social.technet.microsoft.com/Forums/office/en-US/eca4299c-8edb-481e-b328-c7deba2a79ba/lync-2013-standard-edition-lync-fe-pools-in-multiple-domain-single-forest-senario?forum=lyncdeploy
    Best regards,
    Eric
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Container appearing  in two different colors at same time screenshot attached .

    Hi ,
    I am very much impressed with this site Look , as you can observer that
    in this the Container is showing in two different colors at the same time as shown in screenshot attached .
    Please tell me how to achieve this ??
    One Part is Loading Advertisement and other View is their business Rules .
    Please tell me how to get this behaviour
    Because when i use Application container background color="black" it displays the whole container in Blackm color.
    Please help
    Thanks in advance.

    There are many ways of achieving this. One can be to use background image for the application. Other ways can be to use various containers (panel, canvas etc. with background images) to get this look and feel. Think of it in HTML way. The way you can use div tags to layout your page, you can use various containers of Flex to layout your page.

  • Two different colors for two different record in the same tab

    How can i have two different colors in a tab that return records; i would like to have a line in a color, the next in an other one in order to alternate the color of each record returned;
    This concern fields from a group in the data model
    Thanks
    null

    Hi
    similar issue is answered perviously here .. see it that helps
    bye
    sudhir

  • Safari title bar has two different colors

    Ever since installing Mountain Lion, Safari's title bar is two different colors: behind the title of the page, and the bookmark bar are both dark grey:
    I deleted .plists and whatnot, and that didn't work.  Also, I created a new user profile, and the colors are correct.  Help!

    After doing some digging, I found this:
    https://discussions.apple.com/thread/4141536?start=0&tstart=0
    and this:
    https://discussions.apple.com/message/19038993#19038993
    Also, I enabled the debug menu in Safari and clicked "Use Buffered Windows," and this is the result:
    Compared to my girlfriend's computer (brand-spankin' new, right out of the box), this still isn't 100% correct, but it is close.
    Also, I checked console (after I unchecked "Use Buffered Windows"), and it says "Invalid unbuffered shadow parameters."  Does anyone know what that means or how to fix it?

  • Set Background color for JTextField

    Dear all,
    How can I set the background color of a JTextField? I have tried the method setBackground(Color). But seems not working.
    Thanks.

    Try this;
    text = new JTextField();
    your_color =  Color.red ;
    text.setBackground(your_color);

  • Using the Color Guide with two base colors?

    I have two colors that I would like the Color Guide to pick other colors that will work well with them. Is there a way to do this? If I select just the green color as my base color and then select a color rule, the colors do not seem to go well with my other color.
    Thanks in advance.

    The colors being used are RGB colors #75959B and #6BB130. I am still working on developing my ability to select colors that work harmoniously together, that is why in the meantime, I am hoping to use the Illustrator Color Guide.
    I am trying to create instructional handouts that use screenshots from Evernote, and Evernote uses green #6BB130 as the dominant color (see attached). I am trying to find a solid color that will work well with this green that I can use to create a banner at the top of each page (see second attached image) that will have a title on it and some other info. This solid color of the banner also has to work with #75959B because that is the color that will be used for the logo.
    Thanks for any help!

  • Setting colors so JTextField doesn't look like its there

    I have changed the background color of both my panel and JTextField to black and changed the foreground of my JTextField to a diffent color. The desired affect is that the text will appear without seeing the field but there is a white line around the field that will not disappear. Any ideas on how to get rid of the white outline?

    Possibly setOpaque(false), but it sounds to me like you want a JLabel.
    Cheers,
    Radish21

  • Hyperlink colors two different colors on pulished page

    iWebbers,
    I have published a small site. The hyperlinks on the page are gray, which I understand cannot be modified. But the links are two different grays. Links to other pages on the site are dark gray, while links to email and external URLs are a lighter gray.
    Have others noticed this, or is it just me & my site?
    BC

    CSS Classes:
    http://www.tizag.com/cssT/class.php
    Then just change the link attributes for those classes so that the links show up different colors:
    http://www.w3schools.com/css/css_pseudo_classes.asp

  • Hey guys, I am new to javascript and I am trying to figure out how to add two spot colors to the active document. I am trying to get it to detect weather or not the spot colors are already in the document, and if they are not, it will proceed to create th

    Here's what I have so far.
    var docRef = app.activeDocument;
    if (docRef.swatches.getByName ("CutContour") === 'undefined') {
    var spotNameCC = "CutContour";               
    var cmykColor = new CMYKColor();
    cmykColor.cyan = 0;
    cmykColor.magenta = 100;
    cmykColor.yellow = 0;
    cmykColor.black = 0;
    // Create Spot
    var spot = docRef.spots.add();
    spot.color = cmykColor;
    spot.colorType = ColorModel.SPOT;
    spot.name = spotNameCC;
    //var spotNameW = "WEED (r)";
    // Create CMYKColor
    /*var cmykColor2 = new CMYKColor();
    cmykColor2.cyan = 50;
    cmykColor2.magenta = 0;
    cmykColor2.yellow = 50;
    cmykColor2.black = 0;
    // Create Spot
    var spot2 = docRef.spots.add();
    spot2.color = cmykColor2;
    spot2.colorType = ColorModel.SPOT;
    spot2.name = spotNameW;
    Let me know what I did wrong lol I know it has to do with the detecting part. Also, if anyone knows any good websites to learn javascript I would be very thankful. I am not sure what a lot of the syntax means. Thanks!!

    Never mind I figured it out. Someone posted a similar question a few months ago on here, damn this forum is awesome wish I had known about it sooner. Sorry if I wasted anyone's time.

  • Two files, same pantone color...Onscreen looks like two different colors?

    Recently we have been having this issue at work, We have a line of packaging that uses the same pantone color (375 C). When we go to create a new document and use that same pantone the color onscreen looks more saturated then its predecessor. The only think I can think of is that I've upgrade to the pantone plus system but have since uninstalled and reinstalled the old color books. Both documents are in CMYK color space and both use the same ICC profile. Any thoughts? I know it wont appear this way when printed but we make a lot of PDFs for approvals and the colors come out more saturated in the PDF as well. See sample image below. Thanks for your help!

    Try copying a sample of 375C from  Document A into document B. If the Doc A swatch magically changes color to match the doc B swatch the you have a document with either a modified or old color that uses the same EXACT SAME name. This happens when someone modifies the CMYK values PANTONE 375 C does not change the name of the color. What Illustrator does is the AUTOMATICALLY changes the color mode of Doc A swatch from CMYK to Book color, when you paste an item having the same swatch name. You do not  even get a about to merge color warning. For that reason if I ever tweak a color to get a better laser print, I change the name (eg: PANTONE 375C (Mod)
    Though I feel one of Wade's 2 suggestions may be right, this also can cause color difference.

  • How to change the color of JTextField

    how can i change the color of JTextField

    download a copy of the api docs and have them handy on your pc.
    most 'changing something' methods in swing start set....()
    often colors are background/foreground/whatever - just check all the set...(),
    most are self explanatory
    note: most (again) methods you want, you'll find in the apidocs section
    "Methods inherited from.....", so don't read only the methods section

  • IPhoto - is it using two different color spaces?

    I know I should have a better handle on this whole question by now, but am still confused by the 1.8 vs. 2.2 Gamma issue.
    On the recent advice of an Apple PhotoServices tech, I've just changed my main display's Gamma from the default 1.8 to the darker 2.2 -- hoping to maximize consistency between what I see onscreen and what I'll receive in my printed Calendar order. (Everything else is still based on the default "Cinema HD" profile.)
    Using one particular JPEG image as a test, I'm seeing something curious:
    In Aperture, the image's thumb and its full-screen version look basically the same. But in iPhoto, that same image looks quite different depending on whether I'm viewing it as a thumb (or as an image placed in a Calendar theme), vs. when I double-click that image and see it in iPhoto's Editor window.
    When I see it in iPhoto's editing mode, it suddenly looks noticeably lighter -- as if I'd switched my display back to the old 1.8 Gamma.
    Can anyone enlighten me here (pardon the pun)? Why does iPhoto's editor window seem to display an image differently than other programs, or even than elsewhere in iPhoto itself? And why am I only seeing this discrepancy after setting my display to the 2.2 Gamma?
    John Bertram
    Toronto

    Okay --
    The plot thickens. I followed your suggestion, Terence, and did some tests. Here are the interesting (if confusing) results:
    When I open anything from within the iPhotoLibrary folder using Preview, Preview gives the Color Profile info as follows:
    Color Model: RGB
    ColorSync Profile: Generic RGB Profile
    This seems to apply to anything from within the iPhotoLibrary package, whether we’re talking images from the Originals folder, from the Modified folder, or thumbs from the Data folder. And they all (when viewed in Preview) look the same, and they all look “correct” in terms of general contrast.
    BUT...
    When I do a Finder “Get Info” on those same files, suddenly there are differences.
    1) from the Modified folder:
    Most images from the Modified folder now say (in Get Info’s “More Info” pane):
    Color space: RGB
    Profile name: Adobe RGB (1998)*
    * (A few give the Profile name as “sRGB IEC61966-2.1”, and the one that got saved as a .psd file says “Camera Sync Profile”. The strange thing is I can’t seem to find any pattern between the images which were modified using my “external editor” -- Photoshop Elements -- vs. the ones which were edited using only iPhoto’s adjustment tools. The bulk of them all say “Adobe RGB (1998)” as the Profile Name.)
    Note that these are the same images which, when opened in Preview, ALL claim the “Generic RGB Profile” -- and all look correct under those circumstances.
    2) from the Data folder:
    Meantime, ALL the thumbnail images which iPhoto has created for its Data folder, when “Get Info’d” in the Finder, all state their Profile name as “sRGB IEC61966-2.1”.
    Open the same thumb image in Preview, and it’s back to “Generic RGB Profile” (as well as back to looking correct and not too dark).
    3) from the Originals folder:
    Finally, images from iPhoto’s Originals folder give no color profile data whatsoever in the “More info” pane of the Finder’s Get Info window. So is this the same as having the “Generic RGB Profile”?
    In any case, here are three different folders (Originals, Modified, and Data), and iPhoto appears to be using a different color profile for the images contained in each one -- and in the case of the Modified folder, several different profiles.
    Yet all of these images, when opened in Preview, appear to use the “Generic RGB Profile” -- and all appear as they should in terms of Gamma/contrast on screen -- while when viewed within iPhoto the same image will look quite different depending on whether it’s being seen in iPhoto’s regular window (as a thumb or as part of a Calendar layout, for instance -- all too dark) or in iPhoto’s editing window, in which case it suddenly looks fine.
    The other mystery is why this discrepancy between iPhoto’s regular viewer and its editing window wasn’t apparent when my display was set to the default 1.8 Gamma; it’s only become an issue under the new (AppleSupport-recommended) 2.2 setting.
    = = = = = == = = = = = = = = = = = = = = = = = = = = = = = =
    My brain officially hurts now. (I guess this is just more evidence that Computers and the Internet will all be very nice if they can finally just get them working.)
    Any help in interpreting this data will, as always, be much appreciated.
    Thanks,
    John Bertram
    Toronto

  • Two #57 color cartridges don't work right, faded.

    Replaced my out of date #57 color cartridge even though it didn't say "empty".  New one isn't any better.  Colors are faded.  Tried the cleaning feature.  What to do now?

    Please read this post then provide some details.  What printer model? What operating system?  Have you tried printing a diagnostic page?  What print quality settings are you using?  Are you printing on plain paper or photo's?
    Bob Headrick,  HP Expert
    I am not an employee of HP, I am a volunteer posting here on my own time.
    If your problem is solved please click the "Accept as Solution" button ------------V
    If my answer was helpful please click the "Thumbs Up" to say "Thank You"--V

  • One JtextField and two kind of Fonts ???

    Hi, is there any way to have two kinds of Fonts in one filed JTextField komponent ?? I want to have prefix of string and suffix in two different colors.
    Thanks for any suggestions.
    Regards

    I'm not sure I understand this requirement.
    Is the text field for display only or are the prefix and suffix entered by the user? Since you are using a text field I assume the user inputs the text.
    If the user enters the text then how does the text field know which is the prefix and which is the suffix? Is the prefix always a fixed length. The way text components work is that each character typed inherits the attributes of the previous character.
    I see two approaches:
    a) Use a JTextPane. You can add a DocumentFilter to the AbstractDocument. As text is entered into the Document you assign the appropriate attribute to the text depending on its location in the document. Of course text panes supports multiple lines so you would need to create a custom Action to prevent the inputting of newlines. Read the JTextPane API and follow the link to the Swing tutorial. You will find a section on "Text Component Features" which explains more about DocumentFilters and you will also find an example of using attributes.
    b) The simpler approach is to use two text fields one for the prefix and one for the suffix. Assuming the prefix is a fixed length you can use the [Text Field Auto Tab|http://www.camick.com/java/blog.html?name=size-document-filter] to make inputting the text easier.

Maybe you are looking for