📄 gaaparams.java
字号:
txt = "True";
else
txt = "False";
}
else
txt = texts[i][j].getText().trim();
txt = fileData.dataFields[k][0] + "=" + txt;
prw.write(txt);
prw.println();
}
}
}
catch (Exception e) {
}
prw.flush();
prw.close();
txt = "Parameters written to file"; //+fil;
ret = MsgDialog.msg("Ok", txt, MsgDialog.MB_OK, 0);
}
}
private Panel makeStatusPanel() {
Panel p = new Panel();
statusLabel = new Label();
Font f = new Font("Helvetica",Font.BOLD,12);
statusLabel.setFont(f);
p.add(statusLabel);
return(p);
}
private void makePanels() {
String name = "";
statusPanel = new Panel();
name = "Integers";
intPanel = new TabNamePanel(name);
intPanel.setTabName(name);
intPanel.setLayout(new GridLayout());
name = "Reals";
reaPanel = new TabNamePanel(name);
reaPanel.setTabName(name);
reaPanel.setLayout(new GridLayout());
name = "Strings";
strPanel = new TabNamePanel(name);
strPanel.setTabName(name);
strPanel.setLayout(new GridLayout());
name = "Flags";
optPanel = new TabNamePanel(name);
optPanel.setTabName(name);
optPanel.setLayout(new GridLayout());
name = "Define Function";
udfPanel = new TabNamePanel(name);
udfPanel.setTabName(name);
udfPanel.setLayout(new GridLayout());
name = "Alleles Definition";
alleleDefPanel = new TabNamePanel(name);
alleleDefPanel.setTabName(name);
alleleDefPanel.setLayout(new GridLayout());
name = "Alleles Mapping";
alleleMapPanel = new TabNamePanel(name);
alleleMapPanel.setTabName(name);
alleleMapPanel.setLayout(new GridLayout());
name = "Strategies";
strategyPanel = new TabNamePanel(name);
strategyPanel.setTabName(name);
strategyPanel.setLayout(new GridLayout());
tab = new TabSplitter();
tab.setName("Tab");
tab.add(intPanel, intPanel.getName());
tab.add(reaPanel, reaPanel.getName());
tab.add(strPanel, strPanel.getName());
tab.add(optPanel, optPanel.getName());
tab.addMouseListener( this );
tab.add(alleleDefPanel, alleleDefPanel.getName());
tab.add(alleleMapPanel, alleleMapPanel.getName());
tab.add(udfPanel, udfPanel.getName());
tab.add(strategyPanel, strategyPanel.getName());
}
private Button[] createButtonArray(String[] titles, Panel panel) {
int i;
Button buts[];
Font f = new Font("Helvetica",Font.BOLD,14);
buts = new Button[titles.length];
for (i=0;i<titles.length;i++) {
buts[i] = new Button(titles[i]);
buts[i].setFont(f);
buts[i].addMouseListener( this );
panel.add(buts[i]);
}
return(buts);
}
private void initInputPanel(int np, Panel panel, Label[] labels, Component[] texts, int num, String title) {
int i;
panel.setLayout(new BorderLayout());
Panel data = new Panel();
data.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
if (num > MAXROWS) {
Panel dummy1 = new Panel();
Panel labels1 = new Panel();
Panel texts1 = new Panel();
Panel dummy2 = new Panel();
Panel labels2 = new Panel();
Panel texts2 = new Panel();
Panel dummy3 = new Panel();
labels1.setLayout(new GridLayout(10,1,5,10));
texts1.setLayout(new GridLayout(10,1,5,10));
labels2.setLayout(new GridLayout(10,1,5,10));
texts2.setLayout(new GridLayout(10,1,5,10));
data.add("1",dummy1);
data.add("4",labels1);
data.add("2",texts1);
data.add("4",dummy2);
data.add("4",labels2);
data.add("2",texts2);
data.add("1",dummy3);
int nhalf = (int) (num/2)+1;
labels1.add(new Label());
texts1.add(new Label());
labels2.add(new Label());
texts2.add(new Label());
for (i=0;i<nhalf;i++) {
labels1.add(labels[i]);
texts1.add(texts[i]);
}
for (i=nhalf;i<num;i++) {
labels2.add(labels[i]);
texts2.add(texts[i]);
}
}
else {
Panel dummy1 = new Panel();
Panel labels1 = new Panel();
Panel texts1 = new Panel();
Panel dummy2 = new Panel();
labels1.setLayout(new GridLayout(10,1,5,10));
texts1.setLayout(new GridLayout(10,1,5,10));
data.add("1",dummy1);
data.add("3",labels1);
data.add("8",texts1);
data.add("1",dummy2);
labels1.add(new Label());
texts1.add(new Label());
for (i=0;i<num;i++) {
labels1.add(labels[i]);
texts1.add(texts[i]);
}
}
Font f = new Font("Helvetica",Font.BOLD,14);
Panel bottom = new Panel();
String butTitles[] = {"Reset","Update","Load","Save","Defaults"};
buttons[np] = createButtonArray(butTitles, bottom);
Label lblTitle = new Label(title, Label.CENTER);
lblTitle.setFont(f);
panel.add("North",lblTitle);
panel.add("Center",data);
panel.add("South",bottom);
}
private void makeDefPanel() {
int i, num = 10;
alleleDefPanel.setLayout(new BorderLayout());
Panel data = new Panel();
data.setLayout(new SplitterLayout(SplitterLayout.VERTICAL));
Panel gap = new Panel();
Panel top = new Panel();
Panel center = new Panel();
Panel bottom = new Panel();
top.setLayout(new FlowLayout(FlowLayout.CENTER));
center.setLayout(new FlowLayout(FlowLayout.CENTER));
bottom.setLayout(new FlowLayout(FlowLayout.CENTER));
data.add("1",gap);
data.add("1",top);
data.add("6",center);
data.add("1",bottom);
defGrid = createDefGrid();
defGrid.addCellListener(this);
center.add(defGrid);
Label topLabel = new Label("Number of alleles (Chromosome length):");
Font f = new Font("Helvetica",Font.BOLD,14);
topLabel.setFont(f);
top.add(topLabel);
textDefNumAlleles = new TextField(5);
top.add(textDefNumAlleles);
String butTitles[] = {"Initialize Table","Copy Selected to All","Save","Defaults"};
defButtons = createButtonArray(butTitles, bottom);
Label title = new Label("Allele Definition", Label.CENTER);
Font ft = new Font("Helvetica",Font.BOLD,14);
title.setFont(ft);
alleleDefPanel.add("North",title);
alleleDefPanel.add("Center",data);
}
private void makeMapPanel() {
int i, num = 10;
alleleMapPanel.setLayout(new BorderLayout());
Panel data = new Panel();
data.setLayout(new SplitterLayout(SplitterLayout.VERTICAL));
Panel gap = new Panel();
Panel top = new Panel();
Panel center = new Panel();
Panel bottom = new Panel();
top.setLayout(new FlowLayout(FlowLayout.CENTER));
center.setLayout(new FlowLayout(FlowLayout.CENTER));
bottom.setLayout(new FlowLayout(FlowLayout.CENTER));
data.add("1",gap);
data.add("7",center);
data.add("1",bottom);
mapGrid = createMapGrid();
mapGrid.addCellListener(this);
center.add(mapGrid);
String butTitles[] = {"Initialize Table","Save","Defaults"};
mapButtons = createButtonArray(butTitles, bottom);
Label title = new Label("Allele Mapping", Label.CENTER);
Font ft = new Font("Helvetica",Font.BOLD,14);
title.setFont(ft);
alleleMapPanel.add("North",title);
alleleMapPanel.add("Center",data);
}
private void makeStrategyPanel() {
int i, num = 10;
Font f = new Font("Helvetica",Font.BOLD,14);
strategyPanel.setLayout(new BorderLayout());
strategyPanel.setFont(f);
Panel data = new Panel();
data.setLayout(new SplitterLayout(SplitterLayout.VERTICAL));
txtString1 = new TextField(50);
txtString2 = new TextField(50);
txtString3 = new TextField(4);
txtString4 = new TextField(4);
txtString5 = new TextField(4);
txtString3.setText(" 0");
txtString4.setText(" 0");
txtString5.setText(" 10");
chcChoice1 = new Choice();
chcChoice2 = new Choice();
chcChoice3 = new Choice();
for (i=0;i<strategies.length;i++) {
chcChoice1.addItem(strategies[i]);
chcChoice2.addItem(strategies[i]);
chcChoice3.addItem(strategies[i]);
}
txtString1.addMouseListener( this );
txtString2.addMouseListener( this );
txtString3.addMouseListener( this );
txtString4.addMouseListener( this );
txtString5.addMouseListener( this );
chcChoice1.addItemListener( this );
chcChoice2.addItemListener( this );
chcChoice3.addItemListener( this );
Panel string1 = new Panel();
Panel string2 = new Panel();
Panel string3 = new Panel();
Panel string4 = new Panel();
Panel string5 = new Panel();
Panel choice1 = new Panel();
Panel choice2 = new Panel();
Panel choice3 = new Panel();
Panel topDummy = new Panel();
Panel botDummy = new Panel();
Panel midDummy1 = new Panel();
Panel midDummy2 = new Panel();
data.add("2",topDummy);
data.add("2",string5);
data.add("2",midDummy1);
data.add("2",choice1);
data.add("2",string1);
data.add("2",string3);
data.add("2",midDummy2);
data.add("2",choice2);
data.add("2",string2);
data.add("2",string4);
data.add("1",botDummy);
string5.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
Panel string5Left = new Panel();
Panel string5Label = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string5Text = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string5Right = new Panel();
string5.add("1",string5Left);
string5.add("4",string5Label);
string5.add("8",string5Text);
string5.add("1",string5Right);
string5Label.add(new Label("Number of rounds/pair:"));
string5Text.add(txtString5);
choice1.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
Panel choice1Left = new Panel();
Panel choice1Label = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel choice1Text = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel choice1Right = new Panel();
choice1.add("1",choice1Left);
choice1.add("4",choice1Label);
choice1.add("8",choice1Text);
choice1.add("1",choice1Right);
choice1Label.add(new Label("Primary Injected Strategy:"));
choice1Text.add(chcChoice1);
string1.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
Panel string1Left = new Panel();
Panel string1Label = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string1Text = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string1Right = new Panel();
string1.add("1",string1Left);
string1.add("4",string1Label);
string1.add("8",string1Text);
string1.add("1",string1Right);
string1Label.add(new Label("Primary Strategy String:"));
string1Text.add(txtString1);
string3.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
Panel string3Left = new Panel();
Panel string3Label = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string3Text = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string3Right = new Panel();
string3.add("1",string3Left);
string3.add("4",string3Label);
string3.add("8",string3Text);
string3.add("1",string3Right);
string3Label.add(new Label("Primary Strategy Percent:"));
string3Text.add(txtString3);
choice2.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
Panel choice2Left = new Panel();
Panel choice2Label = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel choice2Text = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel choice2Right = new Panel();
choice2.add("1",choice2Left);
choice2.add("4",choice2Label);
choice2.add("8",choice2Text);
choice2.add("1",choice2Right);
choice2Label.add(new Label("Secondary Injected Strategy:"));
choice2Text.add(chcChoice2);
string2.setLayout(new SplitterLayout(SplitterLayout.HORIZONTAL));
Panel string2Left = new Panel();
Panel string2Label = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string2Text = new Panel(new FlowLayout(FlowLayout.LEFT));
Panel string2Right = new Panel();
string2.add("1",string2Left);
string2.add("4",string2Label);
string2.add("8",string2Text);
string2.add("1",string2Right);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -