This is akin to the previous post because the following code produces "variable hBar cannot be initialized":
final JScrollBar hBar;
final JViewport viewPort = new JViewport() {
{
this.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
hBar.setValues(hBar.getValue(), getExtentSize().width,
0, getViewSize().width);
}
});
}
};
hBar = new JScrollBar(Adjustable.HORIZONTAL) {
{
getModel().addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent e) {
frame.setTitle(getModel().getValue() + "");
}
});
}
};
No comments:
Post a Comment