This is really frustrating.
Whenever I run this, a blank window frame appears
The components only appear when I click the edge of the frame.

Please check if I did something wrong:

import javax.swing.*;
import java.awt.*;


/**
 * 
 */


public class FFGen{
	
	
	public void First(){
		
		/**
		 * @param args
		 */
		JLabel pleaseChooseFFType;
		String[] FlipflopTypes = {"JK", "RS", "D", "T"};; 
		JList FlipflopList;
		
		JLabel pleaseChooseFFNum;
		ButtonGroup FlipflopNumberGroup;
		JRadioButtonMenuItem oneFlipflop;
		JRadioButtonMenuItem twoFlipflop;
		
		JLabel pleaseCheck;
		JCheckBox oneInput;
		JCheckBox oneOutput;
		
		JButton next;
		
		JFrame first;
		JPanel firstConLeft;
		JPanel firstConRight;
	
		FlipflopList = new JList(FlipflopTypes);
		FlipflopList.setVisibleRowCount(1);
		JScrollPane scroller = new JScrollPane(FlipflopList);
		
		pleaseChooseFFType = new JLabel("Type of Flipflop:");
		oneFlipflop = new JRadioButtonMenuItem ("1");
		twoFlipflop = new JRadioButtonMenuItem ("2");
		
		pleaseChooseFFNum = new JLabel("Number of Flipflops:");
		FlipflopNumberGroup = new ButtonGroup();
		FlipflopNumberGroup.add(oneFlipflop);
		FlipflopNumberGroup.add(twoFlipflop);
		
		pleaseCheck = new JLabel("There is an:");
		oneInput = new JCheckBox ("Input");
		oneOutput = new JCheckBox ("Output");
		
		next = new JButton ("Next");
		
		first =  new JFrame();
		first.setSize(250,235);
		first.setVisible(true);
		
		firstConLeft = new JPanel();
		firstConRight = new JPanel();
		firstConRight.setLayout(new GridLayout(9,1,0,0));
		firstConRight.add(pleaseChooseFFType);
		firstConRight.add(scroller);
		firstConRight.add(pleaseChooseFFNum);
		firstConRight.add(oneFlipflop);
		firstConRight.add(twoFlipflop);
		firstConRight.add(pleaseCheck);
		firstConRight.add(oneInput);
		firstConRight.add(oneOutput);
		firstConRight.add(next);
		
		JPanel Empty = new JPanel();
		Empty.setLayout(new GridLayout(1,2));
		Empty.add(firstConLeft);
		Empty.add(firstConRight);
		first.add(Empty);
	}
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		FFGen gui = new FFGen();
		gui.First();
	}

}

Thank you.

It shows up correctly for me without having to click anything. Often, if you need to click, move, resize, or maximize/minimize something for it to show up, you can solve it by using the validate () from the Container class.

http://java.sun.com/javase/6/docs/api/java/awt/Container.html#validate()

But again, I did not have to do this. I was able to see your GUI without doing anything.

It shows up correctly for me without having to click anything. Often, if you need to click, move, resize, or maximize/minimize something for it to show up, you can solve it by using the validate () from the Container class.

http://java.sun.com/javase/6/docs/api/java/awt/Container.html#validate()

But again, I did not have to do this. I was able to see your GUI without doing anything.

I know.. It's weird..
Thanks.. I'll try that now.

Based on the swing Sun example:

public static void main(String[] args) {
        //Schedule a job for the event-dispatching thread:
        //creating and showing this application's GUI.
        javax.swing.SwingUtilities.invokeLater(new Runnable() {

            public void run() {
                //FFGen gui = new FFGen(); 
                new FFGen();
            }
        });
    }

Write constructor for FFGen:

public FFGen() {
        First();
    }

Under Windows XP I have no problem. Same as VernonDozier.
What is your Operating System?

based on the swing sun example:

public static void main(string[] args) {
        //schedule a job for the event-dispatching thread:
        //creating and showing this application's gui.
        Javax.swing.swingutilities.invokelater(new runnable() {

            public void run() {
                //ffgen gui = new ffgen(); 
                new ffgen();
            }
        });
    }

write constructor for ffgen:

public ffgen() {
        first();
    }

under windows xp i have no problem. Same as vernondozier.
What is your operating system?

i am also using xp.
I really can't understand why that happens.i've done other gui interfaces before and they run just fine.
But i just can't figure this one out.

I asked a friend of mine to run it in his computer, and he gets the same result as mine.

Did adding validate () not do anything?

Try moving lines 57 and 58 from where they are to the BOTTOM of the function. Then add:

first.validate ();

at the very bottom of the function. See if that makes a difference. I'm not sure it will, but it's worth a shot.

Did adding validate () not do anything?

Try moving lines 57 and 58 from where they are to the BOTTOM of the function. Then add:

first.validate ();

at the very bottom of the function. See if that makes a difference. I'm not sure it will, but it's worth a shot.

0__0 Thanks. It worked!
Thank you.. >(~__~)<

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.