GUI Multithreading problems

I'm making a chat client and I'm having problems with the threading around the GUI. It works when I don't use the GUI (and ActionListeners aren't at fault). I basically have two threads, a send thread and a receive thread, which are both subclasses that extend Thread. When I start them through the GUI, on an ActionListener, they don't work... but when I start them in a program that is GUI-less, they do work. Just for clarification, it's not the ActionListeners at fault, I tried doing a System.out on the same ActionListener and it worked.
A peculiarity is that when I make a new instance of the same frame [another frame.setVisible(true)] in my Receive thread, it starts receiving on the new window. I get the messages from the server, but I can't send stuff. I used to view this as a half-success, but now I think I'm going about it all wrong.
So, here's my questions:
1.Do I need to make more threads? I thought that everything outside the Receive and Send threads were naturally in a thread themselves, but it seems that they are not. Should I put the TextArea in my GUI that receives messages in a different Thread?
2.Or is the problem that I have to somehow refresh the frame without causing it to make new frames?

It's hard to tell what's going on without seeing your code. What do you mean when you say "When I start them through the GUI, on an ActionListener, they don't work"? Does that mean the threads don't start, or you don't see anything happening in GUI, or everything freezes, or... etc, etc.? Please post code or describe the sequence of events in detail so we can help.
As a guess, it sounds like you're starting your threads when you press send, which doesn't sound right. In a chat, both threads should be running from the beginning, and when you have stuff to send you put it in a queue, then let the send thread pick it up. The receive thread just receives and puts messagese in the GUI. - see http://java.sun.com/products/jfc/tsc/articles/threads/threads1.html

