JPanel doesn't get visible when followed by socket connection

Hi all... I'm having a problem with a java Swing application...
when a actionEven is given, I want to create a new socket to connect to a server, and I'd like to show a panel with a "connecting... " message while it's done.
My problem is that writing the code secuentially, it does not work in the correct order
public void actionPerformed(ActionEvent e) {
                 - JPanel.setVisible(true);
                 - JPanel.repaint();
                 - socket connection code here
}this, makes the socket connection and displays the panel once it's done. Why this behaviour?
I have also tried to not to change the visible property in the event handler, but creating a new Thread when it's triggered, and giving it maximum priority... but this doesn't work neither.
Thank you

thank you camickr,
I tried the opposite of what I did at first... creating a new thread with minimum priority and doing the socket connection in it, and it worked.

Similar Messages

  • Itunes doesn't open automatically when my iphone is connected anymore

    I have an iphone 4s and it used to open iphoto and itunes automatically when i plugged it in with a usb cord. now it doesn't do either. i got iphoto to open, but am still having issues with itunes. i have tried all the obvious: checking and unchecking the preferences and summary settings that indicate to automatically sync and open when connected. nothing is working. any suggestions

    In iTunes click on your phone under "Devices" on the left of the screen > "Summary" tab > Options: "Open iTunes when this iPhone is connected".

  • Getting continious stream  in one socket connection

    i want to make one socket connection with client and when client send more than one packet ( it can be continious or after some time - in byte stream) how i will be able to get those packet in interwal.
    please suggest

    then maybe you can help me out ejp
    ***server side****
    buffer.clear();
    buffer.put("return string".getBytes());
    buffer.flip();
    while (buffer.hasRemaining())
        socketChannel.write(b);
    ***client side****
    int line;
    byte[] mybyte=new byte[1024];
    while ((line=in.read(mybyte,0,mybyte.length))!=-1)
             System.out.write(mybyte,0,line);
    System.out.println("write finished");these are code snippets frm a client server prog i have.
    if i just do with the single while loop, my client will see the full return msg, but not the write finish output. its always waiting for the -1 eos.
    now, if i use what i said earlier, it works fine. could you kindly help me with this problem?

  • Please help: data doesn't get through when using NIO's UDP

    Hi there, I have a 2D client-server game, using NIO's UDP. Whenever the clients send data to server, the data just disappears and not exception nor error appear at the server side.
    Following are the portions of the code where the problem occurs, please help me have a look, many thanks.
    (Please note, I'm using non blocking mode for both client and server, and have no problems with other portions of code, communication was fine, data did get through the network and processed by the server/client. Also, client's DatagramChannel "dChannel" is connected to server, however server's DatagramChannel is not connected to any one).
    //***client's sending code***
    public void sendEventToServer(int[] values) {
        prepWriteBuffer(values);
        try {
          dChannel.write(writeBuffer);
        catch (Exception ioe1) {
          System.out.println("Error when send event to server");
    public void prepWriteBuffer(int[] values) {
        writeBuffer.clear();
        writeBuffer = ByteBuffer.allocate(128);
        if (values[0] == 1) { //fire event
          writeBuffer.putInt(0, firePacketNum);
          firePacketNum++;
        else if (values[0] == 2) { //positional event
          writeBuffer.putInt(0, positionalPacketNum);
          positionalPacketNum++;
        else {
          writeBuffer.putInt(0, -1);
        int j = 4;
        for (int i = 0; i < values.length; i++) {
          writeBuffer.putInt(j, values);
    j += 4;
    writeBuffer.flip();
    //***server's code*****
    public void sReceive(long startTime){
        do {
          readBuffer.clear();   //note, readBuffer is 3072 bytes, bigger than client's sending buffer
          InetSocketAddress sourceAddr = null;
          // read from the channel into our buffer
          try {
                 sourceAddr = (InetSocketAddress) dChannel.receive(readBuffer);
          catch (Exception ioe) {
                 System.out.println(ioe);
          // check for end-of-stream
          //I tried with "if (readBuffer.hasRemaining())", getting the same "data disappearing" problem
          if (sourceAddr == null) {
                 //*********Problem: no matter how often the client is sending, this "if" clause is always entered
                 //that is, data disappeared
                 System.out.println("Server got nothing so breaks.");
                 break;
          else {
                 //******Problem: client keeps sending, but this "else" is never entered.
                 System.out.println("Server now got someting from client.");
                 readBuffer.flip();
                 broadcastEvent(readBuffer, sourceAddr);
        while ((System.currentTimeMillis() - startTime) < 134);

    Here's how the buffer filling stuff works, Ron Hitchen's JAva NIO O'Reilly press, has lots of good diagrams of this.
    buf = ByteBuffer.allocate(10)  // creates new buffer
      0----1----2----3----4----5----6----7----8----9----10
      |    |    |    |    |    |    |    |    |    |    |
      ----------------------------------------+
      ^                                                 ^
      |                                                 |
    position=0                                       limit=capacity
    buf.putInt(5);  // relative put, updates position
      0----1----2----3----4----5----6----7----8----9----10
      | 00 | 00 | 00 | 05 |    |    |    |    |    |    |
      ----------------------------------------+
                          ^                             ^
                          |                             |
                       position=4                    limit=capacity
                       updated
    buf.putInt(4,12);  // absolute put doesn't update position
      0----1----2----3----4----5----6----7----8----9----10
      | 00 | 00 | 00 | 05 | 00 | 00 | 00 | 0c |    |    |
      ----------------------------------------+
                          ^                             ^
                          |                             |
                       position=4                     limit=capacity
    buf.position(8);  // so we set the position ourselves
      0----1----2----3----4----5----6----7----8----9----10
      | 00 | 00 | 00 | 05 | 00 | 00 | 00 | 0c |    |    |
      ----------------------------------------+
                                              ^         ^
                                              |         |
                                         position=8   limit=capacity
    buf.flip();  // flip prepares for write
      0----1----2----3----4----5----6----7----8----9----10
      | 00 | 00 | 00 | 05 | 00 | 00 | 00 | 0c |    |    |
      ----------------------------------------+
      ^                                       ^         ^
      |                                       |         |
    position=0                             limit=8   capacity
    channel.write(buf); // write it out, assume all gets written
      0----1----2----3----4----5----6----7----8----9----10
      | 00 | 00 | 00 | 05 | 00 | 00 | 00 | 0c |    |    |
      ----------------------------------------+
                                              ^         ^
                                              |         |
                                  position=limit=8   capacity
    if it didn't all go out, the position would indicate the
    first unwritten byte.

  • Filename doesn't get changed when importing (sometimes)

    I have the following Problem:
    When I import a directory of mp3 files (an album), then some filenames (1-2) don't get changed (there are correct id3 tags). Lets say I have the first song called first song, the original filename is first_song.mp3. After importing the song is in the correct directory but not changed. It should be something like: 01 first song.mp3. When I edid the id3 tag to lets say first songe the file gets changed.
    What could be the problem? Itunes bug?

    vikyboss wrote:
    Actually the problem seems to be resolved. I have a fully updated system and installed xfce again few days ago. And it works miraculously..
    Installed versions:
    1. xfce4-mixer 4.10.0
    2. Advanced Linux Sound Architecture Driver Version k3.9.3-1-ARCH
    ravicious wrote:Oh, I actually fixed this myself yesterday. I installed pulseaudio, pulseaudio-alsa and xfce4-volumed-pulse (from AUR) and then removed volume shortcuts from xfce4-keyboard-settings. In xfce4-mixer, you just have to choose a proper playback as a sound card.
    Wow, actually it now works for me, too! Amazing!

  • Photoshop Elements 12 Editor (Mac) doesn't get closed when I quit

    Again I try to report a problem with Photoshop Elements 12 (upgraded from PSE 10) Editor on OS X 10.8.5. Now in English. I am German, so please excuse me when I don't use the correct termini. Hope you're able to understand my problem.
    After using the Editor I try to close the program: Close the window and press ⌘Q. But most of the time I can't close but have to press "quit immediately" in the dialogue window of the dock-icon. Have reinstalled several times, doesn't help.
    Other user out there with same problem?

    Hi Priyanka_Azad (nice to see a guitar lover),
    Could you try using the menu to quit the Application, it is the last option under "Photoshop Elements Editor" Menu and not the shortcut.
    Yes, I have tried this, but makes no difference...
    Also, as you have mentioned you see this issue "most of the times".
    Does that mean that it works fine at times as well?
    Very rare, indeed.
    To Priyanka_Azad, Barbara B. and Pete.Green,
    a step forward, concerning welcome-screen:
    Now I know what causes the dissappearing of welcome-screen. It's the update "Photoshop Camera Raw 8.2". Meanwhile I had uninstalled PSE 12, installed PSE 10 again (everything still fine there), uninstalled PSE 10 again, installed PSE 12 again. Then I recognized that before I update to Raw 8.2 the welcome-screen works. So far I have waived to update.
    Very simple mistake, that I did. I had moved application into dock, not the alias of the application. Now, when I start with alias, welcome-screen works as it should. Unfortunately no influence on my "Quit"-problem.
    Lena
    Nachricht geändert durch bluesorella: "a step forward, concerning welcome-screen"

  • I am not able to download a video in mac.When I click on it it opens in a new window and plays online but doesn't get downloaded.When I open the link in windows it gets downloaded in .mov format and play in windows media player!Help

    Can you tell me how to download it in MAC OS

    This is a user-to-user forum, and although Adobe staff make occasional appearances here, there is no guarantee that you will get any "officila" Adobe feedback.
    If you have difficulties to install the online installer from http://get.adobe.com/flashplayer/, then download the offline installer http://fpdownload.macromedia.com/get/flashplayer/current/install_flash_player_ax.exe; save it to disk, then run it after closing all browser windows.

  • [Solvd]XFCE mixer panel plugin doesn't get updated when volume changed

    XFCE audio mixer panel plugin used to show the correct volume when I change the volume either with my Laptop touchbuttons or keyboard volume buttons.
    1.  To make sure if I am actually changing the volume, I opened alsamixer and tested pressing keys they work fine.
    2.  I even opened properties option from the indicator and set it to "Master"(the one I use) of my speaker, still no luck.
    3. The only problem is the indicator doesnt update when the volume is changed or muted.
    But for unknow reason this problem started last week.
    Thanks for the help.
    Last edited by vikyboss (2013-06-23 16:27:36)

    vikyboss wrote:
    Actually the problem seems to be resolved. I have a fully updated system and installed xfce again few days ago. And it works miraculously..
    Installed versions:
    1. xfce4-mixer 4.10.0
    2. Advanced Linux Sound Architecture Driver Version k3.9.3-1-ARCH
    ravicious wrote:Oh, I actually fixed this myself yesterday. I installed pulseaudio, pulseaudio-alsa and xfce4-volumed-pulse (from AUR) and then removed volume shortcuts from xfce4-keyboard-settings. In xfce4-mixer, you just have to choose a proper playback as a sound card.
    Wow, actually it now works for me, too! Amazing!

  • Memory doesn't get cleared when i delete the playlist

    Hi,
    I am using iPOD nano. I have turned "manually manage music" option ON. now I create an play list by right clicking on iPod icon in I-Tune browser and i drag and drom songs from my folder on computer to this play list.
    If i want to delete this play list, it allows me to delete but the memory space occupied by it is not cleared. even if i delete all the playlist it still shows that whole of the memory is occupied and refuges to store any more song.
    Please help me to handle this ..
    Thanks and regards,
    Pankaj
    iPod Nano, 2 GB   Windows XP   I-tune 7.0.2.16
    iPod Nano, 2 GB   Windows XP   I-tune 7.0.2.16
      Windows XP  

    Correct. Deleting a playlist does not delete the actual song files so therefor storage space used would still be the same.
    You need to delete the songs themselves.

  • MacBook Air is getting hot when external monitor is connected - restart solves the problem

    I have a two weeks old Mac Book Air 11" (128GB / 4GB / i5). Sometimes when I connect it to my external monitor, the FAN is getting loud and the MacBook becomes very warm on the surface near the "F3 button". The activity monitor says CPU is at 0-1% and there's no process that causes any CPU load (I switched to "show all processes" of course). Nevertheless something makes the Mac becoming hot. A simple restart while the external monitor is connected solves the issue completely, temperature and fan speed are instantly decreasing. Is this a issue related to the graphics driver? For me it seems the behavior is caused by the graphics processor rather than by the i5 CPU as activity monitor does not show any process causing high CPU load.
    Known issue?
    Thanks!

    I was runnig into the same problem. Plugging in to the apple 23" display at work worked well, but when I plugged in my Dell 23" at home the fan started being noisy...
    ALTERNATIVE SOLUTION: it seems to me that putting the air to into SLEEP MODE and back solves it as well!!
    I will confirm later on.

  • 13" MBP internet connection gets disconnected when too many wifi connection's available

    I just notice this a couple of nights ago... Im using a 13" MBP I bought last June 9.  At night, when there are plenty of wifi connections being broadcast in our condominium bldg, my internet connection is very slow.  Also, the signal strength is reduced to half.  Sometimes I even get disconnected and the MBP wifi has difficulty reconnecting my wifi.  But when morning comes, signal strength is at full.  I ask my friend who also connects to the same wifi if ever he has difficulty connecting at night, but unfortunately its just me.  He is using windows, by the way.  I'm wondering if this is a known issue and have a fix already? or it's just me?
    Please help... Thanks.

    I use my 15" MBP this way with no problems at all and I have Mountain Lion installed.  So we need to look elsewhere for the problem, it's not possible to link this to the OS without further investigation (but it could be a system setting).
    I  know that other folks are complaining that Mountain Lion broke WIFI.  But if that were the case we would all have problems.  I, along with many others, have no problems at all.  I think there is something else going on.
    What is the signal strength with the lid open vs. closed?
    When you say that Safari does not work, are you getting a timeout message or a message like "You are not connected to the Internet."?  Of course this is the English version of the message, yours will be different.

  • 64g 3 rd does nothing except the back gets hot when i try to connect or charge

    so I bought this on ebay  its a 3 rd gen  64  ipod touch  it does nothing black sceen no sounds and when I plug it in to charge or conect to i-tunes it gets hot on the back lowerr right.  ?any Ideas?

    You can try here:
    iOS: Not responding or does not turn on
    However, from being hot you may have a hardware problem an an appointment at the Genius Bar of an Apple store is in order.

  • IMovie doesn't recognize camera when external hd is connected

    I can't import a movie from my camera into iMovie6 when a external hd is connected.That is,a 400gb LaCie tripple interface or a freecom classic sl hard drive400gb.
    When a LaCie Mini 80gb is connected there is no problem.
    When one of the above is connected with firewire iM doesn't recognize the camera at all.
    When connected with usb2 it does see the camera,but only imports for about two seconds and that quits.
    Any suggestions?
    Jacqo

    Thanks Karsten.
    Yes, my camera is a Canon,but not one of the models mentioned in that tech note.
    I've solved it now.
    Reading your reply gave me a bright idea.
    If that is true why can I import with the smaller LaCie hd connected?
    Look at the type of firewire cable Jacqo.
    Yes,that is a different type of cable;connected the 400g with the cable that came with the 80g hd and eureka,it works.
    So it was just a matter of the right type of firewire cable.
    Why didn't I think of that earlier.
    Again ,Thanks Karsten.
    Jacqo.

  • How to get notified when cache items disappear?

    Let's say I have two JVMs in a partitioned cache with no backups (backup_count=0).
    As cache items are inserted, roughly 50% of the items go to JVM1 and JVM2 each.
    If JVM2 has a violent death, all the cache items in JVM2 are lost forever. Is there a way to know in JVM1 which cache items are lost? I tried using a MapListener in JVM1 on the backing map but it doesn't get notified when JVM2 dies. Using MemberListener would tell me that JVM2 died but it wouldn't tell me which cache items were lost.
    Is there a way to know the cache items that were lost in the above scenario?
    Thanks
    Ghanshyam

    Ghanshyam,
    Unfortunately currently there is no generic functionality that would allow you to know what entries were "lost".
    Regards,
    Gene

  • No audio when the screen is connected to the keyboard base

    On my HP Split x2, I have no audio when the screen is connected to the keyboard base. The audio only plays when the screen is detached by itself.  Sometimes I can get audio when the screen is connected and at a 30 degree angle from the keyboard. 

    Hi @ccc9123 
    Welcome to the HP Support Forums!
    From the problem you describe with the audio it sounds like a  hard ware issue with the connection. I would recommend contacting phone support at 800-474-6836. If you live outside the US/Canada Region, please click the link below to get the support number for your region. http://www8.hp.com/us/en/contact-hp/ww-phone-assist.html
    Malygris1
    I work on behalf of HP
    Please click Accept as Solution if you feel my post solved your issue, it will help others find the solution.
    Click Kudos Thumbs Up on the right to say “Thanks” for helping!

Maybe you are looking for

  • Inserting/updating data in control block based on view

    Hi! I`ve created a block based on a view to display data. I want this block to be insertable and updateable, that is I will use a on-insert/update trigger to call an insert/update procedure located in the database. When trying to change/insert a valu

  • How can I get my iPod to work with its updater?

    Hey all, I have a 4G iPod, and it isn't recognized by iTunes. I connect it to its dock, and open the updater. The updater freezes and won't work UNLESS I leave it alone, after a few minutes the updater recognizes an iPod, but not any information abou

  • Session Crossing in Hosted Display Mode

    Hi! I'm taking a 3rd party program written in ASP and serving it inside the portal using the gateway (via Hosted Display Mode.) Users that are using the application are using the portal in a guest context. While testing the integration, we've found t

  • FINSTA01+ LOCKBOX

    Hi All, I have one doubt regarding how many times the particular segemnt repeated . I am reading some data from EDIDC table and thern calling the FM ''IDOC_READ_COMPLETELY'      loop at i_EDIDC         call function module to collect the idoc informa

  • Spry menu problem in IE- showing as white box

    Help please. My spry menus are showing as a white box in Internet Explorer. All other browsers are fine. I am a newbie and don't know how to fix the problem. http://harmonized.harmonized-design.com.