/*Here is my code as you can see the in front of rice set the four RadioButton in different Location? i have been tired but i can't solve this problem .Help me Please if u can.*/

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

class Fnf{

static Box createBox(String[] sa) {
Box b = new Box(BoxLayout.PAGE_AXIS);
for(int i=0;i<sa.length;++i)
b.add(new JLabel(sa));
return b;
}

public static void main(String[] args) {

Box b1 = createBox(new String[]{"Rice","Butter","Piece"});

JInternalFrame internalFrame1 = new JInternalFrame( "PIZZA Type", true, false, false, false);
internalFrame1.setBounds(5,5,788,200) ;
internalFrame1.setContentPane(b1);
internalFrame1.setVisible(true);
internalFrame1.setBackground(Color.RED);
JPanel panel1=new JPanel();
panel1.setBackground(Color.red);
panel1.setForeground(Color.BLACK);
panel1.setLayout(null);
panel1.add(internalFrame1);
JRadioButton r=new JRadioButton();

internalFrame1.add(new JRadioButton());
internalFrame1.add(r);

JPanel panel=new JPanel();
panel.setBackground(Color.red);
panel.setLayout(null);
panel.add(internalFrame1);

JDesktopPane dtp = new JDesktopPane();
dtp.setBackground(Color.LIGHT_GRAY);
dtp.add(internalFrame1);

JFrame f = new JFrame("DesktopPane");
` f.getContentPane().add(dtp);
f.setSize(1200,900);
f.setResizable(false);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);

}

}

Did you ever checked your code before posting,
change the code as below


internalFrame1.setBounds(5, 5, 788, 200);

JRadioButton r = new JRadioButton("test");
r.setBounds(50, 50, 50, 20);
internalFrame1.add(r);
JRadioButton r1 = new JRadioButton("test1");
r1.setBounds(80,80,60,20);
internalFrame1.add(r1);
internalFrame1.getContentPane().add(b1);
internalFrame1.setVisible(true);
internalFrame1.setBackground(Color.RED);

JPanel panel1 = new JPanel();
panel1.setBackground(Color.red);
panel1.setForeground(Color.BLACK);
panel1.setLayout(null);
panel1.add(internalFrame1);


JDesktopPane dtp = new JDesktopPane();
dtp.setBackground(Color.LIGHT_GRAY);
dtp.add(internalFrame1);

JFrame f = new JFrame("DesktopPane");
f.getContentPane().add(dtp);
f.setSize(1200, 900);
f.setResizable(false);
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.setVisible(true);

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.