Similar Messages

  • GUI related problem in solaris 8 02/04

    Hello all,
    I am facing GUI related problem in the software running on solaris when I upgraded from solaris 8 02/02 to 8 02/04.
    The GUI which was working fine on 02/02 was giving some menu selection problem in 02/04. In GUI applications i was unable to select items after double clicking it in solaris 8 02/04 while it was working fine in solaris 8 02/02.
    Are there any O.S. related problem?
    Thanks and regards,
    Ankit

    Wolfgang073 wrote:
    Hi guys and ladys!
    I added the LD_LIBRARY_PATH, Why are you doing that. It's probably a bad idea.
    but the Openwindows not run OK (e.g. start cmdtool window without csh % prompt etc.).That's very possible. Don't make global changes to LD_LIBRARY_PATH (by putting in your login files for example). Instead if you need it to run a particular program, make a wrapper that sets the variable and then calls the program. That will limit the scope of those changes.
    vi .login
    # Erasing LD_LIBRARY_PATH
    setenv LD_LIBRARY_PATH
    # Important Paths set
    setenv LD_LIBRARY_PATH     /usr/ucblib:$LD_LIBRARY_PATHDon't do that.
    Darren

  • Helping , Observable's multithread problem, thread is losting ?

    i am practicing an example of Observable and Observer pattern. But one problem were occured as following:
    the programe will print out a 10*10 grid , and using observer pattern to change every grid 's color.
    The fill rule is that : 1. randomly to choose a beging grid,
    2. notify the four grid (left ,right , upper, below of the choosed grid) to change their's grid color.
    The problem is when using multithread to notify grid , not all of the grid will be changed color, but if using single thread to notify grid, then all of the grid will be notified, and color changed.
    the switch of the multithread and single thread is the P.java 's 62-66 line, and 67-71 line, the source is following, anyone can help to analysing the source, and found exactly where is reason of not all of the grids could be notified , very thanks.
    the starup class is the Guess10.java.
    the source :
    package guess10:
    package guess10;
    import java.util.*;
    import guess10.gui.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class P
        implements Observer {
      public P() {
      public P(int x, int y) {
        this.x = x;
        this.y = y;
      public static void main(String[] args) {
        P p1 = new P();
      int x;
      int y;
      public void open() {
    //    System.out.println("open " + this);
      public void update() {
    //    System.out.println("update " + this);
    //    System.out.println("[" + x + "," + y+"]");
        F.instance.getGrid(x, y).action();
      public void open(Observable ob) {
        open();
    //    System.out.println(this);
        ob.deleteObserver(this);
      public void update(final Observable ob) {
        update();
        ( (PObservable) ob).change();
    //    ob.notifyObservers(new Point[]{new Point(x+1,y)});
    //    ob.notifyObservers(new Point[]{new Point(x,y+1)});
    //    ob.notifyObservers(new Point[]{new Point(x+1,y+1)});
    //    ob.notifyObservers(new Point[]{new Point(x-1,y-1),new Point(x+1,y-1),
    //    new Point(x+1,y+1),new Point(x-1,y+1)});
          final Point[] p = new Point[] {
              new Point(x - 1, y), new Point(x, y - 1),
              new Point(x + 1, y), new Point(x, y + 1)
         new Thread(new java.lang.Runnable() {
            public void run() {
                ob.notifyObservers(p);
          },"" + x +"," + y ).start();
    //      new java.lang.Runnable() {
    //        public void run() {
    //          ob.notifyObservers(p);
    //      }.run();
      public void update(Observable observable, Object object) {
    //    System.out.println(this+" " +Thread.currentThread().getName());
        Point[] p = (Point[]) object;
        for (int i = 0; i < p.length; i++) {
            if (this.x == p.x && this.y == p[i].y) {
    if ( ( (PObservable) observable).exist(this)) {
    open(observable);
    update(observable);
    public static int count = 0;
    public String toString() {
    return "x = " + x + " y = " + y;
    // now not used
    private Object lock = new Object();
    package guess10;
    import java.util.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class PLayout {
    private BitSet xb = new BitSet();
    private BitSet yb = new BitSet();
    PObservable o = new PObservable();
    public PLayout() {
    public static void main(String[] args) {
    PLayout PLayout1 = new PLayout();
    * create 100 p object, and store into Observable object
    public void init() {
    for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
    P p = new P(i, j);
    o.addObserver(p);
    // todo : need to subclass for the Observable ??
    // otherwise , how to set changed to true ?
    public void start(int x, int y) {
    o.change();
    o.notifyObservers(new Point[] {new Point(x, y)});
    package guess10;
    import java.util.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class PObservable
    extends Observable {
    public PObservable() {
    super();
    public static void main(String[] args) {
    PObservable PObservable1 = new PObservable();
    public synchronized void change() {
    this.setChanged();
    public synchronized boolean exist(P p) {
    return v.contains(p);
    private Vector v = new Vector();
    public synchronized void addObserver(Observer o) {
    super.addObserver(o);
    v.add(o);
    public synchronized void deleteObserver(Observer o) {
    super.deleteObserver(o);
    v.remove(o);
    package guess10;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Point {
    public Point() {
    public Point(int x, int y) {
    this.x = x;
    this.y = y;
    public static void main(String[] args) {
    Point point1 = new Point();
    int x;
    int y;
    package guess10;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Guess10 {
    public Guess10() {
    public static void main(String[] args) {
    Guess10 guess101 = new Guess10();
    guess101.start();
    public void start() {
    PLayout pl = new PLayout();
    pl.init();
    int x = 0;
    int y = 0;
    java.util.Random random = new java.util.Random(System.currentTimeMillis());
    x = random.nextInt(10);
    y = random.nextInt(10);
    pl.start(x, y);
    // try {
    // x = System.in.read();
    // y = System.in.read();
    // catch (IOException ex) {
    // ex.printStackTrace();
    // if(!isDigit(x) | !isDigit(y)) {
    // System.out.println("Not correct number! " + x + " " + y);
    // System.exit(1);
    // pl.start(x-'0',y-'0');
    static boolean isDigit(int ch) {
    return ( (ch - '0') | ('9' - ch)) >= 0;
    package guess10;
    import java.io.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Out {
    public Out() {
    public static void main(String[] args) {
    Out out1 = new Out();
    public static final PrintStream out = System.out;
    public static void print(PLayout playout) {
    the package guess10.gui
    package guess10.gui;
    import java.awt.*;
    import javax.swing.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class F
    extends JFrame {
    public static F instance = new F();
    public F() {
    super("O G");
    init();
    setVisible(true);
    private Grid[] ps = new Grid[100];
    public Grid getGrid(int x, int y) {
    return ps[x * 10 + y];
    public void init() {
    Container con = this.getContentPane();
    con.setLayout(new java.awt.GridLayout(10, 10));
    for (int i = 0; i < 10; i++) {
    for (int j = 0; j < 10; j++) {
    con.add(ps[i * 10 + j] = new Grid());
    setSize(400, 400);
    this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    public static void main(String[] args) {
    F f1 = new F();
    f1.getGrid(4, 3).setBackground(Color.yellow);
    package guess10.gui;
    import java.awt.*;
    import javax.swing.*;
    * <p>Title: </p>
    * <p>Description: </p>
    * <p>Copyright: Copyright (c) 2005</p>
    * <p>Company: </p>
    * @author not attributable
    * @version 1.0
    public class Grid
    extends JPanel {
    public Grid() {
    super();
    this.setBorder(BorderFactory.createEtchedBorder());
    // this.add(new javax.swing.JTextField("777"));
    public static void main(String[] args) {
    Grid grid1 = new Grid();
    public void action() {
    try {
    Thread.currentThread().sleep(100);
    catch (InterruptedException ex) {
    // this.setBackground(Color.yellow);
    this.setBackground(new Color(r--, g--, b++));
    // add(new javax.swing.JLabel(Thread.currentThread().getName()+" "+count++));
    // this.validate();
    private static int r = 255;
    private static int g = 230;
    private static int b = 128;
    private static int count = 0;

    copy the java file into notepad, and save to .java file,
    then javac guess10\*.java file to compile, and java guess.Guess10 to run , then can see the gui's output,
    Only you see the gui's output, you can understand what i describe.
    Only seeing the source will not found the reason of the problem, it's need to run indeedly.
    is there anyone to try that ?

  • JDeveloper 10g (10.1.3.3.0) GUI Buldier problems

    Hi there,
    I am running JDeveloper on several platforms (Windows XP Pro SP 2, Ubuntu Linux, Mac OS 10 Leopard), but all of them manifest this problem.
    I am designing a Swing Application.
    When I load the source code for a given class I click the Design tab to bring up the graphical representation of my component (in this case, a JPanel).
    In some cases this works fine. The component comes up in the main window, and I can graphically edit it.
    In other cases, it comes up with a blank screen which says: "No GUI Selected. Double click on an item in the Structure Window to see its GUI here.". I double click the item as instructed, but nothing changes in the main window.
    Can someone tell me exactly what JDeveloper is doing behind the scenes to facilitate this graphical GUI builder?
    Does it just instantiate the object using the default constructor?
    Does it save the layout somewhere?
    Does it parse the layout from the java file?
    Does it compile a separate version to render, or does it use the generated .class files?
    This is really frustrating. I had a lucky spell where 10 out of 10 JPanels I was designing would render correctly, but now some of them have this problem.
    What changes am I making to my source code to break the graphical visual editor?
    Thanks,
    Allen

    I have the same problem and I noticed some things in previous approaches, because the problem occured more than once.
    Last year I noticed that the problem occured, because I changed to JDK 1.6 (project java version, not the one running JDeveloper itself). The solution was that I had to clean all .class files (with an ant-Task) and all worked fine, but Inner Class-GUI-Objects. These are ASFAIK not supported.
    Now more than 6 months later I noticed that somehow old source code is working and displaying fine, but whenever I make an update to a newer revision the visual editor behavious like you said. (I am using subversion).
    This thing is strange, but anyway I managed to find out, that JDeveloper uses the method jbInit() to initialize the GUI and that other methods like doSomeMoreInit() will not be executed. So one approach was also do create postJbInit() methods, but somehow I am stuck now.
    Maybe this can help you with your problem, but I have to research a little bit.

  • AppleScript GUI scripting problem.

    Hi All,
    I've created a script that will automatically open new document in Indesign CS2. But when i run the script i'm getting system events error as "NSReceiverEvaluationScriptError: 4". I tried following the instruction given in forums but still couldn't figure out. Below is the script i wrote. Can any one tell where and what i'm missing.
    tell application "Adobe InDesign CS2" to activate
    tell application "System Events"
    tell process "Adobe InDesign CS2"
    tell menu bar 1
    tell menu bar item "File"
    tell menu "File"
    tell menu item "New"
    tell menu "New"
    click menu item "Document"
    end tell
    end tell
    end tell
    end tell
    end tell
    click button "Ok" of window 1
    end tell
    end tell
    This is the submenu of menu New. This might be the problem cos the below script works for for which i'm clicking the menu not sub menu
    tell application "Adobe InDesign CS2" to activate
    tell application "System Events"
    tell application process "Adobe InDesign CS2"
    tell menu bar 1
    tell menu bar item "Help"
    tell menu "Help"
    click menu item "Welcome Screen..."
    end tell
    end tell
    end tell
    end tell
    end tell
    My Mac version 10.4.10
    Any help would be appreciated.
    -Jacintha

    Using GUI scripting is the road to madness; it's for emergency use only.<br />Try:<br /><br />tell application "Adobe InDesign CS2"<br />make document<br />end tell<br /><br />-- <br />Shane Stanley <[email protected]>

  • Trying to create multithreading problems when opening file dialog

    Warning: Newbie to Labview...
    I have a problem in a rather complicated VI where bringing up the open file dialog halts some background operations.
    I would really like to reproduce this behaviour for various reasons, but am unable to. I've created a simple VI with a for-loop where the index feeds a sine converter which in turn feeds a tank indicator. This produces an oscillating behaviour. To this VI I've added a file dialog control.
    Regardless of the multithreading setup, I'm unable to get the oscillating of the tank indicator to stop when the dialog is open. Is there something I can do to get this behaviour? I realize it's unusual to try to break things, but it is rather important for me.
    Tha
    nk you,
    Nigel

    Hi,
    The for loop (all loops by the way) is halted until everything in it is
    finished.
    Try this:
    + Make a while loop
    + wire TRUE to the stop criterium.
    + Put an indicator on the 'I'.
    + Put a MS Wait in it (e.g. 80 ms), to prevent 100% processor time.
    Run it, and the indicator will increase fast.
    Now put any dialog in the while loop. E.g. a message box.
    The indicator will increase everytime you press 'OK'.
    Note: stop by pressing CTRL+. and clicking 'OK' several times.
    Regards,
    Wiebe.
    "N Cook" wrote in message
    news:[email protected]..
    > Warning: Newbie to Labview...
    >
    > I have a problem in a rather complicated VI where bringing up the open
    > file dialog halts some background operations.
    >
    > I would real
    ly like to reproduce this behaviour for various reasons,
    > but am unable to. I've created a simple VI with a for-loop where the
    > index feeds a sine converter which in turn feeds a tank indicator.
    > This produces an oscillating behaviour. To this VI I've added a file
    > dialog control.
    >
    > Regardless of the multithreading setup, I'm unable to get the
    > oscillating of the tank indicator to stop when the dialog is open. Is
    > there something I can do to get this behaviour? I realize it's unusual
    > to try to break things, but it is rather important for me.
    >
    > Thank you,
    > Nigel

  • ACE Web GUI Interesting Problem

    I have a very strange issue with the ACE web GUI interface. I have 2 ACE's that are in Active/Standby setup with a floating management IP address for each context. Now when I try to login to the Web interface with the Floating Mgmt. IP address for one of my contexts it always takes me to the Admin context and not the one I am trying to hit. I did some testing and I found it does this with every context when you try to login to the Web interface using the floating IP address. If I use one of the real IP's of an individual ACE I am able to get logged into the correct context. Has anybody else run into this? Is there something I can do to fix it? Also I noticed that when you login to the web interface using that same floating IP address it always passes RADIUS requests as the Admin context IP address as well.

    I don't see this problem with version A3(2.x)
    This was fixed with CSCso98451
    G.

  • Studio Management GUI Rendering Problem - Windows 8.1

    I've got a problem that I can't seem to find the solution to anywhere.  I recently purchased a new computer with Windows 8.1 and am having trouble with SQL Express 2012.  The GUI rendering within the Server Management Studio seems to be really
    messed up.  Any help would be much appreciated.  I've updated everything I can think of (Windows, SQL Express, video drivers, etc) to no avail.  
    Biggest problem initially is that when I go through the "Restore Database" process windows are not showing correctly.  Such as the dialog box where I go find my database backup file - there are no files listed - it is just a blank dialog box.
    Any help or ideas would be greatly appreciated.  Thanks in advance.
    (I would post some screenshots but I'm waiting for my account to be verified)

    Hi JaredBaszler,
    According to your description, when you install SQL Server 2012 Express on Windows 8, the SQL Server Management studio dialogs could not displayed clearly. We need to verify if there is the third party software or antivirus software in your Server.
     In addition, if your Windows Server works in high-DPI displays. There is detail about
    living a High-DPI desktop
    As you post, we recommend you install SQL Server 2012 on a clean machine, and check if the same error exists, if yes, the installation media 
    may be encountered some changes. And you can download the media again in Microsoft websites and reinstall again. If it display 
    normally in your new machine, reinstall again on your original computer.
    Regards,
    Sofiya Li
    Sofiya Li
    TechNet Community Support

  • Cisco 881W - ap gui interface problem

    We have a new Cisco 881W wireless router;
    used the CP Express gui interface to perform initial setup;
    router assigned 10.10.10.3 as wireless ap gui interface;
    when entering ap gui the entire screen is blank expect for an "enter" button near bottom;
    clicking on this button does nothing; "error on page" is indicated on IE8 status;
    assigned SSID is not broadcasting

    Hi !!
    im the same problem , but i fix it
    first you must change the IOS version to ap801-k9w7-tar.124-10b.JDA3 ( you can dowload for the cisco web )
    after download the image file you putt this command in the ap exec mode:
    ap#archive download-sw /overwrite /force-reload tftp://x.x.x.x/ap801-k9w7-tar.124-10b.JDA3.tar
    after the files are copied to flash memmory , the routyer boots with the new image ang bug fixed
    its is my configuration working: 
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Current configuration : 3267 bytes
    version 12.4
    no service pad
    service timestamps debug datetime msec
    service timestamps log datetime msec
    service password-encryption
    hostname ap
    enable secret 5 $1$T0Qk$/wKGmrwqo0WcBbvTapaNb.
    no aaa new-model
    dot11 ssid CASIO
       vlan 1
       authentication open
       authentication key-management wpa
       guest-mode
       wpa-psk ascii 7 121A04041B04010132222727
    crypto pki trustpoint TP-self-signed-4051168682
    enrollment selfsigned
    subject-name cn=IOS-Self-Signed-Certificate-4051168682
    revocation-check none
    rsakeypair TP-self-signed-4051168682
    crypto pki certificate chain TP-self-signed-4051168682
    certificate self-signed 01
      3082023A 308201A3 A0030201 02020101 300D0609 2A864886 F70D0101 04050030
      31312F30 2D060355 04031326 494F532D 53656C66 2D536967 6E65642D 43657274
      69666963 6174652D 34303531 31363836 3832301E 170D3131 30383139 31303037
      33385A17 0D323030 31303130 30303030 305A3031 312F302D 06035504 03132649
      4F532D53 656C662D 5369676E 65642D43 65727469 66696361 74652D34 30353131
      36383638 3230819F 300D0609 2A864886 F70D0101 01050003 818D0030 81890281
      8100B090 26BE5E77 FCB338C0 F54949DB 43EF95C1 61A9C3FA 38AC8BDC 18931195
      B1B1A503 65A71B68 8940639A FB6A6D9B 0F327B09 F5C48ECD 89C1B279 9DC6DC98
      11E5D014 914200BB 7F29CFD1 1CC5FDF0 F3AFE547 4954E2CA 37FC1CEC 60641871
      D9949391 35C958B3 FBA6FBF7 116612FD DFAB9467 478A6E07 0F7B2616 F1204158
      EC510203 010001A3 62306030 0F060355 1D130101 FF040530 030101FF 300D0603
      551D1104 06300482 02617030 1F060355 1D230418 30168014 1120DB6C BE01CDEE
      64A2DB14 FA240B27 D3573B9B 301D0603 551D0E04 16041411 20DB6CBE 01CDEE64
      A2DB14FA 240B27D3 573B9B30 0D06092A 864886F7 0D010104 05000381 81003B69
      8FC11090 E61D3BC1 D04FBDC5 622E8BC6 EB63B9FA C795BB15 BB05F417 CFC51F09
      A8A1971E 7E523203 5A40654D B71623CB A48B193A 101FD1AD 868128E9 91940B71
      5CFDDDD4 856B8170 7700C656 A75443DF DBB60F06 67E37A70 69175B84 24AB0380
      221AAA1D 3EB80465 FD1C1F49 B75B0F1D BC4A82B2 EB2176F2 27F54894 5E94
      quit
    username Cisco password 7 106D000A0618
    username ivan privilege 15 secret 5 $1$eEHQ$Dc.dDfXJz2fBbPIGhH.zg1
    bridge irb
    interface Dot11Radio0
    no ip address
    no ip route-cache
    encryption vlan 1 mode ciphers tkip
    ssid CASIO
    speed  basic-11.0 basic-12.0 basic-18.0 basic-24.0 basic-36.0 basic-48.0 basic-54.0
    station-role root
    interface Dot11Radio0.1
    encapsulation dot1Q 1 native
    no ip route-cache
    bridge-group 1
    bridge-group 1 subscriber-loop-control
    bridge-group 1 block-unknown-source
    no bridge-group 1 source-learning
    no bridge-group 1 unicast-flooding
    bridge-group 1 spanning-disabled
    interface GigabitEthernet0
    description  the embedded AP GigabitEthernet 0 is an internal interface connecting AP with the host router
    no ip address
    no ip route-cache
    interface GigabitEthernet0.1
    encapsulation dot1Q 1 native
    no ip route-cache
    bridge-group 1
    no bridge-group 1 source-learning
    bridge-group 1 spanning-disabled
    interface BVI1
    ip address 192.168.10.5 255.255.255.0
    no ip route-cache
    ip http server
    ip http authentication local
    ip http secure-server
    ip http help-path http://www.cisco.com/warp/public/779/smbiz/prodconfig/help/eag
    bridge 1 route ip
    line con 0
    no activation-character
    line vty 0 4
    login local
    end
    +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    now you cant acces to ap web gui 
    thanks !!!

  • Socket and multithreading problem (flow control)

    This code is heavily influenced by the KKMultiServerThread. I am having problems controlling the thread flow.
                 login = new MultiServerThreadLogin(serverSocket.accept(), serverSocket);
            login.start();     
              while(true){
                 System.out.println(login.getAuthen());
                 while(login.getAuthen()){
                      System.out.println("doing hello");
                      hello = new KKMultiServerThread(serverSocket.accept(), serverSocket);
                      hello.start();
                      if(hello.getFlag())
                      break;
              }here, you can see that i am trying to start a thread to login the user and then recieve files from the cilent. When my GUI runs, there is no problem whatsoever that is for the 1st time, however when i try running the 2nd time, the code as u can see, doesnt allow that... so is there anyway to break away from the inner loop?

    hey thanks for replying... i'm sorry but in a rush here...
    this snippet resides in the server. There are 2 classes, namely MultiServerLoginThread and KKMultiServerThread, both extends Thread.
    The function of the MultiServerLoginThread is to read in bytes of Secretkey, username(encrypted) and password(encrypted). This should only take place once.
    The function of theother thread, KKMultiServerThread is to read in the file name to be transferred and the contents. This is based on the KKMultiServerThread which can be found somewhere in this forum... i hope...
    The KKMultiServerThread is started over and over because the client is sending multiple files. Hence the while loop. However after sending the last file, it should go to the MultiServerLoginThread....
    One thing i don't really get it is that if i were to do this(put the creation of the login thread within the while loop):
    while(true){
                 System.out.println(login.getAuthen());
                 login = new MultiServerThreadLogin(serverSocket.accept(), serverSocket);
            login.start();
                 while(login.getAuthen()){
                      System.out.println("doing hello");
                      hello = new KKMultiServerThread(serverSocket.accept(), serverSocket);
                      hello.start();
                      if(hello.getFlag())
                      break;
              }The GUI totally hangs.
    More explanation...
    hello.getFlag() returns the flag when the client has finished sending all the files
    login.getAuthen() returns whether the user has successfully logged in with correct creditials

  • GUI standard problem...

    i have a Jframe containing nested jsplitpane's divided as follows:
    | | |
    | |____|
    | | |
    |__|____|
    the left JSplit pane consists of the a JTree inside a JScrollPane and the right JPlitPane. The right JSplitPane consists of a JList in a JScrollPane in the top and a JTextPane in a JScrollPane in the bottom. On clicking an element in the JTree the JList alters and on clicking an element in the JList the JTextPane alters. the problem i have that when altering the JTextPane with the following code:
    textPane = new JTextPane("SOME TEXT");
    bottomRightScrollPane = new JScrollPane(textPane);
    the JTextPane does not update. I have gone through the root of re-adding all of the 3 components to the JFrame and then calling setVisible(true) which works, but it makes the GUI blink and i am sure there is a clearer, better, easier way of doing this. I have also tried the random adding of repaint() to every component i could find but again to no avail, Any help would be greatly appreciated as to how i can get the bottom right JScrollPane to show the update JTextPane. Thanks in advance.

    thanks again, the setDocument method does work, but unforutnatley i have mouseListeners and hyperlink listeners in the pane that i am overwrtiing the old pane with. Is there anyway to transfer these as well?
    I tried using the revalidate method on the JScrollPane the text pane is in, the textpane itself, the splitpane the scroll pane is in and the split pane the splitpane is in. i also tried doing all of these at the same time but this didn't seem to do anything. Thanks again, if there is no easy solution do not worry since i can use the setVisible() method i have been using as it does the job, if in a somewhat ugly fashion.

  • GUI freeze problem

    Hi everyone, im having a new problem with my sockets, i want to implement a button to stop server but because its client/server architecture it is freezed, how can i separate interface, please help :S

    Like you say hiwa maybe the problems is the client, i posted in other post, but is not problem to post it again, thanks!!!
    import java.net.*;
    import java.io.*;
    public class RecivirArchivoEncriptado2{
      String fileCharSet;
      String separator;
      Socket clientsocket;
      BufferedReader socketInput;
      String s;
      public RecivirArchivoEncriptado2(){
        fileCharSet = "UTF-8";
        separator = "##$##$##";
        try {
          clientsocket = new Socket("127.0.0.1", 12349);
          socketInput = new BufferedReader
           (new InputStreamReader(clientsocket.getInputStream(), fileCharSet));
        catch (Exception e){
          e.printStackTrace();
       public void doFileGet(){
        try{
          PrintWriter fileOutput
           = new PrintWriter(new FileOutputStream("archivoEncriptado.txt"), true);
          while ((s = socketInput.readLine()) != null){
            if (s.equals(separator)){
              break;
            fileOutput.println(s);
          fileOutput.close();
          fileOutput.flush();
          System.out.println("archivo encriptado recivido");
          fileOutput
           = new PrintWriter(new FileOutputStream("archivoPlano.txt"), true);
          while ((s = socketInput.readLine()) != null){
            fileOutput.println(s);
          fileOutput.flush();
          fileOutput.close();
          System.out.println("archivo plano recivido");
          socketInput.close();
          clientsocket.close();
        catch(IOException e) {
          System.out.println("conection refused port 12345");
      }}

  • GUI update problem: button take time to be disabled

    I have a Stop button. In the actionPerformed() method for the button, I disable the button and also some other buttons (using setEnabled(false)) then there are some other codes that include Thread.sleep() method. Then again I enable some other buttons. Problem is the Stop button take time to be disabled. The time exactly equals sec provided in the sleep() method. I tried by puting the button disabling buttons' code in another thread that is called from SwingUtilies.invokeLater() method just before the sleep() method. It is very important to disable some buttons before Thread.sleep() is called. And only after the sleep() method I can enable some other buttons.
    Please help me.

    Hello Experts! I can't hear you. 1) Swing related questions should be posted in the Swing forum
    2) Quit bumping your question, you only posted it 30 minutes ago. People will answer when they have the time.
    Your code in the actionListener needs to be executed in a separate Thread, so that when you invoke the "sleep" method the separate Thread sleeps, not the Event Thread.

  • WLC 2112 GUI Connection problem

    I am not able to connect to the GUI on the Cisco Wireless Controller 2112.  I noticed from the interface summary that the "GU" (GUI?) are all "No" on both the management and ap-manager interfaces.  How to set them to "Yes" from the console (CLI)?
    Thanks.
    <<<<System Info>>>>
    (Cisco Controller) >show interface summary
    Interface Name         Port Vlan Id  IP Address       Type     Ap Mgr Gu
    est
    ap-manager         1     untagged 10.1.4.62  Static  Yes     No
    management         1     untagged 10.1.4.61  Static  No      No
    virtual        N/A  N/A       1.1.1.1      Static  No      No
    (Cisco Controller) > show network summary
    RF-Network Name............................. RFGroup
    Web Mode.................................... Enable
    Secure Web Mode............................. Enable
    Secure Web Mode Cipher-Option High.......... Disable
    Secure Web Mode Cipher-Option SSLv2......... Enable
    Secure Shell (ssh).......................... Enable
    Telnet...................................... Enable
    Ethernet Multicast Mode..................... Disable
    Ethernet Broadcast Mode..................... Disable
    AP Multicast Mode........................... Multicast   Address : 0.0.0.0
    IGMP snooping............................... Disabled
    IGMP timeout................................ 60 seconds
    User Idle Timeout........................... 300 seconds
    ARP Idle Timeout............................ 300 seconds
    Cisco AP Default Master..................... Disable
    AP Join Priority............................ Disable
    Mgmt Via Wireless Interface................. Disable
    Mgmt Via Dynamic Interface.................. Enable
    Bridge MAC filter Config.................... Enable
    Bridge Security Mode........................ EAP
    Mesh Full Sector DFS........................ Enable
    --More-- or (q)uit
    Over The Air Provisioning of AP's........... Disable
    AP Fallback ................................ Enable
    Web Auth Redirect Ports .................... 80
    Fast SSID Change ........................... Disabled
    (Cisco Controller) > show run-config
    Interface Configuration
    Interface Name................................... ap-manager
    MAC Address...................................... 70:81:05:af:1d:20
    IP Address....................................... 10.1.4.62
    IP Netmask....................................... 255.255.252.0
    IP Gateway....................................... 10.1.2.1
    VLAN............................................. untagged 
    Physical Port.................................... 1
    Primary DHCP Server.............................. 10.1.2.1
    Secondary DHCP Server............................ Unconfigured
    DHCP Option 82................................... Disabled
    ACL.............................................. Unconfigured
    AP Manager....................................... Yes
    Guest Interface.................................. No
    Interface Name................................... management
    MAC Address...................................... 70:81:05:af:1d:20
    IP Address....................................... 10.1.4.61
    IP Netmask....................................... 255.255.252.0
    IP Gateway....................................... 10.1.2.1
    VLAN............................................. untagged 
    Quarantine-vlan.................................. 0
    Physical Port.................................... 1
    Primary DHCP Server.............................. 10.1.2.1
    Secondary DHCP Server............................ Unconfigured
    DHCP Option 82................................... Disabled
    ACL.............................................. Unconfigured
    AP Manager....................................... No
    Guest Interface.................................. No
    Interface Name................................... virtual
    MAC Address...................................... 70:81:05:af:1d:20
    IP Address....................................... 1.1.1.1
    DHCP Option 82................................... Disabled
    Virtual DNS Host Name............................ Disabled
    AP Manager....................................... No
    Guest Interface.................................. No

    Port 30 detail Info:
    GigabitEthernet0/30 is up, line protocol is up (connected)
      Hardware is Gigabit Ethernet, address is 0c85.25d4.a91e (bia 0c85.25d4.a91e)
      MTU 1500 bytes, BW 100000 Kbit, DLY 100 usec,
         reliability 255/255, txload 1/255, rxload 1/255
      Encapsulation ARPA, loopback not set
      Keepalive set (10 sec)
      Full-duplex, 100Mb/s, media type is 10/100/1000BaseTX
      input flow-control is off, output flow-control is unsupported
      ARP type: ARPA, ARP Timeout 04:00:00
      Last input 00:00:31, output 00:00:00, output hang never
      Last clearing of "show interface" counters never
      Input queue: 0/75/0/0 (size/max/drops/flushes); Total output drops: 0
      Queueing strategy: fifo
      Output queue: 0/0 (size/max)
      5 minute input rate 0 bits/sec, 0 packets/sec
      5 minute output rate 0 bits/sec, 0 packets/sec
         6841 packets input, 2789942 bytes, 0 no buffer
         Received 3461 broadcasts (3042 multicasts)
         18549 runts, 0 giants, 0 throttles
         18549 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored
         0 watchdog, 3042 multicast, 0 pause input
         0 input packets with dribble condition detected
         383015 packets output, 66928405 bytes, 0 underruns
         0 output errors, 0 collisions, 5 interface resets
         0 babbles, 0 late collision, 0 deferred
         0 lost carrier, 0 no carrier, 0 PAUSE output
         0 output buffer failures, 0 output buffers swapped out
    Interface summary
    *: interface is up
    IHQ: pkts in input hold queue     IQD: pkts dropped from input queue
    OHQ: pkts in output hold queue    OQD: pkts dropped from output queue
    RXBS: rx rate (bits/sec)          RXPS: rx rate (pkts/sec)
    TXBS: tx rate (bits/sec)          TXPS: tx rate (pkts/sec)
    TRTL: throttle count
      Interface               IHQ   IQD  OHQ   OQD  RXBS RXPS  TXBS TXPS TRTL
    * Vlan1                    0 12861    0     0     0    0     0    0    0
      GigabitEthernet0/1       0     0    0     0     0    0     0    0    0
    * GigabitEthernet0/2       0     0    0     0     0    0  2000    1    0
      GigabitEthernet0/3       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/4       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/5       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/6       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/7       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/8       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/9       0     0    0     0     0    0     0    0    0
      GigabitEthernet0/10      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/11      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/12      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/13      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/14      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/15      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/16      0     0    0 7219768     0    0     0    0    0
      GigabitEthernet0/17      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/18      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/19      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/20      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/21      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/22      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/23      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/24      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/25      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/26      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/27      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/28      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/29      0     0    0     0     0    0     0    0    0
    * GigabitEthernet0/30      0     0    0     0     0    0  2000    2    0
      GigabitEthernet0/31      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/32      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/33      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/34      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/35      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/36      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/37      0     0    0 4997649     0    0     0    0    0
      GigabitEthernet0/38      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/39      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/40      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/41      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/42      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/43      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/44      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/45      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/46      0     0    0     0     0    0     0    0    0
    * GigabitEthernet0/47      0     0    0 5011848     0    0  2000    2    0
      Interface               IHQ   IQD  OHQ   OQD  RXBS RXPS  TXBS TXPS TRTL
      GigabitEthernet0/48      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/49      0     0    0     0     0    0     0    0    0
      GigabitEthernet0/50      0     0    0     0     0    0     0    0    0
    * GigabitEthernet0/51      0     0    0     0  3000    3  1000    1    0
      GigabitEthernet0/52      0     0    0     0     0    0     0    0    0

  • GUI size problem

    When I run this code the GUI doesn't provide enough space for my buttons. It provides enough room for my JLabels and TextFields, but cut's off the buttons.
    public class ReceivingOrganizer extends JPanel
         private JFrame frame;
         private JPanel jpMain, jpLine1, jpLine2, jpCheckBoxPanel;
         private JLabel jlContainer, jlSeal, jlTopInstruct;
         private JButton find, print;
         private JFormattedTextField ftfContainer, ftfSeal;
         public static void main(String[] args)
              ReceivingOrganizer object = new ReceivingOrganizer();
              object.createGUI();
         public ReceivingOrganizer()
              super(new GridBagLayout());
              GridBagConstraints c = new GridBagConstraints();
              jpMain = new JPanel(new GridBagLayout());
              jpMain.setBorder(BorderFactory.createEmptyBorder(30,30,30,30));
              jlTopInstruct = new JLabel("Enter container number or seal number: ");
              c.gridwidth=GridBagConstraints.REMAINDER;
              jpMain.add(jlTopInstruct, c);
              c.gridwidth= GridBagConstraints.RELATIVE;
              jlContainer = new JLabel("Container: ");
              jpMain.add(jlContainer, c);
              c.gridwidth= GridBagConstraints.RELATIVE;
              ftfContainer = new JFormattedTextField();
              ftfContainer.setColumns(15);
              jpMain.add(ftfContainer, c);
              //ftfContainer.addKeyListener(this);
              c.gridwidth= GridBagConstraints.REMAINDER;
              c.fill=GridBagConstraints.BOTH;
              find = new JButton("Find");
              jpMain.add(find, c);
              //find.setActionCommand("find");
              //find.addActionListener(this);
              c.gridwidth= GridBagConstraints.RELATIVE;
              jlSeal = new JLabel("Seal: ");
              jpMain.add(jlSeal, c);
              ftfSeal = new JFormattedTextField();
              ftfSeal.setColumns(15);
              jpMain.add(ftfSeal, c);
              //ftfSeal.addKeyListener(this);
              c.gridwidth= GridBagConstraints.REMAINDER;
              print = new JButton("Print");
              print.setEnabled(false);
              jpMain.add(print, c);
              //print.setActionCommand("print");
              //print.addActionListener(this);
              jpMain.setMinimumSize(jpMain.getSize());
              add(jpMain, c);
         public void createGUI()
              frame = new JFrame("Receiving Organizer");
              frame.setResizable(true);
              frame.setLocationByPlatform(true);
              frame.setMinimumSize(frame.getSize());
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
              frame.add(new ReceivingOrganizer());
              //Display the window.
              frame.pack();
              frame.setVisible(true);
    }

    Don't use GridBagConstraints.RELATIVE for more than one component in the same row, and then only for the second-last component in the row. Read the API:
    Use RELATIVE to specify that the component's display area will be from gridx to the next to the last one in its row.
    Additionally, before a panel is validated or made visible, its size is zero, so you're effectively setting the minmum size to [0,0] -- not, I'm usre, what you intended to do. Ditto for the JFrame. I've added a couple of sysouts for you to see this for yourself.import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import javax.swing.*;
    public class ReceivingOrganizer extends JPanel {
      private JFrame frame;
      private JPanel jpMain;
      private JLabel jlContainer,  jlSeal,  jlTopInstruct;
      private JButton find,  print;
      private JFormattedTextField ftfContainer,  ftfSeal;
      public static void main(String[] args) {
        SwingUtilities.invokeLater(new Runnable() {
          @Override
          public void run() {
            new ReceivingOrganizer().createGUI();
      public ReceivingOrganizer() {
        super(new GridBagLayout());
        GridBagConstraints c = new GridBagConstraints();
        jpMain = new JPanel(new GridBagLayout());
        jpMain.setBorder(BorderFactory.createEmptyBorder(30, 30, 30, 30));
        jlTopInstruct = new JLabel("Enter container number or seal number: ");
        c.gridwidth = GridBagConstraints.REMAINDER;
        jpMain.add(jlTopInstruct, c);
        c.gridwidth = 1;//GridBagConstraints.RELATIVE;
        jlContainer = new JLabel("Container: ");
        jpMain.add(jlContainer, c);
        c.gridwidth = GridBagConstraints.RELATIVE;
        ftfContainer = new JFormattedTextField();
        ftfContainer.setColumns(15);
        jpMain.add(ftfContainer, c);
        c.gridwidth = GridBagConstraints.REMAINDER;
        //c.fill = GridBagConstraints.BOTH;
        find = new JButton("Find");
        jpMain.add(find, c);
        c.gridwidth = 1;//GridBagConstraints.RELATIVE;
        jlSeal = new JLabel("Seal: ");
        jpMain.add(jlSeal, c);
        c.gridwidth = GridBagConstraints.RELATIVE;
        ftfSeal = new JFormattedTextField();
        ftfSeal.setColumns(15);
        jpMain.add(ftfSeal, c);
        c.gridwidth = GridBagConstraints.REMAINDER;
        print = new JButton("Print");
        print.setEnabled(false);
        jpMain.add(print, c);
        System.out.println("jpMain: " + jpMain.getSize());
        //jpMain.setMinimumSize(jpMain.getSize());
        add(jpMain, c);
        revalidate();
      public void createGUI() {
        frame = new JFrame("Receiving Organizer");
        frame.setResizable(true);
        frame.setLocationByPlatform(true);
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.add(this);
        System.out.println("Before pack: " + frame.getSize());
        //Display the window.
        frame.pack();
        System.out.println("After pack: " + frame.getSize());
        frame.setMinimumSize(frame.getSize());
        frame.setMinimumSize(frame.getSize());
        frame.setVisible(true);
    }db
    edit And you had two instances of ReceivingOrganizer, one instantiated in main(...) and the other in createGUI(). You don't need this, just add the present instance to the frame.
    Edited by: DarrylBurke

Maybe you are looking for

  • Value Mapping  Transport Problem

    Hi All, I hv some value Mapping Values  in my XI Devvelopment system while i am transporting these values to the XI Quality System  all Development values are able to transport but,some values are duplicating.aferter that In  XI Production System new

  • BI Content for Master Data

    I am evaluating the BI Content for Master Data from R/3 system such as business partner, material, etc. However, I can't find the group of standard BI content used for loading these Master data. May you suggest me any links that I can find informatio

  • Encoder Speed with NI 9215 module and cDAQ-9172

    I've a NI cDAQ-9172 with the NI9215 analog input module, and I want to estimate the speed with an optical encoder (OMRON E6A2-CW3C). My approach was, making a comparison with a point in the midle of the high of the signal, ie 4V, making this way

  • Help with full screen

    I have created 5 separate swfs, when i publish them i check off html and full screen. when the menu screen opens it still has the menubar and address bar. when i click on my links to go to the specific section nothing changed. In the menubuilder do i

  • Collapsed Tabular Form Heading when "No data found".

    The ' Collapsed Tabular Form Heading when "No data found" ' problem (speculated to be bug 9893564) is discussed here: {message:id=4419231}. Warning link is out of date. I'm still seeing it in APEX 4.2. I support Kelly's comments "looks like something