Other components appear on updating imagePanel

Hi,
I have a problem probably with repaining issues. i have a JApplet which contains
An ImagePanel (extends JPanel implements Runnable)
A JTextArea
A JTextField
A JButton.
In my imagePanel's run method there is a repaint() process in order to update the image. Everything runs OK at the first sight, but when I click the button or update the caret position on the textField and/or the textArea, the component which is the event source appears on the imagePanel's (0,0) point for a tiny time.
I've searched common problems on swing painting ( http://java.sun.com/docs/books/tutorial/uiswing/14painting/problems.html ) but couldn't find a solution. Thanks for your help.
ANIL

Class2: VideoInform
package com.zzz.media;
import java.awt.Color;
import java.awt.Cursor;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.AbstractAction;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.KeyStroke;
public class VideoInform extends JApplet implements ActionListener{
    private static final long serialVersionUID = 3192341190927364167L;
    // GUI
    private Font f = null;
    private JPanel pane = null;
    private VideoPanel vp = null;
    private JScrollPane chatScroll = null;
    private JTextArea chatArea = null;
    private JTextField chatMsg = null;
    private JButton sendMsg = null;
    public VideoInform(){
        super();
    public void init(){
        this.setSize(760, 270);
        this.f = new Font("DialogInput",Font.PLAIN,12);
        this.setContentPane(getPane());
    public void start(){}
    public void stop(){}
    public void destroy(){}
    private JPanel getPane(){
        if(pane == null){
            pane = new JPanel();
            pane.setBackground(new Color(255, 50, 120));
            pane.setLayout(null);
            pane.add(getVp(), null);
            pane.add(getChatScroll(), null);
            pane.add(getChatMsg(), null);
            pane.add(getSendMsg(), null);
        return pane;
    private JPanel getVp(){
        if(vp == null){
            vp = new VideoPanel();
            vp.setSize(320, 240);
            vp.setLocation(2, 2);
            vp.setBackground(Color.BLACK);
        return vp;
    private JScrollPane getChatScroll(){
        if(chatScroll == null){
            chatScroll = new JScrollPane();
            chatScroll.setBounds(new java.awt.Rectangle(324, 2, 434, 240));
            chatScroll.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
            chatScroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
            chatScroll.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.magenta, 1));
            chatScroll.setViewportView(getChatArea());
        return chatScroll;
    private JTextArea getChatArea(){
        if(chatArea == null){
            chatArea = new JTextArea();
            chatArea.setLineWrap(true);
            chatArea.setFont(f.deriveFont(Font.BOLD, 11));
            chatArea.setMargin(new java.awt.Insets(0, 10, 0, 6));
            chatArea.setSelectionColor(java.awt.Color.black);
            chatArea.setSelectedTextColor(java.awt.Color.white);
            chatArea.setEditable(true);
        return chatArea;
    private JTextField getChatMsg(){
        if(chatMsg == null){
            chatMsg = new JTextField();
            chatMsg.setFont(f.deriveFont(Font.BOLD, 12));
            chatMsg.setText("jndskj jdnaskjndasknj kas kasdn");
            chatMsg.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.gray, 1));
            chatMsg.setBounds(new java.awt.Rectangle(324, 244, 380, 22));
            chatMsg.getInputMap().put(KeyStroke.getKeyStroke("ENTER"), new AbstractAction(){
                private static final long serialVersionUID = -4311410938780211364L;
                public void actionPerformed(ActionEvent e){
                    sendMsg.doClick();
        return chatMsg;
    private JButton getSendMsg(){
        if(sendMsg == null){
            sendMsg = new JButton();
            sendMsg.setBounds(new java.awt.Rectangle(704, 244, 54, 22));
            sendMsg.setCursor(new Cursor(Cursor.HAND_CURSOR));
            sendMsg.setText("INFORM");
            sendMsg.setBorder(javax.swing.BorderFactory.createLineBorder(java.awt.Color.black, 1));
            sendMsg.setBackground(new java.awt.Color(255, 240, 255));
            sendMsg.setFont(f.deriveFont(Font.BOLD, 11));
        return sendMsg;
    public void actionPerformed(ActionEvent event){
        Object ori = event.getSource();
        if(ori == sendMsg){
            sendMsg.setEnabled(false);
            try{
                Thread.sleep(1000);
            } catch(InterruptedException e){
                e.printStackTrace();
            sendMsg.setEnabled(true);
}

Similar Messages

  • Menus appearing underneath other components

    I am having a problem making my menus appear on top when they 'pop up'. I know this is a problem with mixing heavyweight and lightweight components, and I have been trying to force the menus to be heavyweight but to no avail.
    I have been trying to set the menus to be heavyweight by calling this method after the menu has been instantiated:
    [menuname].getPopupComponent().lightWeightPopupEnabled(false);
    Here is an image showing my problem:
    http://www.inf.brad.ac.uk/~jpcatter/menus.jpg
    Edited by: JonCat on Jul 26, 2008 8:47 AM

    It is not a mix of swing and awt. The browser component is the mozswing MozillaPanel component, and it is this that is being drawn on top of my menus, as can be seen from the screenshot that I posted. Another thought I had was that the browser component is the last to be drawn, as it is added to the tab control once all other components are drawn. Could it be the Z ordering of components causing the overlap, or is it strictly a heavy / light weight issue?
    Here is a link to the mozswing homepage for anyone who is interested:
    http://confluence.concord.org/display/MZSW/Home

  • [svn:fx-trunk] 12878: When sub-components don' t have a tabIndex and when VideoPlayer instance does, assigned tabIndex to each inner-component to ensure that they appear in the correct tab order with other components on the stage .

    Revision: 12878
    Revision: 12878
    Author:   [email protected]
    Date:     2009-12-11 19:07:40 -0800 (Fri, 11 Dec 2009)
    Log Message:
    When sub-components don't have a tabIndex and when VideoPlayer instance does, assigned tabIndex to each inner-component to ensure that they appear in the correct tab order with other components on the stage.
    QE notes: none
    Doc notes: none
    Bugs: n/a
    Reviewer: Gordon
    Tests run: checkintests
    Is noteworthy for integration: no
    Modified Paths:
        flex/sdk/trunk/frameworks/projects/spark/src/spark/accessibility/VideoPlayerAccImpl.as

    Michael,
    "Michael Caughey" <[email protected]> wrote in message news:413f0af6$1@mail...
    If I'm doing something wrong what is it? Obviously there is something
    different about how I configured my environment a year ago.What happens if you bring down ms02?
    Regards,
    Slava Imeshev

  • My iOS 6.1.4 is updated. i have other devices connected to wifi hotspot of my iphone5. Though my other devices appeared to be connected and shows an excellent cignal strength, i cannot access internet. hope this will be fixed.

    my iOS 6.1.4 is updated. i have other devices connected to wifi hotspot of my iphone5. Though my other devices appeared to be connected and shows an excellent cignal strength, i cannot access internet. hope this will be fixed.

    I hope so too.  So what have you actually done to fix your issue?

  • Problem with Checkbox that disables/enables other components.

    Hi
    As I show in the title, I have problems with a checkbox that enables/disables another components (three exactly).
    I have done the follow:
    1.- Set property "AutoSubmit" true in the SelectOneChoice
    2.- Set "Disabled" property true or false depending if the SelectOneChoice is selected or not
    (#...selectBooleanCheckbox.value?false:true})
    3.- Set the Partial triggers to the SelectOneChoice in the three components.
    CASE 1: The SelectOneChoice is unmarked. The three components appears disabled and when I mark the SelectOneChoice, this components appears enabled. The thing works ;)
    CASE 2: The SelectOneChoice is marked. The three components appears enabled and when I unmark the SelectOneChoice, the components continue enabled. They don't disable until I press the submit button.
    how can i make that the components appears disabled when i unmark the checkbox?
    i try with de ChangeValueListener, but it only works where the SelectOneChoice changes from unmarked to marked.
    thanks!

    I think the problem is, when the value is null the checkbox return with the selected state, b'coz u r
    returning the checkbox (as it is). so pl'z try with below code (ADDED).
    public Component getTableCellRendererComponent(JTable table, Object value,
    boolean isSelected, boolean hasFocus,
    int row, int column){
    if(value != null){
    Boolean booleanValue = (Boolean)value;
    setSelected(booleanValue.booleanValue());
    else /// ADDED
    setSelected(false);/// ADDED
    return this;
    Nediaph.

  • I am unable to update my apps... in my purchases page it appears as "update", then a message tells me to log on with the Apple ID I purchased the app with... Well I have tried my two different accounts and neither one will work, can someone help ??

    I am unable to update my apps... in my purchases page it appears as "update", then a message tells me to log on with the Apple ID I purchased the app with... Well I have tried my two different accounts and neither one will work, can someone help ??
    And is there any way to sync all my purchases and accounts to just have one... It is a bit stupid that you dont even get a list of something of what account you may of used, or some kind of hint, so you could log on to the right account. I am really stuck ...
    Please Advise......

    You can't merge accounts. But you can check your purchase history:
    iTunes Store & Mac App Store: Seeing your purchase history and order numbers
              http://support.apple.com/kb/HT2727
    Also, what may seem stupid to you... may be a protection of privacy to others.

  • HT1338 When I try to download the iMovie Update :  "You have updates available for other accounts.  To update this application, sign in to the account you used to purchase it." shows -don't know what other accounts it is talking about? I Only have 1 Apple

    When I try to download the iMovie Update :
    "You have updates available for other accounts.
    To update this application, sign in to the account you used to purchase it." shows -but I don't know what other accounts it is talking about? I Only have 1 Apple Id !

    Maybe this will help. If you monitor the "More Like This" box, other solved threads appear. Opening them usually displays other threads.
    http://support.apple.com/kb/TS4236

  • HT1386 I've updated my 2007 MacBook to 10.6.8, and now my iPhone 3 (used as iPod) and iPhone 4 aren't recognized to be synced anymore or I get an error message telling me to update my phone to 11.1 or something. When I do that is appears to update and whe

    I've updated my 2007 MacBook to 10.6.8, and now my iPhone 3 (used as iPod) and iPhone 4 aren't recognized to be synced anymore or I get an error message telling me to update my phone to 11.1 or something. When I do that is appears to update and when finished nothing appears to have updated.

    It is possible one of the 10.6.8 updates may help:
    Combo v1.1 (7/25/2011), 10.6.8 2013 Security Update 004, 2013-005 Java update.
    Note, your machine is too old to use the latest Java from http://www.java.com/

  • Error message hkey_local_machine\software\classes\itunes.aifc keeps appearing when updating.

    Error message hkey_local_machine\software\classes\itunes.aifc keeps appearing when updating.  Then update uninstalls.  I was trying to fix a missing driver error.

    Press WinLogoKey+R to open the Run... dialog box
    Type in Regedit and press enter/return
    Tap the plus symbol next to HKEY_LOCAL_MACHINE
    Tap the plus symbol next to SOFTWARE
    Press C on the keyboard, then again or scroll down until Classes is selected
    Tap the plus symbol or use the right-arrow key to open the branch
    Press i on the keyboard, then use the Page Down key, scroll bar or arrow keys to locate iTunes.aifc
    The registry editor should now look something like this: (Click to enlarge)
    Right-click on the iTunes.aifc key and click Permissions... to see what is going on. My current permissions for the iTunes.aifc key are shown below: Giving Administrators and/or yourself Full Control should be enough to let the installer make changes. Alternatively you could delete the key and let the iTunes installer recreate it.
    tt2

  • HT1766 Hello I am trying to update my viber, as i pressed update icon the message appeared "This update is not available for this Apple ID either because it was bought by a different user or the item was refunded or camcelled" what does it mean

    Hello I am trying to update my viber, as i pressed update icon the message appeared "This update is not available for this Apple ID either because it was bought by a different user or the item was refunded or camcelled" what does it mean?

    iTunes issue ,Apple are working on it
    solutions in thids thread seem to resolve for some
    https://discussions.apple.com/message/25722716#25722716
    Appears to be linked to having changed iTunes Store Country at some time in past

  • Software updates do not appear under Updates

    Software updates do not appear under Updates in the Mac App Store.  So far, I have not been able to select or install the newest Yosemite update (10.10.1) and the latest iTune update.  What could be the problem?  Third party software shows and will update, like Evernote, but Apple branded updates do not appear.

    Hello JAKE3POINT0,
    After reviewing your post, I have located the page which includes the download of the 10.10.1 update. Applying the update may address the issue you are experiencing:
    OS X Yosemite 10.10.1 Update
    Thank you for contributing to Apple Support Communities.
    Cheers,
    BobbyD

  • Creating GUI component that includes other components

    Hello, I need to create an UNIVERSAL FORM (panel) consisting of several textboxes and labels. These textboxes and labels will be defined in XML. I want it as a GUI JavaBean. It should be made from a panel with some layout and it should consist other components. Here are my questions:
    1) What class to derive from? JPanel?
    2) Well, when I override a GUI Swing component I must implement a paint method but this is a bit strange. I just want to set up the textboxes -- I do not need any special painting. A question appears -- is JavaBean technology good for this situation? Is there any better solution?

    I mean why this doesn`t work:
    public class Uniform extends JComponent implements
    Serializable {
         private String xmlContent;
         private int type;
         private JPanel panel;
         public Uniform() {
              panel = new JPanel(new GridLayout(1,2));
              panel.add(new JTextField("A"));
              panel.add(new JTextField("B"));
         public void paint(Graphics g) {
              panel.paint(g);
    }Is it a good solution? How would you solve the
    problem?
    Thanks for your ideas.If you mean by 'dont' work' that your text boxes and panel doesn't appear, then it's because you're missing this line in your constructor:
    public Uniform() {
      this.add (panel, BorderLayout.CENTER);
    }Regards,
    Devyn

  • App keeps appearing in updates

    There is an app that keeps appearing in updates regardless of whether I update it, delete it, reboot iTunes or my Mac. This has been going on for a while now and that app is there every time I check. I can update all and then there it is in my updates. I have deleted the file from my iOS devices and from my hard drive and there it is in app updates.
    How do I get this to stop?
    iTunes 12 on Yosemite.

    Okay, I am sorry I said anything. Now the "Update All" button is greyed out and I have to update my apps one at a time. At least I can skip that one app now...
    Is there no one out there that can help?

  • Hello. I have downloaded ps cc in the Norwegian version. I then deleted the Norwegian Verson and will re installPerfect ps cc english verson. When I try to download ps cc again I do not get pressure on ps cc in creative clode distributions appear as updat

    I have downloaded ps cc in the Norwegian version. I then deleted the Norwegian Verson and will re installPerfect ps cc english verson. When I try to download ps cc again I do not get pressure on ps cc in creative clode distributions appear as updated What can I installation alert ps cc again ?

    That is not a practically empty xinitrc - that file only needs one line: exec WM.  Other things are entirely optional, and some of them very useful, but I'd encourage you to stick with the simplest xinitrc that will do what you require.
    Is slim involved?  Probably.  That is the source of many problems.  But to start narrowing this down, I have 3 suggestions:
    1) temporarily (at least) change your inittab to default to runlevel 3 ... actually, is it currently set to 5 or 3? if it is currently 3 that would explain why slim doesn't start.
    2) at a tty in runlevel 3 use "xinit" instead of "startx".  Startx is fine most of the time, but it is essentially just a complex wrapper for xinit.  That complexity can often iadd useful functionality, but it *always* makes troubleshooting more difficult.  So for now just use a vanilla 'xinit'.
    3) remove dbus-launch from your exec line in xinitrc.  This is done by console-kit so it is redundant and potentially problematic.  Further BOTH of these are taken care of by slim, so I'd even suggest getting both a jump start on being ready for slim and simplifying troubleshooting by removing both of them.  Just make that line "exec openbox-session"
    Edit: adding one more:
    4) temporarily switch out openbox-session for openbox.  I suspect the reason feh's setting of the background is getting overridden is due to a script or setting in openbox's autostart settings - many of these are only invoked when "openbox-session" is called, while "openbox" starts *just* the window manager itself.
    Last edited by Trilby (2012-10-03 17:30:36)

  • Deleted app from itunes and iphone appearing in updates

    I have tries to install app 'Prince of Persia: Warrior within' from itunes but cancelled it looking at the app size. But this app appears in update section when I click 'itunes download available' or if I click download all apps. Again, it is also happening for one more app which I installed and deleted ('Capcom Arcade') but again it appears in download section and starts to download automatically.
    I am really frustrated with this activity as I have to always check that itunes is not automatically downloading these applications other wise it consumes by internet bandwidth (both apps are more than 500 MB of size).
    Please provide a solution or help me with any tips on this.

    To completely remove an app from iTunes & your phone, do this: Right-click the app in your iTunes library, select delete, when prompted, move all files to trash, empty your trash, connect your phone, if prompted that there is purchased content on your phone not in your iTunes library, decline to transfer, hit the sync button. The app and all of its data will be gone.

Maybe you are looking for

  • Old Bookmarks are not compatible with Firefox version 20+

    Background Information: I use the old client version 3.6 as there's an old utility addon that the author stopped updating and will not work with the newer revisions. Despite disabling the update feature both in about:config and in preferences, the br

  • Old broken computer (before iTunes Match available)

    I have an old HP that no longer works (before iTunes Match). I had uploaded my entire cd collection and it is associated with my itunes account.  If I purchase ITunes Match will it bring this data in my library?

  • Unable to  re print  purchase order.

    Dear expertes The po  was printed 2 days back , again after changing payment  terms then  after release  process  iam  able to view the print view but could not print the po  using  ME9F. Iam gettingu201D  message already processed on  11.07.2011 wha

  • 4 pin to 6 pin adapter

    I have cable I have used on my PC. I was just looking for a cheap retail place that may have. I don't need the whole cable, just a 4 to 6pin adapter that will hookup to the MPB. Thanks.

  • G-Tech Mini vs. 'Regular' G-Tech External Hard Drive

    Noticed in local Apple Store that the mini version of the G-Tech HD was $40 more with half the stated storage space. Why the difference? How do both products compare in use for video storage & editing in iMovie or Final Cut?