Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8986905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T21:39:47+00:00 2026-06-15T21:39:47+00:00

The content in the JFrame WaitingFrame doesn’t show up as expected. This is in

  • 0

The content in the JFrame WaitingFrame doesn’t show up as expected. This is in essence what I am trying to do:

package org.brbcoffee.missinggui;

import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Main {
    public static KeynoteServer server;
    public static void main(String[] args){
        JFrame frame = new JFrame("SSCCE");
        JButton btn = new JButton("Test");
        btn.addActionListener(new ActionListener(){
            @Override
            public void actionPerformed(ActionEvent arg0) {
                connectToPhone();
            }
        });
        frame.add(btn);
        frame.pack();
        frame.setVisible(true);
    }
    public static void connectToPhone(){
        WaitingFrame wf = new WaitingFrame();
        wf.setVisible(true);
        server = new KeynoteServer();
        if (server.setup()){
            System.out.println("Server set up and connected");
        } else {
            System.out.println("Couldn't connect");
        }
        wf.dispose();
    }
}   

@SuppressWarnings("serial")
class WaitingFrame extends JFrame {
    public WaitingFrame(){
        setTitle("Waiting");
        this.setLocationByPlatform(true);

        JLabel label = new JLabel("Waiting for client..."); // This will never show
        JPanel content = new JPanel();          
        content.add(label);

        this.add(content);
        pack();
    }
}
class KeynoteServer{
    private int port = 55555;
    private ServerSocket server;
    private Socket clientSocket;

    public boolean setup() {
        try {
            server = new ServerSocket(55555);
            server.setSoTimeout(10000);
            clientSocket = server.accept();
        } catch (IOException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }
}

When setup() is called the WaitingFrame does indeed show up, but the contents are missing. I’ve tried different image formats, but it does work from other methods and classes, so that shouldn’t matter. Does anyone know what’s going on here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T21:39:48+00:00Added an answer on June 15, 2026 at 9:39 pm

    Use SwingUtilities.invokeLater()/invokeAndWait() to show your frame because all the GUI should be updated from EDT.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to print a JFrame using the PrintUtilities Class: package util; import java.awt.*;
I'm trying to make a JFrame with a usable content area of exactly 500x500.
The black is JFrame content and the red one is JPanel's. This happens a
import org.jsoup.Jsoup; @SuppressWarnings({ unused, serial }) public class SimpleWebCrawler extends JFrame implements ActionListener {
I am making the application for printing the content of JFrame .It works properly
Content: 1. Text is here. 20. More text. Why does this Vim search and
Window.Content = Chandru + Guna + Kalai; when i run this program the result
my content post looks like this Content-Disposition: form-data; name=files[]; filename=LICENSE.TXT my asp.net mvc controller
I have Labels and JButtons i want to define the position in JFrame. import
public Hangman(){ Container content =getContentPane(); content.setLayout(new GridLayout(0,1)); btnAddWord.addActionListener(this); btnRestart.addActionListener(this); btnHelp.addActionListener(this); btnExit.addActionListener(this); panel2.add(label); panel3.add(word); panel4.add(btnAddWord);

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.