Note that there are some explanatory texts on larger screens.

plurals
  1. POGUI showing up blank
    primarykey
    data
    text
    <p>Here's my problem. I'm just trying to write a nice little application for a friend for her birthday. The problem is when I ran the program, I get a blank GUI initially. But If I adjust the borders of the window even the slightest bit, the problem appears up like it is supposed to. </p> <p>This only happened after I put in the <code>JTextArea</code>. All that will do is display text. It won't be used for entering text. Any suggestions on what I am doing wrong? I'm I going over the bounds of the <code>JFrame</code>? </p> <p>Thanks for any help.</p> <pre><code>import javax.swing.*; import java.awt.*; public class Birthday { private JFrame mainFrame; private JPanel mainPanel; private JPanel labelPanel; private JPanel buttonPanel; private JButton story; private JButton misc; private JButton next; private JLabel mainLabel; private JFrame miscFrame; private JPanel miscPanel; private JLabel miscLable; private JTextArea text; public Birthday(){ gui(); } public static void main(String [] args){ Birthday b = new Birthday(); } public void gui(){ mainFrame = new JFrame("The Buttercup Project"); //main window mainFrame.setVisible(true); mainFrame.setSize(550,650); //mainFrame.setResizable(false); mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); text = new JTextArea(30,35); mainPanel = new JPanel(); //displays content in window mainPanel.setBackground(Color.YELLOW); mainPanel.setVisible(true); mainPanel.add(text); labelPanel = new JPanel(); labelPanel.setVisible(true); labelPanel.setBackground(Color.LIGHT_GRAY); buttonPanel = new JPanel(); buttonPanel.setVisible(true); buttonPanel.setBackground(Color.LIGHT_GRAY); story = new JButton("Story"); //button misc = new JButton("?"); next = new JButton ("Next Story"); mainLabel = new JLabel("The Buttercup Project"); //label labelPanel.add(mainLabel); //adds buttons to panel buttonPanel.add(story, BorderLayout.CENTER); buttonPanel.add(misc, BorderLayout.CENTER); buttonPanel.add(next, BorderLayout.CENTER); mainFrame.add(labelPanel,BorderLayout.NORTH ); mainFrame.add(buttonPanel, BorderLayout.AFTER_LAST_LINE); mainFrame.add(mainPanel,BorderLayout.CENTER ); //put panel inside of frame } } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload