the sun tutorials doesn't include anything on how to extend JDialog to make a dialog like this:

can anyone point me to a tutorial that included this?

my attempts to try making a frame into a dialog result in 100% cpu and infinite loops how do you make the program wait for a user to click a button or something else?

There is a somewhat convoluted example from the Swing tutorial here:
(It's a Java file so you may have to download it)

Here is a simpler, more direct example that I slapped together. Perhaps it will help:

import java.awt.Container;
import java.awt.Frame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JRadioButton;

public class CustomDialog extends JDialog{
    JRadioButton button1;
    JRadioButton button2;
    public CustomDialog(Frame owner){
        // create a modal dialog that will block until hidden
        super(owner, true);
        Container contentPane = getContentPane();
        contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.Y_AXIS));

        button1 = new JRadioButton("First thing");
        button2 = new JRadioButton("Second thing");
        ButtonGroup bGroup = new ButtonGroup();
        JButton btnOk = new JButton("Ok");
        btnOk.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                // This will "close" the modal dialog and allow program
                // execution to continue.
    public String showDialog(){
        // show the dialog
        // this will block until setVisible(false) occurs
        // return whatever data is required
        return button1.isSelected() ? button1.getText() : button2.getText();
    public static void main(String[] args) {
        CustomDialog dialog = new CustomDialog(null);
        String userChoice = dialog.showDialog();
        System.out.println("User chose: "+userChoice);