import java.awt.*;
import statdialog.*;
import statdialog.statistics.*;
public class StatDialogFactoryExample
{
public
static void main(String[] args)
{
String[] st = new String[]
{"Variable 1", "Variable 2", "Variable 3"};
String[] mainPanelTexts = {"
Button v.s. Textfield",
"Button-Textfield 1 ",
"Button-Textfield 2",
"Button-Textfield
3",
" Button
v.s. List",
"Button-List 1",
"Button-List
2"};
int[] mainPanelInd = {0, 1, 1, 1, 0, 2, 2};
String[][] optionalPanelTexts = {
{" A variety of combinations",
"Button-Textfield ",
"Button-List",
"Label-Textfield
",
"Label-Combobox",
"Label-Checkbox"},
{" Label v.s. Textfield",
"Label-Textfield 1",
"Label-Textfield 2",
"Label
v.s. Combobox",
"Label-Combobox 1",
"Label-Combobox 2",
"Label
v.s. Checkbox",
"Label-Checkbox
1",
"Label-Checkbox
2"} };
int[][] optionalPanelInd = { {0, 1, 2, 3, 4, 5},
{0, 3, 3, 0, 4, 4, 0, 5, 5} };
Object[][][] optionalComboboxTexts
=
new Object[][][] { { {"item 1",
"item 2", "item 3"} },
{ {"Blue", "Red"},
{"Sun", "IBM", "Apple",
"Microsoft"} } };
AbstractDialog testDialog = new StatDialogFactory(mainPanelInd,
mainPanelTexts, st).statDialog;
testDialog.requiredArgumentPane.buttonTextfield[0].setText(
"default value");
testDialog.requiredArgumentPane.buttonList[0].setListData(
new Object[] {"Variable 4"});
testDialog.setVisible(true);
testDialog = new StatDialogFactory(
new Frame(), "Demo 1", false,
"Dialog Label",
new String[] {"Main Panel",
"Option A", "Option B"},
mainPanelInd,
mainPanelTexts,
null,
optionalPanelInd,
optionalPanelTexts,
optionalComboboxTexts,
st).statDialog;
testDialog.optionalArgumentPane[0].buttonTextfield[0].setText(
"default value");
testDialog.optionalArgumentPane[0].buttonList[0].setListData(
new
Object[] {"Variable 4", "Variable 5"});
testDialog.optionalArgumentPane[1].labelTextfield[1].
setText("default value");
testDialog.optionalArgumentPane[1].labelCheckbox[1].
setSelected(true);
testDialog.optionalArgumentPane[1].labelCombobox[1].
setSelectedIndex(1);
testDialog.setVisible(true);
new StatDialogFactory().createDialog(mainPanelInd,
mainPanelTexts,
st).setVisible(true);
new StatDialogFactory().createDialog(
new Frame(), "Demo 1", false,
"Dialog Label",
new String[] {"Main Panel",
"Option A", "Option B"},
mainPanelInd,
mainPanelTexts,
null,
optionalPanelInd,
optionalPanelTexts,
optionalComboboxTexts,
st).setVisible(true);
}
}
Results:


