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.