Java Reference
In-Depth Information
54.
}
55.
try {
56.
lLiftLabel.setText(
57.
mLift.getLift(lLowerValue, lUpperValue).toString());
58.
lNegativeCasesLabel.setText(""
59.
mLift.getNumberOfNegativeCases(lLowerValue,
60.
lUpperValue));
61.
lPositiveCasesLabel.setText(""
62.
mLift.getNumberOfPositiveCases(lLowerValue,
63.
lUpperValue));
64.
lPercentageSizeLabel.setText(
65.
mLift.getPercentageSize(lLowerValue,
66.
lUpperValue).toString());
67.
lTargetDensityLabel.setText(
68.
mLift.getTargetDensity(lLowerValue,
69.
lUpperValue).toString());
70.
} catch (JDMException e) {
71.
e.printStackTrace();
72.
}
73.
}
74.
};
Every time the graphical interface sends a change event on the
values of a slider, this listener will be activated. It first looks for the
values defined by the user through the two sliders, as shown in lines
42 and 44, and checks for the consistency of these two values (the
upper quantile must be higher than the lower quantile). It then uses
the convenient JDM calls on the lift object to retrieve the statistics
between the two quantiles, as shown in lines 57, 59, 62, 65, and 68.
These methods ease the integration work.
75.
lLowerIndexSlider.addChangeListener(lChangeListener);
76.
lUpperIndexSlider.addChangeListener(lChangeListener);
77.
lLiftDisplayer.add(lNorthPanel, BorderLayout.NORTH);
78.
lLiftDisplayer.add(new JScrollPane(new JTable(new LiftModel())),
79.
BorderLayout.CENTER);
80.
return lLiftDisplayer;
81. }
The last section of the createLiftDisplayer associates the defined
listener to the two sliders, and finishes the graphical layout.
For regression models, we provide code for when the TestMetrics-
Displayer is created with a RegressionTestMetrics object. In this case,
Search WWH ::




Custom Search