Unable to change the text of a JLabel

hi!
i have created a JLabel and add it to my frame. Now, when the user clicks the button on the frame, i changed the test of the label and after that some really heavy processing takes place. and till that processing completes, the changed text does not get display. is it because that the repaint has very low priority? my requirement is that the text shuld get updated immediately.
Any ideas?
regards
Deepak Saini

I usually suggest to use:
component.paintImmediately(component.getVisibleRect());
Wondering what the difference between 'paintImmediately()' and 'update()' was, I created a simple test program. The program simply changed the text in a JTextField 1000 times.
Here is what I found:
1) paintImmediately was 10-20% faster
2) paintImmediately produced no flicker
I changed my program to use a JLabel instead of a JTextField and found:
1) update() did not work
Here is my sample program in case you are interested.
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;
import javax.swing.text.*;
public class StatusBar extends JFrame
     JTextField statusBar;
public StatusBar()
JPanel panel = new JPanel();
panel.setLayout( new BorderLayout() );
     setContentPane( panel );
          JButton button = new JButton( "Connect..." );
          panel.add( button, BorderLayout.NORTH );
          button.addActionListener( new ActionListener()
               public void actionPerformed(ActionEvent e)
     long t1 = System.currentTimeMillis();
                    for (int i = 0; i < 1000; i++)
                         statusBar.setText( "label " + i );
//                         statusBar.paintImmediately(statusBar.getVisibleRect());
                         statusBar.update(statusBar.getGraphics());
                    System.out.println( (System.currentTimeMillis() - t1) );
          statusBar = new JTextField("No Connection");
          panel.add( statusBar, BorderLayout.SOUTH );
public static void main(String[] args)
StatusBar frame = new StatusBar();
frame.setDefaultCloseOperation( EXIT_ON_CLOSE );
frame.pack();
frame.setVisible(true);

Similar Messages

  • I am unable to change the color of text in an email I replay to or compose. I am on 31.6.0 release of Thunderbird.

    When I receive, reply or compose email. I no longer am able to see or change the color of text. I select to change the text from black to Red (or any other color) and the text just stays black, The color seletor box will show the last select color, but never actually changes the text color in an email. Also in received email, when the sender has indicated their replies to me are in another color, All the text only appears as black. I never had this problem in the past, not sure what has happened. I did restart Thunderbird with add-ons disabled and this did not change the problem.

    Hello, maybe the question need to move by a moderator to thunderbird support ?
    https://support.mozilla.org/en-US/questions/thunderbird?owner=all
    thank you
    [moderator note: question thread has been moved from Firefox queue to Thunderbird queue]

  • Unable to change group text name or add person to some group texts in iOS 8

    I really like the ability to change group text names as it helps me separate work group texts from personal especially when I have coworkers that have separate business phones. I'm unable to change the name of some group texts as the option is not there when I go into details. I'm also unable to add contact to the same group texts that I'm unable to change the name on. Is this a glitch or am I missing something?

    Hi CaliWingsFan,
    If you are having issues with renaming and adding users to group texts, you may want to try some things to troubleshoot.
    First, quit all running applications and test again -
    iOS: Force an app to close
    Next, I would try restarting the iPhone -
    Turn your iOS device off and on (restart) and reset
    If the issue is still present, you may want to restore the iPhone as a new device -
    iOS: How to back up your data and set up your device as a new device
    Thanks for using Apple Support Communities.
    Best,
    Brett L 

  • How to dynamically change the text of a TextObject with embedded DataField?

    Hi
    I'm trying to dynamically change the text of a TextObject at runtime, by using the .NET library. My problem is that if one or more DatabaseFieldDefinition is embedded inside my text, I'm unable to change the "static text" only, by keeping the field, e.g. I have :
    Text1 => "Contact Name: {Contact.Name}"
    and I'd like to change it to anything else like:
    Text1 => "Nom du Contact: {Contact.Name}"
    Half of my TextObject is static text while second part comes from the dataset.
    (of course the translation is dynamic - it is called at run-time and the new value to be set depends on the calling application language)
    If I simply modify the Text property of my TextObject, the {Contact.Name} embedded field is not evaluated anymore by the Crystal Engine, but considered as a single text.
    Using formulas or parameters looks quite difficult, because it means having many ones just for translation needs - I cannot control the way my users will create their reports and "force them" to use complex methods just in order to put a text and a value together...
    Anyone knows how to deal with that ?

    Only way I can think of doing this:
    1) Create a formula (call it lang) and enter the string "Contact Name" in it
    2) Place the  {Contact.Name} field next to the string
    3) So now you have:
    ContactName:  {Contact.Name}
    4) Check what localization you are after. If you need "Nom du Contact", change the lang formula so it shows "Nom du Contact" using the code below:
    Imports CrystalDecisions.CrystalReports.Engine
    Imports CrystalDecisions.Shared
    Public Class Form1
    Inherits System.Windows.Forms.Form
    Dim Report As New CrystalReport1()
    Dim FormulaFields As FormulaFieldDefinitions
    Dim FormulaField As FormulaFieldDefinition
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    FormulaFields = Report.DataDefinition.FormulaFields
    FormulaField = FormulaFields.Item(0)
    FormulaField.Text = "[formula text]"
    CrystalReportViewer1.ReportSource = Report
    End Sub
    I realize this may not give you consistent spacing as the translations may have strings of differnt length. Perhaps someone has other idea(s)...

  • How do I change the text color in a call out box?

    How do I change the text color in a call out box?

    See http://help.adobe.com/en_US/acrobat/X/standard/using/WS58a04a822e3e50102bd615109794195ff-7 e5a.w.html
    Also http://helpx.adobe.com/acrobat/kb/unable-edit-properties-text-box.html

  • How cna I change the text and background colours in iTunes?

    Can anyone tell me how I can change the text and background colours in iTunes? I am a visually impared user and my main requirement on a PC is to change the colour schemem to white text on a black background. Most software adopts the settings of your colour scheme but iTunes goes it's own and has everything on white backgrounds. I cannot read from white backgrounds (dazzle - that sort of thing). I have never used iTunes for this reason. I have always been a devotee of by far the best media player out there Musicmatch Jukebox, who allow you to edit skins in every detail. However, recently Musicmatch was taken over and users were forced to migrate to the ridiculously poor Yahoo Music Jukebox. A massive downgrade in so many ways.
    I want to use iTunes but will not be able to if I cannot sort this issue out. I downloaded 7.5 before discovering that if you want to use Multi Plugin for skins you need to go back to iTunes 7.02. I've done that, but the skins available are completely pointless to my eyes. They don't change the colours of the main components, just the graphical bit at the top.
    What I need to do is change the background of the main browser windows so that they are black and the text is white (you know the track lists and tree views, etc). This must be a very simple case of just changing the codes somewhere, but I can't find where. I read somewhere that you need to hack into something call ResourceDB inside a file called iTunes.jar. There is no such file on my PC. Could that be a Mac thing?
    Please help someone if you can. I would like to become an iTunes user. There seems to be more music available than on Napster which I currently use.
    Thanks in advance
    Z

    In my opinion, it seems that Apple has decided to sacrifice usability so that iTunes would look more like a Mac application. You are probably already aware that using Windows' built-in high-contrast settings do not work in iTunes.
    I did some hacking at the resource file a while back, but I was unable to figure out how to change the color of the background. IIRC there was a resource whose description indicated it would change the background color, but when I changed the resource, nothing happened.
    I was, however, able to figure out how to make the "large" font much larger (any size you want, I suppose). Will that help? See
    http://home.comcast.net/~teridon73/ituneshacks/index.html
    You should provide feedback to Apple:
    http://www.apple.com/feedback/
    I don't think it is too harsh to call it "shameful" that Apple has chosen this design path. Where I work, we are required to make ALL applications (or any computer interface, such as a website) section 508 compliant. Of course, I'm being a bit of a hypocrite, because I've made no effort to make my website compliant. If you have trouble reading it, please let me know.

  • How can I change the text from impossible to read blue to black

    Unlike Chrome, which has an ad-on that changes the text to black, I have so far been unable to find a way to change Firefox's terrible light blue text to black, despite having made many attempts through Tools, Option, Colors, etc. Help will be appreciated. I am using version 30 on an HP Laptop running Win7

    Can you attach a screenshot?
    *http://en.wikipedia.org/wiki/Screenshot
    *https://support.mozilla.org/kb/how-do-i-create-screenshot-my-problem
    Use a compressed image type like PNG or JPG to save the screenshot.
    Make sure that you haven't enabled a High Contrast theme in the Windows/Mac Accessibility settings.
    Make sure that you allow pages to choose their own colors and check the default colors.
    *Tools > Options > Content Fonts & Colors > Colors [X] "Allow pages to choose their own colors, instead of my selections above"
    Note that these settings affect background images.
    See also:
    *http://kb.mozillazine.org/Website_colors_are_wrong

  • How to change the text in the legend of a graph programmat​ically in labview

    I have many graphs in one plot and want to show the legend the name of the graph (i.e. the filename). How do I change the text in the legend programmatically?

    Create a property node for your graph. Use the property node "Active Plot" to define which plot (or line) you want to rename. Then write the new legend label to the property node "Plot.Name". See attached.
    Tim
    Attachments:
    legend.vi ‏12 KB

  • Unable to change the data in PSA

    Hello All,
    I have a delta failure because of invalid characters in one of the field and now i wanted to change the PSA. I have deleted the request from all data targets and started changing the error record, it is not showing all columns from PSA hence i am unable to change the data in required field.
    Could you please let me know how will i see all columns from PSA. Thanks
    Regards,Ashok

    Hi Ashok,
    To increase/decrease the number of columns that are displayed on the menu from the Settings option select Change display variants
    Also if you want to see say all the failed records you can sort the order of the data using the Status column

  • Unable to change the data source of SAP system

    Dear all,
    We have install SAP netweaver EHP1 standalone java on oracle 10.2.0.5 on windows 2008 R2.
    while installation i have given the central SLD system as solman,
    By mistake i have deleted the system from SMSY.. now when i createed the system manually i am unable to change the data resource as SLD due to this i can start my SMD configuration
    Request please let me know how to resolve this issue.
    Thanks
    Paresh

    Hi Paresh,
    You can proceed with deleting your SAP system from SMSY (along with connected technical content such as AS Java definition) and the run the LANDSCAPE FETCH through transaction SMSY_SETUP to have the correct definition of your SAP system in SMSY.
    Following this, you could use the addon Landscape Verification (a new thing I learnt today!!!)  to check the correctness of transaction SMSY. The following link details the Landscape verification 1.0 for SolMan:
    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/e093b3ce-c034-2d10-01bc-b51f1691d3da?quicklink=index&overridelayout=true
    Hope this helps sort out your issue.

  • How do I change the text on a label for a SAP delivered WD view

    Hi,
    I need to change the text that is being displayed for a label in a SAP delivered WD ABAP View. When I look at the properties for this label, the Text property is currently empty, so I assume that the text that is being displayed in the view is coming from the dictionary. I was hoping to change the text of the label via the Enhancement Framework. I created an OTR entry, then went into SE80 for the WD Component, I navigated to the view in question, I pressed the Enhance button and entered $OTR:<package>/<alias name> in the text property for the label. Finally I saved and activated and was prompted to create an Enhancement Implementation, which I did and I selected it. Everything seems to be fine (no errors or warnings). I then ran the WD application. My change was not there. I then went back into SE80 for the WD Component that I created the enhancement. I navigated to the View and looked in the text property of the label and saw that my change was not there. I repeated this process several times and each time when I added the OTR entry to the text property of the label, it saves and activates without issue (in enhancement mode), but when I run the WD App the change does not show up and when I go back to the WD View, my change to the text property is gone. I know that if I really wanted to I could register the object and add the OTR entry to the text attribute of the label, but I am trying to perform this change using a modification free enhancement. Can this be done via an Enhancement, or do I have to register the object and make my change using a modification?

    Hi Gregg,
    excellent question. I had the same problem as well before.
    What I have learned is that you cannot change a UI Element via Enhancements.
    You can add new UI Elements (e.g. new label) or remove existing elements, but you cannot change them (except the layout properties (e.g. colspan) maybe).
    The only possibilities I see is
    1. Remove the existing label, and add a new label with your desired text
    2. Do it as a modification
    3. Do it as a configuration (This means you go to the webdynpro application in SE80, right click and select "Create/Change Configuration)
    4. Do it as customizing (This means you add the URL parameter sap-config-mode=X to the URL, navigate to the label, right click on it, and select "Change Settings for Current Configuration").
    The disadvatages of 3) and 4) are
    - texts in configurations and customizing are not translatable (as far as I know)
    - if you have multiple configurations, you have to change the label multiple times
    Hope this helps a bit,
    Daniel

  • How do I change the text color of footers on select pages? (InDesign CS6)

    Good afternoon,
    Months ago, I worked with a graphic designer to put together a 100-page workbook for my training company. He turned all of the files over to me and I'd like to make a small change before we print another run for a new client. Specifically, I'm having trouble changing the text color on select pages. Since a picture says 1,000 words, let me give you an example:
    As you can see, the copyright information on the right side of the page is difficult to read here when placed over the photo (you may have to look closely, but it's along the guy's sleeve). What I'd love to do is change that part of the footer (not the left, page number side) to white text. This would make it quite a bit easier to read. There's a number of other pages in the book that I want to make this change to. I'm not sure why I never noticed it or mentioned it to the designer. I suppose I've become more discerning since then.
    Let me tell you what I've tried to do:
    I learned how to override master pages by CTRL+SHIFT clicking on the footer. However, this has not worked for me. It allows me to change the page number part, but not the copyright side. Additionally, sometimes when I override the master the formatting of the footer goes goofy. For instance, the left side and right side come together and end up in the middle of the page I'm working on.
    I'm looking for a quick way to go through and make the footers easier to read on pages where they are backed by a photo. Hoping you can help me. Please let me know if you need any other information.
    Best,
    Taylor

    I think you should have left it as it was. It seems like what you had was single pages flowing as spreads within InDesign. Like below. That is the correct way, and when you changed it to all single, it did create your footer problems.
    Will you be sending the file as a PDF to your online printer? If so, then leaving the InDesign file set as below is fine. The PDF output will separate the pages.
    All you have to do is make sure that Pages, not Spreads, is chosen when you output the PDF

  • I have the 2.5GHz i5 macbook pro that came out in june of 2012, i updated to OSX version 10.8.1 and now i am unable to change the 3.5mm headphone output into an input.

    i have the 2.5GHz i5 macbook pro that came out in june of 2012, i updated to OSX version 10.8.1 and now i am unable to change the 3.5mm headphone output into an input.

    i have the 2.5GHz i5 macbook pro that came out in june of 2012, i updated to OSX version 10.8.1 and now i am unable to change the 3.5mm headphone output into an input.

  • I changed my Apple ID for an iphone 4s and need to change the iCloud Apple ID/password.  I am unable to change the Apple ID under the iCloud account information without the password which no longer exists.  How can I update my phone?

    I had to change the Apple ID used for my iphone 4s.  How do I change the Apple ID for the iCloud information? - the old Apple ID/password no longer exists and this information is requested to make a change.  I am unable to change the Apple ID for the iCloud account.

    Apple IDs never go away, so it still exists.
    But lets be clear. You actually stopped using an Apple ID and created a NEW Apple ID. You didn't just change the email address of your Apple ID? That means that all of the music and apps purchased with the old Apple ID will have to be purchased again.
    If you really did create a new Apple ID you will need the password associated with the old one to disable Activation Lock. There is no way around this. As I said, the old one still exists. You can use the standard tools to recover the password at https://appleid.apple.com.

  • Is there a way of just changing the text to the main menu..but not the submenus?

    Is there a way of just changing the text to the main
    menu..but not the submenus?
    Also i have looked at in the browser and when i glide over
    the menu catergories or click on them they dont show the
    submenu...what can i do to solve this?

    Does the example described at
    http://labs.adobe.com/technologies/spry/articles/menu_bar/index.html
    work for you?
    What are you doing that's different from the example?
    When you say you just want to change the text of the main
    menu without changing the submenus, do you mean you want to do so
    dynamically, at some later stage after the page has loaded?
    If so, you could try retrieving the main menu elements you
    want to update from the DOM and updating them from your script's
    event handler for whatever event it is that you want to update them
    in response to. This presumes the widget will detect this and
    update appropriately, which I can't say for sure since I haven't
    actually tried it.
    Hope that helps!
    Rob

Maybe you are looking for