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 8819445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:21:38+00:00 2026-06-14T05:21:38+00:00

I’m having some troubles with Java Swing. I’m trying to make a frame with

  • 0

I’m having some troubles with Java Swing.
I’m trying to make a frame with a control panel at the top with some buttons in it.
and below that i want a JTable to show

I’ve been trying but the table is not showing.
If I remove the controlPanel at the top, it sometimes shows and sometimes not.
The code that I use inside my constructor of my JTable is provided in the same application,
so it’s no network error

public ServerMainFrame(GuiController gc){
    this.gc = gc;
    initGUI();
}

private void initGUI() {
    System.out.println("initiating GUI");
    createFrame();
    addContentPanel();
    addControls();
    //openPopUpServerSettings();
    addSongTable();
}

private void createFrame()
{
    this.setTitle("AudioBuddy 0.1");
    this.setVisible(true);
    this.setDefaultCloseOperation(EXIT_ON_CLOSE);
    this.setSize(800, 600);
    this.setResizable(false);
    this.setLocationRelativeTo(null);
}

private void addContentPanel()
{
    JPanel p = new JPanel();
    p.setLayout(new FlowLayout());
    p.setSize(new Dimension(800, 600));
    this.setContentPane(p);
}

private void addControls()
{
    JPanel controlPanel = new JPanel();
    controlPanel.setLayout(new FlowLayout());
    controlPanel.setBorder(BorderFactory.createLineBorder(Color.black));
    controlPanel.setSize(700,100);

    // Buttons
    JButton play = new JButton("Play");
    JButton pause = new JButton("Pause");
    JButton stop = new JButton ("Stop");
    JButton next = new JButton("Next");
    JButton prev = new JButton("Previous");     
    controlPanel.add(play);
    controlPanel.add(pause);
    controlPanel.add(stop);
    controlPanel.add(next);
    controlPanel.add(prev);

    // Currently playing
    JLabel playing = new JLabel("Currently playing:");
    controlPanel.add(playing);

    JLabel current = new JLabel("Johnny Cash - Mean as Hell");
    controlPanel.add(current);

    this.getContentPane().add(controlPanel);
}

private void addSongTable()
{
    JTable songTable = new JTable(Server.getSongTableModel());
    songTable.setVisible(true);
    JPanel tablePanel = new JPanel();
    tablePanel.setVisible(true);
    tablePanel.add(songTable);
    songTable.repaint();
    this.getContentPane().add(tablePanel);

    JButton btnMulticastList = new JButton("send list to clients");
    btnMulticastList.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {
            Server.MulticastPlaylist();
        }
    });

    getContentPane().add(btnMulticastList);
}
  • 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-14T05:21:40+00:00Added an answer on June 14, 2026 at 5:21 am

    if I remove the controlPanel at the top, it sometimes shows and
    sometimes not.

    • everything is hidden in Server.getSongTableModel(), nobody knows without posting an SSCCE with hardcoded value returns from

    • GUI has issue with Concurency in Swing

    • XxxModel loading data continiously with building GUi, then exception caused described problems

    The code that I use inside my constructor of my JTable is provided in
    the same application, so it’s no network error

    • no idea what you talking about

    • have to create an empty GUI, see InitialTread

    • showing GUI, then to start loading data to JTable

    • then starting Workers Thread (Backgroung Task) from SwingWorker or (descr. Network issue) better Runnable#Thread (confortable for catching an exceptions and processing separate threads)

    • output from Runnable to the Swing GUI must be wrapped into invokeLater()

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace

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.