あるクラスから別のクラスに値 t を渡そうとしていますが、プログラムを実行する前に、non static method cannot be referenced from static context
次のコード行から取得します:
t = (PrinterSettings.getT() * 60);
私はこのコードから値 t を取得しようとしています:
public int t = 1; //defualt value for amount of mintues in the future the job should wait untill sent
public int getT() {
return (t);
}
public void setT(int t) {
this.t = t;
}
私は何を間違えましたか?どうすればtを取得できますか
編集 :
t を取得するコード全体
public int t = 1; //defualt value for amount of seconds in the future the job should wait untill sent
public int getT() {
return (t);
}
public void setT(int t) {
this.t = t;
}
そして、これは私が使用しているクラスで、上記のクラスから t を呼び出して使用します:
public class DealyTillPrint {
public int t;
public String CompletefileName;
private String printerindx;
private static int s;
private static int x;
public static int SecondsTillRelase;
public void countDown() {
System.out.println("Countdown called");
s = 1; // interval
t = ((new PrinterSettings().getT()) * 60); //(PrinterSettings.SecondsTillRelase); // number of seconds
System.out.println("t is : " + t);
while (t > 0) {
System.out.println("Printing in : " + t);
try {
Thread.sleep(s * 1000);
} catch (Exception e) {
}
t--;
}
ここでt
、スピナーを使用して設定します
<p:spinner min="1" max="1000" value="#{printerSettings.t}" size ="1">
<p:ajax update="NewTime"/>
</p:spinner>