Displaying a GUI

I know this seems like it should be very simple. and it should be. However I can't figure out how to do it in IntelliJ..

So I have my main class that creates a new instance of the gui using this code:         gui mainGui = new gui();
I would think this should be all I need, but the gui never shows up.. I have the gui built(the layout anyways, I don't have any listeners yet) and here is the bound class code:

package client;

import javax.swing.*;

public class gui {
    private JPanel mainPanel;
    private JTextField textField1;
    private JTextArea textArea1;
    private JButton sendButton;

    public static void main(String[] args) {
        JFrame frame = new JFrame("gui");
        frame.setContentPane(new gui().mainPanel);

So I can't figure out why it doesn't display the gui, any help is appreciated

Comment actions Permalink

Can you attach related .form file?

Thank you,

Comment actions Permalink

Do you have any exceptions displayed in the console when you try to runn the app?

And,by the way, doublechek your fields are correctly wired to components (see attached screenshot).


Please sign in to leave a comment.