Answer the question
In order to leave comments, you need to log in
JRadioButton not showing up, what am I missing?
I started making a simple "IQ test" program, started with the interface and stumbled upon such a problem, JRadioButton refuses to be displayed, please tell me what is wrong and where I missed it.
Shitcode attached
public UserInterface(){
setBounds(100,35,500,680);
setResizable(false);
setTitle("IQ test");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JPanel panel = new JPanel();
panel.setLayout(null);
JButton prevQ = new JButton("<<<");
prevQ.setBounds(120, 615, 60, 20);
panel.add(prevQ);
JButton nextQ = new JButton(">>>");
nextQ.setBounds(320, 615, 60, 20);
panel.add(nextQ);
JButton chButton = new JButton("Check Answer");
chButton.setBounds(190, 610, 120, 30);
panel.add(chButton);
JTextField input = new JTextField("Answer here...");
input.setBounds(300, 550, 140, 20);
panel.add(input);
JLabel question = new JLabel("Something");
question.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true));
question.setBounds(10, 10, 475, 70);
panel.add(question);
ButtonGroup group = new ButtonGroup();
JRadioButton radio1 = new JRadioButton("Select 1");
JRadioButton radio2 = new JRadioButton("Select 2");
JRadioButton radio3 = new JRadioButton("Select 3");
JRadioButton radio4 = new JRadioButton("Select 4");
JRadioButton radio5 = new JRadioButton("Select 5");
JRadioButton radio6 = new JRadioButton("Select 6");
radio1.setBounds(250, 450, 0, 0);
radio2.setBounds(250, 430, 0, 0);
radio3.setBounds(250, 410, 0, 0);
radio4.setBounds(250, 390, 0, 0);
radio5.setBounds(250, 370, 0, 0);
radio6.setBounds(250, 350, 0, 0);
group.add(radio1);
group.add(radio2);
group.add(radio3);
group.add(radio4);
group.add(radio5);
group.add(radio6);
panel.add(radio1);
panel.add(radio2);
panel.add(radio3);
panel.add(radio4);
panel.add(radio5);
panel.add(radio6);
JLabel img = new JLabel();
img.setBounds(10, 80, 230, 520);
img.setIcon(new javax.swing.ImageIcon("Снимок.png"));
img.setBorder(new javax.swing.border.LineBorder(new java.awt.Color(102, 102, 102), 1, true));
panel.add(img);
getContentPane().add(panel);
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question