public class sagum2 {
private static int n1;
private static int[] apw1;
public static void main(String[] args) {
try{
Scanner console = new Scanner(System.in);
sagum2 s = new sagum2();
Graphics g= getGraphics();
char c,c1 = 0,c2=0,c3=0;
int apw1[];
int p[];
int n,n1,ch;
String input;
char ans1, ans, input1;
boolean retry = true;
BufferedReader obj=new
BufferedReader(new InputStreamReader (System.in));
System.out.println("ENTER no. of processes:");
n=Integer.parseInt(obj.readLine());
int bt[]=new int[n];
System.out.println("MENU FOR CPU SCHEDULING");
ch=Integer.parseInt(obj.readLine());
switch(ch) {
case 1:
.....
case 2:
....
case 3:
....
}
} catch (Exception e) {
}
}
private String[] p;
public void paint(Graphics g)
{
for(int j=1;j<=n1;j++)
{
g.drawRect(50,50,(apw1[j]*20),30);
g.drawString("p"+p[j-1],(55+(apw1[j-1]*20)),70);
g.drawString(""+apw1[j-1],50+(apw1[j-1]*20),100);
}
g.drawString(""+apw1[n1],50+(apw1[n1]*20),100);
}
}
我在
中有错误 Graphics g= getGraphics();
说无法找到符号“getGraphics”我已将其更改为
private static Graphics getGraphics() { throw new UnsupportedOperationException("Not supported yet.");
}
我称之为执行扩展小程序以显示甘特图。 请帮助我完成这个项目
答案 0 :(得分:0)
你需要在某处画画:
尝试:
Graphics g = (new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB)).getGraphics();