Component painted three times

Hello
I have an AWT application containing a frame F1. This frame contains combos and buttons,
and another frame F2. Inside this frame F2, I have a TableBean component (GNU table for
AWT). When I show (only first time) frame F1, table component is painted three times. How can I
to dectect this component is already painted?. I don�t know how to use paint() or update().
Many thanks for your help.
tablaDatosListadoComercio = new tstuder.java.lib.component.table.Table(colDefs,linesComercio);
tablaDatosListadoComercio.getTitlebar().setBackground(java.awt.Color.blue);
tablaDatosListadoComercio.getTitlebar().setForeground(java.awt.Color.white);
tablaDatosListadoComercio.setSelectionMode(tstuder.java.lib.component.table.DataArea.SELECT_ONE);
tablaDatosListadoComercio.setHorizontalScrollMode(tstuder.java.lib.component.table.Table.HORIZONTAL_SCROLLBAR_OFF);
panelTablaLstComercio.add(tablaDatosListadoComercio);
((java.awt.CardLayout)getLayout()).show(this,"panelDatosListadoComercio");

I was talking with a co-worker about this kind of issue just yesterday - this isn't a simple problem at all.
Basically, you (the application programmer) don't have a lot of control over how many times your paint method is called. The Toolkit (AWT) is responsible for deciding when a component's paint method is called. You, as the application programmer, can hint to AWT that a component needs repainting by calling repaint.
Do not call paint yourself - AWT will call your paint method whenever it decides it wants to. It has in its own mind the state of everything, and which component needs to be repainted when. Controlling multiple repaints is a difficult problem for any GUI toolkit.
So here's a bit of theory which will hopefully enlighten, rather than confuse, you.
What you're doing when building an application is creating a bunch of objects that are meant to play together. The rules of the object behaviors are defined by the AWT (and Swing) Component classes. GUI applications are driven by the dispatch of events to them by the underlying system (in this case, Java, AWT and Swing). The bulk of the code being executed to do a GUI application is the underlying system (Java, AWT and Swing) since it's that underlying system that provides the basic framework for the application to exist in the first place.
- David

