I'm working on a program that plots a mathematical expression like x^2 . the way it works is that the user will enter the range of x (like -10 to 10 ) and then a graph from that range will be drawn. the method by which the graph is drawn looks like this :
Plotter plotterGUI = new Plotter(minX, maxX, frequency, eqFile);
this line (in plotter class) requires me to make minX and maxX fields as static .
link for the whole code (main class is plotter).
and this is the looks of the program: The problem is that when user fills two field for minX and maxX ,then clicks on the set Min/Max button; but , the values of these two field does not change in the graph panel (as you can see in picture it still draws in -10 to 10 range) . this the code for set button's event handler:
btnSetMinmax.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent arg0) {
maxInput = maxxField.getText();
minInput = minxField.getText();
maxX = Double.parseDouble(maxInput);
minX = Double.parseDouble(minInput);
playSlider.setMaximum((int) maxX);
playSlider.setMinimum((int) minX);
playSlider.setValue((int) minX);
}
});
from what I've read on stack overflow I should be able to change static variables' values so why the values doesn't change in here ?
Aucun commentaire:
Enregistrer un commentaire