Show label text in front of image always

I have text in a label that I want to show over an image. Sometimes the text shows sometimes it is hidden by the image. Is there a way to force the text to show above the image? Thanks....

Or do this:
import java.awt.*;
import java.awt.geom.*;
import java.awt.image.*;
import java.io.*;
import java.net.*;
import javax.imageio.*;
import javax.swing.*;
public class X {
    public static void main(String[] args) throws IOException {
        BufferedImage image = ImageIO.read(new URL("http://today.java.net/jag/Image1-large.jpeg"));
        String title = "James Gosling";
        LabelIt(image, title, new Font("Lucida Sans", Font.PLAIN, 12));
        JFrame f = new JFrame(title);
        f.getContentPane().add(new JLabel(new ImageIcon(image)));
        f.pack();
        f.setLocationRelativeTo(null);
        f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        f.setVisible(true);
    public static void LabelIt(BufferedImage image, String text, Font font) {
        Graphics2D g = image.createGraphics();
        Rectangle2D bounds = font.getStringBounds(text, g.getFontRenderContext());
        float x = (float)(image.getWidth() - bounds.getWidth())/2;
        float y = (float)bounds.getHeight();
        g.setColor(Color.WHITE);
        g.setFont(font);
        g.drawString(text, x, y);
        g.dispose();
}

Similar Messages

  • Bring text to front of image

    how do i bring text to front of image using dream
    weaver?

    You would set the image as a background image- that would be
    a possible
    option. Please remember that the text will not stay static
    and will shift
    when a viewer resizes the text.
    You cannot lose until you give up !!!
    "berry05" <[email protected]> wrote in
    message
    news:fsk74t$d4r$[email protected]..
    > how do i bring text to front of image using dream
    weaver?

  • Centering Label Text over front Panel Indicator

    How can I get the Text in the Label of a Front Panel LED Indicator Control in LabVIEW 2009 to be centered over the LED?
    How can I change the Font an Font Size of the Text of a Label?

    Hi,
    Label to be center at the object.
    There are many Ways like
    1) what the JackDunaway has explained  Text Settings Toolbar button.
    2) Other you can dynamically change the property of label.
    Like you can change programmically change label justification, size, color, and many property.
    Just right click on object.Go to creat property node. refer screen shot for more help.
    Thank you.
    CLAD
    Labiew programmer
    Attachments:
    Lebel property.png ‏133 KB
    Lebel property.png ‏133 KB
    Lebel property.png ‏133 KB

  • When i go to new sms typing their is always show a text, how can solve this problem?

    when i go to new sms typing their is always show a text, how can solve this problem?

    Delete them and then download them from the desired Apple ID. This may require repurchasing paid applications.
    (95675)

  • I want to show labels having images one by one in Panel

    i want to show labels having images one by one in Panel through a while loop...
    I made an ImagIcon array.
    It doesn't work properly.
    It shows only first image while the variable is incrementing. :(
    This is my code...(Plz check it....)
    import java.awt.*;
    import javax.swing.*;
    public class test extends JFrame
    ImageIcon imgIco = new ImageIcon("mylogo.jpg");
    ImageIcon imgIco1 = new ImageIcon("mylogo1.jpg");
    ImageIcon imgIco2 = new ImageIcon("mylogo2.jpg");
    ImageIcon imgIco3 = new ImageIcon("mylogo3.gif");
    ImageIcon imgIco4 = new ImageIcon("mylogo4.gif");
    ImageIcon[] a = {imgIco,imgIco1,imgIco2,imgIco3,imgIco4};
    JButton b1 = new JButton("Add");          
    JLabel l1;
    JPanel p1 = new JPanel();
    public test(String title)
    super(title);
    int s = 0;
    while(s<=4)          
         try
              Thread.sleep(100);
              System.out.println(s);
              l1 = new JLabel(a[s]);
              repaint();
         /*if(s==1)
              p1.remove(l1);     
         catch(Exception e)
         System.out.println("Error Occured!!!");
         p1.add(l1);     
    System.out.println(s);
    s++;                              
         setContentPane(p1);          
    public static void main(String args[])     
         test t = new test("Title");
         t.setSize(900,470);
    t.setVisible(true);
    t.setResizable(false);

    You are sleeping the thread used to perform the repaint.
    Calling repaint only marks a component as needing painting, and AWT will paint it later. If you continue to loop in the mainthread then you will not see the changes.
    You have to move your loop to another thread.

  • How to show mandatory icon after the Label text?

    Hi ,
    I am using JDeveloper 11.1.1.4.
    My Scenario is I have  <af:inputtext>  with Property required="true".
    Label look like ,
    "*Name but I want to show like Name* .I want to show the * icon after the label text .
    How to achieve this in ADF ? ..
    Thanks ...

    Hi rfh,
    Thanks for the updates ,
    I tried with ,
    .AFRequiredIconStyle
      float:right;
    this CSS moving the * icon to right side but not after the label ,It's moveing infront of the InputText Value the output looks like,
    Label   *Value
    I tried with ,
    AFRequiredIcon:alias
        content:inhibit;
    It's diabled * icon entire application .This solution is ok ...But I want to diable * icon for only particular places.
    How to hide * icon for particular fields ? ......
    Thanks......

  • How to create a SelectItem with image before the label text?

    How to create SelectItems with image before the label text for selectMulitpleChoice, selectOneChoice, selectOrderShutltle, etc?

    you have to create a custom selectoechoice for this.. to have an image next to the seelct items..
    as mentioned above..
    http://www.oracle.com/technetwork/developer-tools/adf/learnmore/55-selectonechoicewithimages-170420.pdf

  • IPhoto 9.6 - slideshow to movie - text slides show only text and no image

    Made slideshow in iPhoto 9.6. Runs fine in slideshow mode on my iMac. However, when I export it to my desktop as a movie, slides that I inserted text via the text slide feature (bottom right of iPhoto) - black with the text only - lost the image. This happens on most of the text slides.  followed similar procedure before w/ no issues.

    Made slideshow in iPhoto 9.6. Runs fine in slideshow mode on my iMac. However, when I export it to my desktop as a movie, slides that I inserted text via the text slide feature (bottom right of iPhoto) - black with the text only - lost the image. This happens on most of the text slides.  followed similar procedure before w/ no issues.

  • Show text by clicking the image

    Hi,
    Is there any feature in adobe muse to show the text (slide up effect from footer) by clicking specified img?? This would give the animation and enrich my page. I could use JavaScript but....

    I haven't deduced a way to get exactly the behavior your looking for, but here's something that's close.
    I've taken a Composition widget and removed all but one trigger container / target container pair, and set the options as shown in the screenshot.
    The green trigger is shown mostly behind the red close box. In the "real" version I'd position the close box exactly on top of the trigger container.
    If you preview this in a browser, it slides in from the bottom when the trigger is clicked and fades out when the trigger (actually the close box at this point) is clicked a second time.
    With the options that are currently available in the widget, I don't think there's a way to get the slide out effect in combination with the other settings needed for this case, but someone else may have a creative way to achieve it.

  • How do I get the Label for a Front Panel Control to appear in the Block Diagram but not on the Front Panel?

    How do I get the Label for a Front Panel Control to appear in the Block Diagram but not on the Front Panel? On the Front Panel I am making a complex control that consists of a Slider and a Numerical Input box. Both Controls display the same information and either can be used for Input. When one changs, the other is made to display the same value.
     But I only want the Slider to display the Label on the Front Panel, to avoid confusion. On the Block Diagram however, I want both controls to display their Labels so that I know what they are. How do I display the Label for a Control on the Block diagram, but not display its Label on the Front Panel?

    No.  The Label Visible property is separate for the front panel control label and the block diagram terminal label.
    How did you start out with the block diagram's label not being visible?  Whenever I drop a control or indicator, the label is always visible on both the FP and BD by default.  Maybe there is a LabVIEW option that causes new controls/indicators not to have their labels visible by default, but I have yet to find it.  I don't think an item should ever be dropped without the label visible, good LabVIEW coding practice demands that the labels for control terminals on the block diagram be visible so that you know what control or indicator a wire is going to.
    That being said, I have seen a lot of VI's posted where the label for the terminal on the BD is not shown (against good programming practice.)  I've gone to the BD and right clicked to show the label.  Sometimes, the people have an empty label (which will turn off the visibility for both the FP and BD) and I'm forced to add some text of my own into the label so I can figure out what their code is doing.  When I add some text to the label, at that time, I find both the BD and FP labels become visible.
    Are you dealing with controls that have empty labels to start?
    Good programming practices:
    1.  Always have a name for all of your controls, never use and empty label by deleting the text in the label.
    2.  Make the labels unique.  For example, don't have two controls both called Stop.  How do you know quickly know which terminal relates to which control?
    3.  Always show the labels on the block diagram, so you know the function of a control's terminal.  If you want to hide the label on the FP, that's okay.
    4.  If you want a different label to appear on the FP than whatever you actually called the control, then use the caption.  You can hide the label and show the caption.  This is useful if you need to programmatically change what the "label" is on the front panel such if you are making an application that needs to change its user interface such as for a foreign language.

  • Why does my page loose formating when i add a text link on an image box?

    I wanted to make my own nav with texts links.  but i wanted to put the nav on an image like a black box.  when i add the text and then link them to pages they started to work when i previewed them in iweb.  But when i uploaded it to my ftp it messed up the formating on my page!  So I tried to add a new text box without a link on the same image... now it doesn't even show up.  What is the general rule of text on images? all i want to do is make a text nav on the image. Also i have made sure the image is sent back and the text to front.

    I don't know if you've fixed them since michaelfromrochester's suggestion but all of the links are white with green rollover for me now.
    If you haven't fixed them the clear your browser's cache (Command+Option+E for Safari) and reload the site.
    OT

  • Bug: Smart Collection/Label text/doesn't contain

    LR 2.1 & 2.2, 64-bit, Vista:
    Create a smart collection using "Label text"--"doesn't contain"--"xxx".
    The collection *shows* images with the "xxx" label text just as if the collection was created using "Label text"--"contains".
    Produceable 100% of the time.
    Any one else have the same problem?

    That is a bizarre bug.  There is an even simpler way to reproduce the problem: Have two pics, one with title "a" and the other with title "t".  The criterion "Title Contains a" correctly shows just the first picture, but the criterion "Title Contains t" shows both.
    Searching with smart collections and filters has numerous bugs, but this one is by far the most surprising.  As a geek programmer, I'd love to know what causes this!
    Adobe rarely reads this forum -- I suggest you post this in the official Adobe feedback forum, which Adobe does faithfully read (but only infrequently responds).

  • Iphone 4s Running Ios(7.1) Camera Focus Not Working Like Text On book It Showed Blurey Text & My Friend Also Same Modle His Camera Focus Perfectly..Is Is Possible To Fix It...Thnx Every 1

    Iphone 4s Running Ios(7.1) Camera Focus Not Working Like Text On book It Showed Blurey Text & My Friend Also Same Modle His Camera Focus Perfectly..Is Is Possible To Fix It...Thnx Every 1

    Hello SajidChaudhary,
    Thanks for using Apple Support Communities.
    For more information, take a look at:
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/ts2802
    Camera isn't functioning or has undesired image quality
    If the screen shows a closed lens or black image, force quit the Camera app.
    If you do not see the Camera app on the Home screen, try searching for it in Spotlight. If the camera does not show up in the search, check to make sure that Restrictions are not turned on by tappingSettings > General > Restrictions.
    Ensure the camera lens is clean and free from any obstructions. Use a microfiber polishing cloth to clean the lens.
    Cases can interfere with the camera and the flash. Try gently cleaning the lens with a clean dry cloth or removing the case if you see image or color-quality issues with photos.
    Try turning iPhone off and then back on.
    Tap to focus the camera on the subject. The image may pulse or briefly go in and out of focus as it adjusts.
    Try to remain steady while focusing:
    Still images: Remain steady while taking the picture. If you move too far in any direction, the camera automatically refocuses to the center.
    Note: If you take a picture with iPhone turned sideways, it is automatically saved in landscape orientation.
    Video: Adjust focus before you begin recording. You can also tap to readjust focus while recording. Exiting the Camera application while recording will stop recording and will save the video to the Camera Roll.
    Note: Video-recording features are not available on original iPhone or iPhone 3G.
    If your iPhone has a front and rear camera, try switching between them to verify if the issue persists on both.
    Have a nice day,
    Mario

  • How can I show only text edits and not text formatting when using print comments summary?

    Acrobat 9.3.0 for Mac.
    Here is the scenario: I used the Compare command to see the changes between 2 PDFs. The resulting file some edits are inserts and some are deletions. I want to print a comments summary only showing the text edits. In the Compare Option pane, I select Text and deselect Images, Annotations, Formatting, Headers/Footers, and Backgrounds. Now on the screen I see inserts are highlighted in blue and deletions are marked with sort of a caret and vertical bar symbol. So all looks good at this point. However, when I show the Comments List, I see addtional comments that indicate "Replace - The following text attributes were changed: fill color." Those comments do not appear in the page view unless I check the Formatting check box to show them. With Formatting unchecked, I print a comments summary and all of the "Replace - Fill Color" comments" appear on the resulting comments summary.
    I only want to show text edits, not text formatting changes. So questions are:
    1. Why, when the Formatting checkbox is unchecked, do the text formatting comments still appear in the comments list when they do not appear on the page display.
    2. How can I print only the text content edits and not show the text formatting changes when using Print Comments Summary.

    Hi,
    You can set ExecuteWithParams as default activity in the task flow then method activity to return total no of rows passing to Router activity if your method has value 0 then call Create insert operation else do directly to page.
    Following idea could be your task flow
    Execute With param (default) > SetCurrentRowWithKey > GetTotalNoOfRows (VOImpl Method)
    |
    v
    Router
    1. If pageFlowScope outcome is 0 then call CreateInsert > MyPage
    2. if pageFlowScope outcome > 0 then MyPage
    hope it helps,
    Zeeshan

  • Advanced actions - trying to show a text caption

    I have a slide with 5 text captions made from smart shapes, and 5 click boxes. All 5 smart shapes are hidden. I have 5 variables, all of which are set to zero. When a click box is clicked on, the corresponding smart shape shows and the value of the first user variable is set to one. When another click box is clicked on the corresponding smart shape shows and the next user variable is set to 1. Each of the click boxes is set up in a similar fashion. I set up 5 advanced actions, and the On Success action for each of the click boxes uses one of 5 advanced actions. The action for each click box looks something like this (I'm using generic names for this example):
    IF variable1 is equal to 0
    ACTIONS
    Show textCaption1
    Assign variable1 with 1
    Play Audio sound.wav
    Continue
    This is working fine, and the corresponding smart shapes are showing as they should when each of the click boxes is clicked on.
    But I have an additional feedback text caption that I want to show after all 5 smart shapes are showing. I tried setting up an advanced action that looks like this:
    IF
    variable1 is equal to 1 AND
    variable2 is equal to 1 AND
    variable3 is equal to 1 AND
    variable4 is equal to 1 AND
    variable5 is equal to 1
    ACTIONS
    Show feedbackTextCaption
    But even after all of the click boxes have been clicked (which should set each of the 5 variables to 1), the feedback text caption does not show.
    Can anyone help with a suggestion?

    @Sreekanth, that is not the correct approach, because a user could click 5 times on the same click box and see the final text caption. Only when you disable an already clicked interactive object this can be used. Jay was right by choosing five different variables.
    @Jay How do you trigger that last conditional action? Which event do you use? You explain that the first described action is triggered by the click box, but not what is triggering the conditional action.
    I suspect you'll have to combine both actions, and assign them to each click box. That means a conditional action with two decisions:
    First decision 'Always' needs the condition 'IF 1 is equal to 1' to create a mimicked standard action, and has to show the text caption, to assign 1 to the variable and to play the audio. I don't know why you added 'Continue'? If the click boxes pause all at the same moment, don't add Continue, let the playhead remain at the same location.
    Second decision 'Checker' is the conditional action that you wrote, checking the values of the 5 variables, and if they have all the value 1 to show the feedback text.

Maybe you are looking for

  • Align MM and FI Document Numbers in Logistics Invoice Verification

    Hi All, Need help! Requirement : Align MM and FI Document Numbers in Logistics Invoice Verification Followed all the steps as per the SAP documentation : Materials Management > Logistics Invoice Verification > Incoming Invoice > Number Assignment > M

  • Radio buttons and PHP

    I am having a problem getting radio button data into php and I can not seem to find any answers. My project is simple I have a group of radio buttons, when one is selected and a submit button is pressed I want the data from the radio button to popula

  • IPhoto 11 retouch tool: grab not working

    Using iPhoto's retouch tool, I want to grab some pixels from one area and put them into another.  Apple support instructions say: ...you can "grab" pixels from another part of the photo and apply them to the blemish.                              Pres

  • GR for imported items

    Hi, How to make make GR for imported items? Is it the same process as it is done in MIGO for domestic consignments or it does have some other aspects also?? Regards,

  • OGG help for two simultaneous inserts

    Hi all, i am working on bi-directional golden gate active-active environment, i was successful in designing it and also i was successful in using some strategy to find out if any two updates happens cancel old one. I was also trying if any kind of sa