Similar Messages

  • Method called three times on page loading

    I have a page with panelTabbed and several showDetailItems. On the first showDetailItem I have ADF Query component with the results table.
    I want the second showDetailItem to be enabled or disabled depending on whether there is a selected row in the results table or not.
    I have second showDetailItem's Disabled property set to an EL expression referring to a method in a backing bean.
    This method is called three times during initial page loading. I suspected that it was caused by some partialTriggers, but without any partialTriggers
    ADF behave the same way.
    Moreover, first two times there is a selected row in an iterator. Only the third time there's no selected row (empty initial state of the results table).
    And if this method returns false (not disabled) first two times and true (disabled) third time only, the second showDetailItem is enabled after page is loaded.
    What is responsible for these redundant calls of the method?

    Studio Edition Version 11.1.2.0.0
    Build JDEVADF_11.1.2.0.0_GENERIC_110531.1615.6017

  • Component paint problem:

    Hi everybody,
    I have just started playing with the Swing library
    recently, and I am experimenting with writing my
    own little customized component--a mini shape
    editor. There is one problem I am encountering.
    The circles that get re-drawn after a re-sizing
    of the window are crooked! However, when the
    circles were initially drawn to the compnent,
    they looked quite smooth. The only difference
    was that the circles were initially rendered
    via the graphics object that was obtained using
    the getGraphics() of the JComponent. I tried
    to force the paint method to use the graphics
    object returned from getGraphics(), but it
    does not rendered! Does anybody know what is
    the difference between these two graphics objects
    --the one returned from getGraphics() and the
    one passed into paint() by the system?
    Why am I getting the crooked line when the
    rendering is done via the paint graphics object?
    Thank you for your time in answering my question.
    --Chris

    Hi Richard,
    Thanks for your comments. As you suggested, I am
    posting some of my experimental code for discussion.
    Here is my derived class from JComponent:
    package SymbolEditorStuffs;
    import javax.swing.JComponent;
    import java.awt.*;
    import java.awt.event.*;
    import java.awt.Graphics;
    public class SymbolEditorWidget extends JComponent {
    * Constructor for SymbolEditorWidget.
    public SymbolEditorWidget() {
    super();
    canvas = new Canvas(this);     
    // Register mouse listeners to detect mouse
    // events.
    addMouseMotionListener(
    new SymbolEditorMouseMotionAdopter());
    addMouseListener(
    new SymbolEditorMouseAdopter());
    public void toolChanged(String toolName) {
    canvas.toolChanged(toolName);
    public Graphics getWidgetGraphics() {
    // Return this component's graphics object.
    return super.getGraphics();
    protected void paintComponent(Graphics graphics) {
    // Let the base class paints the component first.
    super.paintComponent(graphics);
    // Then the canvas handles the customized
    // component painting.
    canvas.paintCanvas(graphics);
    protected class SymbolEditorMouseMotionAdopter
    extends MouseMotionAdapter {
    public SymbolEditorMouseMotionAdopter() {
    super();
    public void mouseDragged(
    MouseEvent mouseEvent) {
    // Canvas handles mouse drag event.
    canvas.mouseDragged(mouseEvent);
    protected class SymbolEditorMouseAdopter
    extends MouseAdapter {
    public SymbolEditorMouseAdopter() {
    super();
    public void mousePressed(
    MousEvent mouseEvent) {
    // Canvas handles mouse presse events.
    canvas.mousePressed(mouseEvent);     
    public void mouseReleased(
    MouseEvent mouseEvent) {
    // Canvas handles mouse released events.
    canvas.mouseReleased(mouseEvent);     
    public void mouseClicked(
    MouseEvent mouseEvent) {
    // Canvas handles mouse clicked events.
    canvas.mouseClicked(mouseEvent);
    private Canvas canvas;
    As you correctly pointed out, the code for my repaint
    should be situated in the paintComponent(..., which
    I have overriden with my version. I suspect the base
    class' version of this function does something significant;
    therefore, I made a call to the base class version as
    well.
    The mouse events are what I use to manipulate the
    shapes with. Therefore, a shape that has been manipulated via the mouse must re-draw itself.
    Since the MouseEvent class comes with a function
    to access the component that received the mouse
    events, I am able to get hold of the graphics object
    of that component via the getGraphics(... It is
    with this graphics object that I use to redraw the
    manipulated shape.
    However, it is not true that I have two sets of code
    that redraw a shape. All shapes inherit from an
    interface that has a draw(...:
    interface Shape {
    public void draw(Graphics graphics);
    public void undraw(Graphics graphics);
    etc.
    class CircleShape implements Shape {
    public void draw(Graphics graphics) {
    // Draws the circle at the right location.
    etc.
    etc.
    Utimately, all draws for a shape are funnelled into
    this function. The only difference is where the
    graphics object came from. In the paint case,
    the graphics object was handed to me via the
    system. In all other cases, I have gotten hold of
    the graphics object via the getGraphics(,,,
    What struck me as odd was that when I manipalated
    a circle with the mouse, which caused a redraw of
    the circle via the graphics that I obtained through the getGraphcs(..., and then I resided the window, the
    same circle was NOT rendered as around as before
    the resize of the window. Since I called the
    drawOval(... at precisely the same location in both
    times, I expect the circle to be rendered with exactly
    the same roundness. This should be true because
    the drawOval(... is applying the same algorithm to
    render the circle in both cases. The fact that they are
    not the same roundness is the mystery that I cannot
    explain! What I expected was that both rendering
    should have produced the exact same circle! But
    they did not--one is of lower roundness quality than
    the other!!
    --Chris                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Remove the extensions, redownload Safari, reload the extensions.
    http://www.apple.com/safari/download/
    And if you really want a better experience, use Firefox, tons more choices and possibilities there.
    Firefox's "NoScript" will block the Trojan going around on websites. Best web security you can get.
    https://addons.mozilla.org/en-US/firefox/addon/noscript/
    Ghostery, Ad Block Plus and thousands of add-ons more have originated on Firefox.

  • When I download Itunes my computer tells me there was and error in the download and I have to downlooad again.  I have tried three times.  My computer in brand new. So what could the problem be

    When I download itunes my computer tells me there was an error in the download and I need to re-download.  It tried three times to re-download and got the same error.  Any help for this?  My computer is brand new.

    Go START/ALL PROGRAMS/APPLE SOFTWARE UPDATE"
    If it offers you a newer version of Apple Software Update, do it but "Deselect" any other software offered at the same time.
    Once done, try another iTunes download

  • HT204088 Why am I being charged three times for an game that I purchased? Plus, there is nothing in your website to address this problem. It makes me feel like this company is just trying to steal my money if I do not look or question my billing account.

    How do I get extra charges credited back to my account? I was over charged three times on an app I bought.

    So any time any company accidentally charges you 2-3 times, they are trying to steal your money? In most cases, they fix it on their own after they catch it. If you want to make them aware of the issue, contact iTunes Support: http://apple.com/support/itunes/contact/

  • I have tried to download Photoshop Elements 10 three times now and it has crashed every time???

    I have tried to download Photoshop Elements 10 three times now and it has crashed every time.  I checked my settings and the format on my computer is Max OS Extended.  I read that 3 other people were having the same problem.  Did anyone figure out how to fix this or does Photoshop Elements not run on Mac OS X?
    Exit Code: 7
    -------------------------------------- Summary --------------------------------------
    - 0 fatal error(s), 9 error(s), 8 warning(s)
    WARNING: DS013: Payload {0175676F-8C92-49F2-9131-D0D6AD654B41} AdobeHelp 3.4.0.0 is already installed and the session payload {EB3A47AA-B4E2-4857-A69C-92A6E097F24C} AdobeHelp 3.5.0.0 has no upgrade/conflict relationship with it.
    ERROR: DS013: Verifying payload integrity : Failed with code 1
    WARNING: DW034: Warning: {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 will not be repaired, due to updated patch of the payload and one of the top level payload is being installed.
    WARNING: DW034: Warning: {3F023875-4A52-4605-9DB6-A88D4A813E8D} Camera Profiles Installer 6.0.0.0 will not be repaired, due to updated patch of the payload and one of the top level payload is being installed.
    ----------- Payload: {68FE2517-2E45-4B03-8241-D0634F43878B} Smartsound1 1.0.0.0 -----------
    ERROR: DW006: Apple Package failed to install successfully.
    WARNING: DW036: Payload cannot be installed due to dependent operation failure
    WARNING: DW036: Payload cannot be installed due to dependent operation failure
    WARNING: DW036: Payload cannot be installed due to dependent operation failure
    WARNING: DW036: Payload cannot be installed due to dependent operation failure
    WARNING: DW036: Payload cannot be installed due to dependent operation failure
    ERROR: DW050: The following payload errors were found during install:
    ERROR: DW050:  - Smartsound3: Install failed
    ERROR: DW050:  - Photoshop Camera Raw for Elements 10: Install failed
    ERROR: DW050:  - Smartsound1: Install failed
    ERROR: DW050:  - Adobe Premiere Elements 10: Failed due to Language Pack installation failure
    ERROR: DW050:  - Adobe Premiere Elements 10_LangPacken_US: Install failed
    ERROR: DW050:  - Smartsound2: Install failed

    Sfasolo it appears you are installing Photoshop Elements as opposed to downloading Photoshop Elements.  For the error you have described I would recommend reviewing Updated installation instructions | Premiere Elements 10 | Mac OS - http://helpx.adobe.com/premiere-elements/kb/updated-installation-instructions-premiere-ele ments.html.

  • TS1702 I am having a major problem with a Z2 app. I have written to the three times and received no response. Is there somewhere to report this and at least get my money back?

    When Z2 did their first 5. Update, a message popped up saying you had to do the update. After doing so, another pop-up said to remove and reload the game. In doing so, all my progress/ purchases disappeared. I only updated on my iPad, not my iPhone, so the iPhone app is till on the "you have to install the update to play" status. I've written to Z2 three times with no response. I would at least expect a refund of the $ I have spent on the game.

    You bought an app but it did not work properly on your device. You can easily report problems with your iTunes Store purchases via the iTunes Store. Here is how:
    Launch iTunes > Choose Store > Sign in.
    Store > View My Account > Purchase History then Click the Report a Problem button.
    Fill out the form explaining the problem you are having.
    Submit the problem report and wait for a response from Apple, they usually respond within 24 hours.
    Notes:
    When Apple emails your invoice, there will be a link on the invoice. You may also click the “Report Problem” link next to the app that you are having issues with to report your problems.
    Problems with in-app purchases or free apps, report them here:http://www.apple.com/support/itunes/ww/
    Before reporting your issue, make sure that you followed these troubleshooting steps explained here.
    <Link Edited by Host>

  • How can I make my Apple ID security? It has been hacked three times in a week!

    Just in a week, I found my apple id(this id) has been hacked for three times!
    When I was trying to login in to the ITunes Connect, it returned following error,
        Your Apple ID or password was entered incorrectly.
    I'm sure I entered the password correctly that I checked it many times and it's never happens before. So every time it happens, I use the forget password tool to reset the password. Just in a week, the incorrect password occurred 3 TIMES and I have reseted my password 3 TIMES to get control back.
    I'm a developer so first time it happens I did aware of there might be hacker. So I cleared all password cache in my machine, scan virus and reset the password of Apple ID and my mailbox in a more complex letters.
    However, ever I did so, my password still goes wrong and the error happens again and again.
    And one thing I can't understand in this story is,
         - Every time I reset my password I got an email notification, it always works, during my 3 resets.
         - When my password is hacked (I can just assume it's a hack), there's no email notification. I can almost sure the email is not deleted, because no matter how fast it's delete, my mobile should receive a popup anyway.
    Now I have tried everything I can but my account is still not safe. I want report this issue to Apple that they can figure out the problem, to avoid a bigger security disaster. But I could not find a contact from apple for this problem, I sent a mail [email protected] but no reply. It's so terrible...
    So i ask for help in this forum, I'd appreciate if anybody can help either security suggestion to me or help find the contact of apple.

    account disabled for security reasons: http://support.apple.com/en-us/TS2446

  • I have replied to you three times now without reply. I DID NOT authorise a payment of £9.99 for NowTV. What is the solution to getting my money refunded. I think you assume I will go away after being Ignored. No I will not go away. I find now that you hav

    I have replied to you three times now without reply. I DID NOT authorise a payment of £9.99 for NowTV. What is the solution to getting my money refunded. I think you assume I will go away after being Ignored. No I will not go away. I find now that you have DISABLED MY APPLE ID. Is this a punishment you use to anyone who takes up a stand against charges being made unauthorised on their account?. Please tell me why you have disabled my account. When will my account be restored? If not when will you refund ALL my purchases made to APPLE/ITUNES? I can then move on to another brand and hopefully better customer service. After reading articles regarding APPLE ID DISABLED it appears common practice from your company to DISABLE anyone's account if they question unknown charges. Please reply with your intentions regarding  the unauthorised payment and the DISABLING of my account.
    David Forrester.
    Sent from my iPad
    On 18 Mar 2014, at 09:20, iTunes Store <[email protected]> wrote:
    Follow-Up: 319042795
    Hello again,
    I wanted to send a quick note to see if you are still experiencing any difficulties with the iTunes Store. Resolving your issue is important to me, so please don't hesitate to reply if you need any further assistance.
    Sincerely,
    iTunes Store Customer Support
    http://www.apple.com/support/itunes/ww/
    Dear David,
    Welcome to iTunes Store Customer support.
    I understand that you have been charged an additional 9.99 GBP for a purchase that not authorized. I know how eager you are to know more about this purchase and I am happy to look into this for you.
    David, the purchase worth 9.99 GBP was for a day pass from "NOW TV for Apple TV." To review your iTunes Store account's purchase history, please follow the steps in this article:
    iTunes Store &amp; Mac App Store: Seeing your purchase history and order numbers
    http://support.apple.com/kb/HT2727
    Please reply to this email and let me know if this purchase was unauthorized.
    Thank you for being an iTunes Store customer. Have a great day!
    Sincerely,
    iTunes Store Customer Support
    http://www.apple.com/support/itunes/ww/
    Lang_Country: en_gb
    User Storefront: UK
    Concern Type: Problem Not Listed
    Web Order #:
    Content Title: NOW TV Day Pass
    Provider Name: BSkyB
    Track IDs: []
    Purchase Date : 2014-03-16 12:33:48 Etc/GMT
    Purchase Device : Apple TV
    Comments : I am being charged for what is listed plus another _9.99 for Apple TV pass. Did not authorise this _9.99 charge and not sure what it is exactly.
    <Personal Information Edited by Host>

    This is a user-supported board. You are not addressing Apple here. Nor is it a good idea to post your private information to a public forum. You should edit your post immediately.
    Unfortunately no one here can access your support history. You must respond to the emails directly.

  • Just bought a new iPhone and am having trouble with iTunes and App Store. I can log in to Cloud, iTunes, and app store but once I try to download, it says "Youe apple id has been disabled". I've reset my password three times and have no issue on my Pad.

    Just bought a new iPhone and am having trouble with iTunes and App Store. I can log in to Cloud, iTunes, and app store but once I try to download, it says "Youe apple id has been disabled". I've reset my password three times and have no issue on my Pad.

    Hi FuzzyDunlopIsMe,
    Welcome to the Support Communities!
    It's possible that resetting your password multiple times has triggered this security.  Click on the link below for assistance with your Apple ID Account:
    Apple ID: Contacting Apple for help with Apple ID account security
    http://support.apple.com/kb/HT5699
    Here is some additional information regarding your Apple ID:
    Apple ID: 'This Apple ID has been disabled for security reasons' alert appears
    http://support.apple.com/kb/ts2446
    Frequently asked questions about Apple ID
    http://support.apple.com/kb/HT5622
    Click on My Apple ID to access and edit your account.
    Cheers,
    - Judy

  • After uploading our phones with the latest update, we have noticed that the battery life has deminished considerably.  I now have to charge my phone overnight and two or three times a day. Prior to the update, my battery life lasted me at least a full day

    After uploading our phones with the latest update, we have noticed that the battery life has deminished considerably.  I now have to charge my phone overnight and two or three times a day. Prior to the update, my battery life lasted me at least a full day.  We have several phones in our office and the ones that have updated (4) now have issue holding a charge/battery life. I really liked this phone and can not believe that you are now going to charge us $79 a battery to fix what is most definately a problem with your latest update.  I know other people outside of our company that are having the same problem. Not to mention when I called AT&T it was confirmed to me that they are hearing the same issue and then some from other customers as well.  Your own people, once I talked to them earlier today, told me they are showing a history of issues that are showing up after the update was put in place. Of course she tried to say, "Maybe the age of the battery and the update both contributed".  Whatever. 
    I want you all to know how disappointed I am in your company for the handling of this issue.  I always thought "Apple" was the line I didn't have to worry about having any types of issue. And that you all would stand behined your product 100%. Now I am not so sure.   
    I would love to hear back from your company on how you perceive the issue with all of these phones that prior to the update didn't have any issues and how after the update THEY ARE NOW having issues.  I do not believe this was an issue due to the age of a battery and that was pretty lame to say so.  It was fine and now its not.
    Please feel free to contact me and help me figure out a way to pay for all of the batteries that will be needed for our company to contiue doing business as needed.
    Thank you.
    Web Address (URL):
    5106 McNarney

    Sorry this is a user to user technical forum.  There is NO APPLE here as stated in the term of use when you signed up for this forum.
    here are some battery tips
    http://osxdaily.com/2013/09/19/ios-7-battery-life-fix/
    http://www.apple.com/batteries/iphone.html

  • HT201269 Why isn't my cell phone backing up properly to my laptop?  Backed it up three times in two days.  I replaced my old cell phone, had to setup as new, then backed up from "last backup" but it didn't work at all. The last backup was available was mo

    My cell phone will not back up properly to my laptop.  I have tried three times in two days as I knew I was getting my new phone today and wanted to save all my information.  The problem is that it backed up very random things like things from my IPod from years ago, and did not back up all the information it should have from my "old" cell phone.  Now I am missing almost everything.  What happened and can i fix this?

    First, make sure you are using the most current version of iTunes 11.1.3 (8).  Second, what version of iOS 7 was your old phone running, i.e. 7.0, 7.0.1, 7.0.2? If your back-up was made with a version of iOS that is newer than the version on your new phone, it will not sync. For example, if your back-up was of a phone running iOS 7.0.4, and your new phone was running 7.0.2 out of the box, the back up will not sync to the new phone until it is updated to iOS 7.0.4.

  • HT3702 why did i get charged three times for the same purchase? is it because i use my apple id on three devices.. two iphones, and ipad... and and macbook geez apple i support you enough can i just pay for one copy of the audiobook

    why did i get charged three times for the same purchase? is it because i use my apple id on three devices.. two iphones, and ipad... and and macbook geez apple i support you enough can i just pay for one copy of the audiobook

    These are user-to-user forums, you are not talking to Apple here.
    If it was an audiobook then they are one-time only downloads, to get it on your other devices you need to sync it to them and not re-download it oneach. You can try contacting iTunes support and see if they will refund or credit you for the second and third downloads : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption

  • How do you allow one component at a time in the GUI to be selected?

    I have a tree and a combo box in my GUI. Does any one know of a method or way to allow the selection of one component at a time in the GUI only?
    For example, if i selected a node in the tree (it becomes highlighted), then made a choice from the combo box...I would like the node in the tree to be deselected.
    Thanks!!!

    Yeah add a focuslistener to everything and on focuslost clear the selection

Maybe you are looking for

  • How to change sharing settings with no video?

    I have a macbook pro that does not have any sort of video output.  Unfortunately remote login/screen sharing/ssh are all disabled and my version of realvnc is apparently just below the one that works with Lion causing the realvnc window on the remote

  • Windows 7 Pro SP1 ships with IE11. I need IE8 that used to run on Win7 - what choices do I have?

    Hi all, The reason for this post is our need for IE8 for compliance with company requirements (web apps of a big and cumbersome company that will only run on IE8). We received a non hand manageable number of brand new dell aio 9020 machines with Win7

  • Not able to install photoshop elements 11 on MacBook Pro OS 10.7.4

    spent last two days downloading photoshop elements 11 onto MacBook Pro OS 10.7.4 multiple times with no luck opening and installing popup reads: no default application specified to open the document PhotoshopElements _11_LS15-2.7z other download read

  • Final Cut Studio Tutorial

    Please pardon my ignorance - but I did a search and came up with a ****-ton possible answers. I am interested in Final Cut as opposed to what I have been using: iMovie I have messed around with FCP a little bit - but I am lost. Can somebody please te

  • Millis to hh:mm:ss

    what is the best way to display a value of milli seconds in the form hh:mm:ss the value will only be small (a couple of minutes max); I have tried a few different approaches, using Date and Calendar but just cant get it working. any help would be gre