Java 动态报告:使用NetBeans显示编译错误

Java 动态报告:使用NetBeans显示编译错误,java,netbeans,dynamic-reports,Java,Netbeans,Dynamic Reports,我从我的NetBeans GUI创建了一个报告,它工作正常,但现在编译器突然显示错误 package dreportsample; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import javax.imageio.ImageIO; import net.sf.dynamicreports.examples.Templates; import net.sf.dyna

我从我的NetBeans GUI创建了一个报告,它工作正常,但现在编译器突然显示错误

package dreportsample;

import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import net.sf.dynamicreports.examples.Templates;
import net.sf.dynamicreports.report.builder.style.StyleBuilder;
import net.sf.dynamicreports.report.constant.HorizontalAlignment;
import net.sf.dynamicreports.report.datasource.DRDataSource;
import net.sf.dynamicreports.report.exception.DRException;
import net.sf.jasperreports.engine.JRDataSource;

/**
 * @author Ricardo Mariaca (dynamicreports@gmail.com)
 */
public class DReportSample {

    public DReportSample() {
        build();
    }

    private void build() {  
            StyleBuilder boldStyle         = stl.style().bold();
            StyleBuilder boldCenteredStyle = stl.style(boldStyle).setHorizontalAlignment
                    (HorizontalAlignment.CENTER).setFontSize(15);
            StyleBuilder footerLeft         = stl.style().setHorizontalAlignment
                   (HorizontalAlignment.LEFT) ;
             StyleBuilder footerRight         = stl.style().setHorizontalAlignment
                   (HorizontalAlignment.RIGHT) ;
            //BufferedImage img = new BufferedImage(1200,1200,BufferedImage.TYPE_INT_RGB);
           BufferedImage img = null;
try {
   // img = ImageIO.read(new File("D:/Hysteresis.png"));
    img = ImageIO.read(new File("D:/Hysteresis.png"));
} catch (IOException e) {
}
       BufferedImage logo = null;
try {
   // img = ImageIO.read(new File("D:/Hysteresis.png"));
    logo = ImageIO.read(new File("D:/Logo.jpg"));
} catch (IOException e) {
}
        try {
            report()//create new report design
                         // .setColumnTitleStyle(boldStyle)
                         // .setColumnStyle(boldStyle)
                          .highlightDetailEvenRows()
              .columns(//add columns

                col.column(null,"Col_1",      type.stringType()),
                col.column(null,"Col_2",  type.stringType())
                                )
                           .summary(
        cmp.verticalList()
            .add(cmp.text("\n\nHYSTERISIS PLOT").setStyle(boldStyle))
            .add(cmp.text("A brief description of what this plot signifies "
                                + "which means that change in are related to"
                                + " pain relief and subsequently"
                                + "should be encouraged \n\n\n\n"))
           // .add(cmp.image(getClass().getResourceAsStream
             //     ("D:/Hysteresis.png")).setFixedDimension(300, 300))


            .add(cmp.image(img).setFixedDimension(400, 300))
            .add(cmp.text("ANALYSIS\n\n\n").setStyle(boldStyle))
            .add(cmp.text("REMARKS\n\n\n\n").setStyle(boldStyle))
            .add(cmp.text("Doctor Signature").setStyle(boldStyle))
    )
              .title(

                                cmp.horizontalList()
                                .add(
                                cmp.image(logo).setFixedDimension(70, 70),
                                cmp.verticalList()
                                .add(
                                cmp.text("Address Line 1").setStyle(boldCenteredStyle),
                                cmp.text("Address Line 2").setStyle(boldCenteredStyle),
                                cmp.text("Address Line 3").setStyle(boldCenteredStyle))
                                )

                                .newRow()
 .add(cmp.filler().setStyle(stl.style().setTopBorder(stl.pen2Point())).setFixedHeight(10))

                                )//shows report title

                              //  .pageFooter(cmp.pageXofY())//shows number of page at page footer
                                .pageFooter(
                                Templates.footerComponent,
                                 //cmp.text("Emsol Software Solution \t\t\t\t\t\t\t\t"
                               // + " copyright: gauravbvelelx@gmail.com")
                                cmp.horizontalList()
                                .add(cmp.text("Emsol Software Solution").setStyle(footerLeft),
                                cmp.text("copyright: gauravbvelex@gmail.com").setStyle(footerRight))
                                )

              .setDataSource(createDataSource())//set datasource
              .show();//create and show report
        } catch (DRException e) {
            e.printStackTrace();
        }
    }
    private JRDataSource createDataSource() {
        DRDataSource dataSource = new DRDataSource("Col_1", "Col_2");

        dataSource.add("Name","Sample");
                dataSource.add("Age","26");
                dataSource.add("Sex","Female");
                dataSource.add("Weight","53 Kg");
                dataSource.add("BMI","20");
                dataSource.add("Massage Duration (Mins)","4.5");
                dataSource.add("RPM","26");
                dataSource.add("Doctor Attended","Doctor");
                dataSource.add("Date","22-Feb-2013");

        return dataSource;
    }   


    public static void main(String[] args) {
        new DReportSample();
    }
}
这段代码在几个小时前运行良好。但现在它突然出现了错误: 附加屏幕截图

它在report()和其他部分也显示了同样的错误。基本上,它无法识别动态报表库的各种类和字段,尽管该库已成功导入,但几个小时前它运行良好

我使用动态报告的方式是添加以下库:

1) Downloaded dynamicreports-3.1.0-project-with-dependencies
2) Unzipped
3) In my Netbeans Project
Libraries -> Add Jar/folder -> Selecting all files from dynamicreports-3.1.0-project-with-dependencies\dynamicreports-3.1.0\lib
Libraries -> Add Jar/folder -> Selecting all files from dynamicreports-3.1.0-project-with-dependencies\dynamicreports-3.1.0\dist

它工作正常,但后来我更改了保存dynamicreports-3.1.0-project-with-dependencies的文件夹的名称,因此它给了我添加库的引用错误。因此,我再次将其更改为以前的名称,但从那时起,我将显示错误

我已经尝试了所有方法,构建新项目并遵循上述步骤,或者重新下载新的dynamicreports-3.1.0-project-with-dependencies并再次遵循这些步骤。但似乎什么都不管用,令人沮丧的是,我离完成我的项目太近了

谁能帮忙吗

谢谢,好的。。解决了

以下行已删除,导致错误:

导入静态net.sf.dynamicreports.report.builder.dynamicreports.*