reference - Java setPreferredSize() by referance -


i attempting create animatable jpanel , coming c have created animator object increments double object this.

i pass in reference preferredsize width of jpanel , have modify width directly. possible? understand java doesn't have references primitive types , if did, changing value may not update view appropriately.

private class animator {     private double value;     private double increment;     private double target;      public animator(double value, double increment, double target) {         this.value = value;         this.increment = increment;         this.target = target;     }      public boolean step() {         value += increment;         if (value >= target) {             value = target;             return false;         }         return true;     } } 

you can't directly, if passing jpanel method option, way. ex:

public static void updatesize(jpanel panel) {     panel.setpreferredsize(new dimension(100, 100)); } 

Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -