why it shows an empty frame

Discussion in 'Software' started by anusha88, Jun 15, 2009.

  1. anusha88

    anusha88

    Joined:
    Jun 15, 2009
    Messages:
    1
    im new to java programming.it does not show any runtime or compile time errors.but it shows an empty frame.can you help what is wrong with this code.


    import java.io.*;
    import java.awt.*;
    import java.awt.geom.*;
    import java.awt.geom.Arc2D.*;
    import javax.swing.*;

    import java.awt.AlphaComposite;
    import java.awt.Color;
    import java.awt.Composite;
    import java.awt.Container;
    import java.awt.Font;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.RenderingHints;
    import java.awt.geom.Rectangle2D;




    class CDSframe
    {
    public static void main(String args[]) throws IOException{


    JFrame myframe=new JFrame("CDSPLOT");
    //cirarc1 c1=new cirarc1();
    myframe.add(new cirarc1());
    myframe.setLayout(new FlowLayout());
    myframe.setSize(250,250);
    myframe.setVisible(true);
    myframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);



    FileReader f1;
    BufferedReader b1;
    String t;

    try{
    f1=new FileReader(args[0]);
    }
    catch(FileNotFoundException e)
    { System.out.println("file not found");
    return;
    }

    b1=new BufferedReader(f1);

    while((t=b1.readLine())!=null)
    {
    //System.out.println(t);
    String s1=" CDS ";
    int num1=s1.length();
    int num2=t.length();
    for(int i=0;i<num2-num1;i++)
    {//System.out.println(t.regionMatches(i,s1,0,num1));
    if(t.regionMatches(i,s1,0,num1)==true) {
    //System.out.println(t.regionMatches(i,s1,0,num1));
    //System.out.println(t);

    if (t == null) { System.out.println(" null"); }
    StringBuffer strBuff = new StringBuffer();
    char c;
    for (int j = 0; j< t.length() ; j++)
    {
    c = t.charAt(j);
    if (Character.isDigit(c) || c=='.')
    { strBuff.append(c);
    //System.out.println(strBuff.append(c));
    }

    }
    System.out.println(strBuff.toString());
    String str=new String(strBuff.toString());
    StringBuffer strbuff1=new StringBuffer();
    for(int i1=0;i<str.length();i1++)//extracts the upper limit

    {
    char notdot=str.charAt(i1);

    if(notdot!='.')
    {
    strbuff1.append(notdot);
    }
    else
    break;
    }
    String r=new String(strbuff1);
    System.out.println(strbuff1);
    //int y=Integer.parseInt(r);
    //System.out.println(y);


    int pos=str.indexOf('.'); //extracts lower limit
    String nextpart=str.substring(pos+2);
    System.out.println(nextpart);




    }//end of if
    }//end of for

    }//end of while







    }//end of psvm
    }//end of class

    class cirarc1 extends JComponent

    {

    final double X_CENTER = 640 / 2;
    final double Y_CENTER = 480 / 2;

    public void paint(Graphics g)
    {
    Graphics2D g2=(Graphics2D)g;
    float angle, numPix;
    double radius = 200.0f;
    int x, y;

    /* number of pixels determines how much to increase angle for each pixel plotted */
    numPix = 1000000;

    //double angInc[]={4.507,3.598,2.0903,1.9870};
    int circum=800;
    double angInc[]=new double[4];
    double angw;
    int len[]=new int[800];
    int lenw;
    int xarr[]={1,15150,193500,3014000};
    int yarr[]={13740,180200,3014000,3886000};
    for(int i=0;i<xarr.length;i++)
    {
    len=yarr-xarr;


    angInc = (float) ((2.0 * Math.PI /numPix)*len);
    }

    Color clr[]={Color.red,Color.blue,Color.green,Color.yellow};

    // g.drawLine(X_CENTER, Y_CENTER, X_CENTER, Y_CENTER);
    double startang=0.0;
    for(int i=0;i<xarr.length;i++)
    {
    Arc2D.Double a=new Arc2D.Double();
    a.setArcByCenter(X_CENTER,Y_CENTER,radius,startang,angInc,0);
    g2.setColor(clr);
    g2.draw(a);
    startang=angInc;


    if(i!=xarr.length-1)
    {if(xarr[i+1]!=yarr)
    {lenw=xarr[i+1]-yarr;
    angw=(float)((2.0*Math.PI/numPix)*lenw);
    g2.setColor(Color.white);
    Arc2D.Double b=new Arc2D.Double();
    b.setArcByCenter(X_CENTER,Y_CENTER,radius,startang,angw,0);
    g2.draw(b);
    startang=angw;


    }
    }






    }//end for

    }//end of paint













    }//end of class
    anusha88, Jun 15, 2009
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wylbur37
    Replies:
    1
    Views:
    1,032
    Jukka Aho
    Nov 6, 2006
  2. Don and Liz Campbell

    1 Frame per second frame capture rate

    Don and Liz Campbell, Mar 24, 2005, in forum: Digital Photography
    Replies:
    4
    Views:
    353
  3. Stuart Reed

    Pix on camera but SD shows folder empty

    Stuart Reed, Jun 21, 2005, in forum: Digital Photography
    Replies:
    2
    Views:
    287
    Stuart Reed
    Jun 22, 2005
  4. asprigoftrig

    view loaded clip frame-by-frame on PC?

    asprigoftrig, Dec 14, 2005, in forum: Digital Photography
    Replies:
    3
    Views:
    682
    asprigoftrig
    Dec 14, 2005
  5. ToyalP2

    DVD Copied but Nero shows empty

    ToyalP2, Feb 11, 2007, in forum: Computer Support
    Replies:
    2
    Views:
    714
    joevan
    Feb 12, 2007
Loading...

Share This Page