Hi All,
I am a new member in this Forum. I need your help please, I did a program n I have a problem in making the radio buttons,checkBox, and Buttons in columns.
I want it to be in this way:
http://i19.photobucket.com/albums/b1...y/Required.jpg
And what I did appeared in this way :
http://i19.photobucket.com/albums/b159/yaraby/Mine.jpg
Here is the code:
//GUIFrame.java
import java.awt.FlowLayout;
import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.SwingConstants;
import javax.swing.Icon;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JTextField;
import javax.swing.JRadioButton;
import javax.swing.ButtonGroup;
import javax.swing.JComboBox;
public class GUIFrame extends JFrame{
private JLabel label1,labelQuality;
private JList list1,list2,list3;
private JCheckBox checkBox1, checkBox2,checkBox3,checkBox4;
private JRadioButton radioButton1,radioButton2,radioButton3;
private JComboBox comboBox;
private JButton button1,button2,button3,button4;
private ButtonGroup radioGroup;
public GUIFrame(){
super("Printer");
setLayout(new FlowLayout());
label1=new JLabel("Printer: MyPrint");
label1.setVerticalTextPosition(SwingConstants.TOP) ;
label1.setHorizontalTextPosition(SwingConstants.LE FT);
add(label1);
Icon img1=new ImageIcon(getClass().getResource("1.gif"));
JLabel labelImg1=new JLabel(img1);
add(labelImg1);
checkBox1=new JCheckBox("Image");
add(checkBox1,BorderLayout.EAST);
checkBox2=new JCheckBox("Text");
add(checkBox2,BorderLayout.SOUTH);
checkBox3=new JCheckBox("Code");
add(checkBox3,BorderLayout.SOUTH);
Icon img2=new ImageIcon(getClass().getResource("2.gif"));
JLabel labelImg2=new JLabel(img2);
add(labelImg2);
radioButton1=new JRadioButton("Selection",false);
radioButton2=new JRadioButton("All",true);
radioButton3=new JRadioButton("Applet",false);
radioGroup=new ButtonGroup();
radioGroup.add(radioButton1);
add(radioButton1);
radioGroup.add(radioButton2);
add(radioButton2);
radioGroup.add(radioButton3);
add(radioButton3);
Icon img3=new ImageIcon(getClass().getResource("1.gif"));
JLabel labelImg3=new JLabel(img3);
add(labelImg3);
button1=new JButton("OK");
add(button1);
button2=new JButton("Cancel");
add(button2);
button3=new JButton("Setup...");
add(button3);
button4=new JButton("Help");
add(button4);
labelQuality=new JLabel("Printer Quality:");
labelQuality.setHorizontalAlignment(SwingConstants .LEFT);
labelQuality.setVerticalAlignment(SwingConstants.B OTTOM);
add(labelQuality);
String comboChoices[]={"High","Medium","Low"};
comboBox= new JComboBox(comboChoices);
comboBox.setMaximumRowCount(2);
add(comboBox);
checkBox4=new JCheckBox("Print to File");
add(checkBox4);
}
}
-------------------------------------------------------------------
//GUIFrameTest.java
import javax.swing.JFrame;
public class GUIFrameTest
{
public static void main(String args[]){
GUIFrame guiFrame=new GUIFrame();
guiFrame.setDefaultCloseOperation(JFrame.EXIT_ON_C LOSE);
guiFrame.setSize(600,400);
guiFrame.setVisible(true);
}
}

