jbuilder有报表生成器吗?(100分)

  • 主题发起人 主题发起人 sercall
  • 开始时间 开始时间
用jreport和fomula one,
但破解难找
 
这个数据统计是其他网友做的,有福同享么!
package tour;
import java.awt.*;
import java.awt.event.*;
import java.applet.*;
import java.applet.*;
/**
* Title:
* Description:
* Copyright: Copyright (c) 2001
* Company:
* @author
* @version 1.0
*/
public class Tour extends Applet {
boolean isStandalone = false;
/************** 矩形外框的长宽值 ****************/
public static final int Rect_Width = 440;
//框宽
public static final int Rect_Height = 305;
//框高
public static final int Mon_Num = 12;
//显示的月份数
public static final int Zhu_Width = 15;
//柱宽
int x[] = new int[Mon_Num], // x[] 和 y[][] 是每个柱的左上角坐标(因为包含“海外”情况,所以x只有一个值,y有两个值)
y[][] = new int[Mon_Num][2],
zhuHeight[][] = new int[Mon_Num][2], //每个柱的柱高
par[][] = new int[Mon_Num][2], //参数数组变量
max = 0, //参数中的最大值
row = 0, //行数
rowHeight = 0, //行高像素值
rowHeightVal = 0, //行高指标值
xPoint[] = new int[Mon_Num], // xPoint[] 和 yPoint[] 是画折线需用到的点坐标值
yPoint[] = new int[Mon_Num],
changNum = -1;
boolean changFlag = false;
String appletTitle = null, //applet标题
label1 = null,
label2 = null,
label3 = null,
label4 = null;
Color zhuColor[] = new Color[Mon_Num],
zhuColorDark[] = new Color[Mon_Num],
stringColor = Color.darkGray,
pointColor = Color.red;
String[] mon = {"","79976","109810","21434","234545",
"12234","34545","4546","34545",
"345345","45345","2344","2354"};
String[] monOut = {"","1243","546456","34545","123343",
"3435","34535","345345","12334",
"234535","234","34556","23434"};
/**Get a parameter value*/
/*
public String getParameter(String key, String def) {
return isStandalone ? System.getProperty(key, def) :
(getParameter(key) != null ? getParameter(key) : def);
}
*/
/**Construct the applet*/
public Tour() {
}
/**Initialize the applet*/
public void init() {
try {
jbInit();
}
catch(Exception e) {
e.printStackTrace();
}
}
/**Component initialization*/


private void jbInit() throws Exception {
for (int i=1;
i<=Mon_Num;
i++)
{
par[i-1][0] = Integer.parseInt(mon);//getParameter("mon"+i, "0"));
par[i-1][1] = Integer.parseInt(monOut);//getParameter("mon"+i+"out", "0"));
if (par[i-1][0] > max) {max = par[i-1][0];} //取得参数中总人数的最大值
zhuColor[i-1] = Color.orange;
zhuColorDark[i-1] = Color.blue;
}
appletTitle = "标题";//getParameter("appletTitle", "");
label1 = "label1";//getParameter("label1", "");
label2 = "label2";//getParameter("label2", "");
label3 = "label3";//getParameter("label3", "");
label4 = "label4";//getParameter("label4", "");
/************ 计算行数 *********************/
int i,temp;
for (i=0, temp=max;
temp>=10;
i++)
{temp = (int)temp/10;}
if (temp <= 2)
{
rowHeightVal = (int)Math.pow(10, i-1);
row = max/(int)Math.pow(10, i-1) + 2;
}
else
{
rowHeightVal = (int)Math.pow(10, i);
row = temp + 2;
}
this.setBackground(Color.white);
this.setSize(600, 400);
this.addMouseMotionListener(new MouseMotionAdapter()
{
public void mouseMoved(MouseEvent e)
{
int mouseX = e.getX(),
mouseY = e.getY();
for (int i = 0;
i<Mon_Num;
i++)
{
if ((mouseX>x &amp;&amp;
mouseX<x+15) &amp;&amp;
(mouseY>y[0] &amp;&amp;
mouseY<y[0]+zhuHeight[0]))
{
if (zhuColor == Color.orange &amp;&amp;
zhuColorDark == Color.blue)
{
changFlag = true;
changNum = i;
zhuColor = new Color(0x33b3ff);
zhuColorDark = new Color(0x666699);
pointColor = Color.lightGray;
stringColor = Color.red;
repaint();
break;
}
}
else
if (zhuColor != Color.orange &amp;&amp;
zhuColorDark != Color.blue)
{
changFlag = true;
changNum = i;
zhuColor = Color.orange;
zhuColorDark = Color.blue;
pointColor = Color.red;
stringColor = Color.darkGray;
repaint();
break;
}
}
}
});
}
/**Start the applet*/
public void start() {
}
/**Stop the applet*/
public void stop() {
}
/**Destroy the applet*/
public void destroy() {
}
/**Get Applet information*/
public String getAppletInfo() {
return "Applet Information";
}
/**Get parameter info*/
public String[][] getParameterInfo()
{
return null;
}
public void update(Graphics g)
{
if (changFlag)
{
g.setColor(zhuColor[changNum]);
g.fillRect(x[changNum]+1, y[changNum][0]+1, Zhu_Width-2, zhuHeight[changNum][0]-2);
g.setColor(zhuColorDark[changNum]);
g.fillRect(x[changNum]+1, y[changNum][1]+1, Zhu_Width-2, zhuHeight[changNum][1]-2);
g.setColor(stringColor);
g.drawString(changNum+1+"月", 60+changNum*35, 40+Rect_Height);
g.setColor(pointColor);
g.fillOval(xPoint[changNum]-2, yPoint[changNum]-3, 5, 5);
//画折线点
g.setColor(Color.red);
g.drawPolyline(xPoint, yPoint, Mon_Num);
//画折线
g.setColor(Color.black);
if (zhuColor[changNum] != Color.orange)
{
g.drawString(changNum+1+"", 22, 65+Rect_Height);
g.drawString(changNum+1+"", 22, 85+Rect_Height);
g.drawString(""+par[changNum][0], 200, 65+Rect_Height);
g.drawString(""+par[changNum][1], 225, 85+Rect_Height);
}
else
{
g.clearRect(22, 50+Rect_Height, 12, 100);
g.clearRect(200, 50+Rect_Height, 40, 20);
g.clearRect(225, 70+Rect_Height, 40, 20);
}
changFlag = false;
}
else
paint(g);
}
public void paint(Graphics g){
g.drawString(appletTitle, 170, 15);
g.setColor(Color.darkGray);
g.drawRect(40, 25, Rect_Width-1, Rect_Height-1);
//绘制矩形外框
g.setColor(Color.lightGray);
g.drawRect(39, 24, Rect_Width+1, Rect_Height+1);
//绘制矩形外框的边框
g.setColor(Color.darkGray);
rowHeight = Rect_Height/row;
//计算行高像素值
for (int i=0;
i<row;
i++) //绘制行刻度
{
g.drawLine(40, 24+Rect_Height-rowHeight*i, 39+Rect_Width, 24+Rect_Height-rowHeight*i);
g.setColor(Color.lightGray);
g.drawLine(41, 25+Rect_Height-rowHeight*i, 38+Rect_Width, 25+Rect_Height-rowHeight*i);
g.setColor(Color.darkGray);
if (rowHeightVal >= 10000) g.drawString(rowHeightVal/10000*i+"万", 5, 27+Rect_Height-rowHeight*i);
else
g.drawString(""+rowHeightVal*i, 5, 27+Rect_Height-rowHeight*i);
}
for (int i=0;
i<Mon_Num;
i++) //计算每个柱的柱高(像素值),并画柱
{
zhuHeight[0] = rowHeight*par[0] / rowHeightVal;
zhuHeight[1] = rowHeight*par[1] / rowHeightVal;
y[0] = 25 + Rect_Height - zhuHeight[0];
y[1] = 25 + Rect_Height - zhuHeight[1];
x = 60 + i*35;
xPoint = x+7;
yPoint = y[0]-1;
g.setColor(Color.lightGray);
g.draw3DRect(x, y[0], Zhu_Width, zhuHeight[0]-1, true);
g.setColor(zhuColor);
g.fillRect(x+1, y[0]+1, Zhu_Width-2, zhuHeight[0]-2);
g.setColor(zhuColorDark);
g.fillRect(x+1, y[1]+1, Zhu_Width-2, zhuHeight[1]-2);
g.setColor(stringColor);
g.drawString(i+1+"月", 60+i*35, 40+Rect_Height);
g.setColor(pointColor);
g.fillOval(xPoint-2, yPoint-3, 5, 5);
//画折线点
}
g.drawPolyline(xPoint, yPoint, Mon_Num);
//画折线
g.setColor(Color.black);
g.drawString("月"+label1+":", 35, 65+Rect_Height);
g.drawString("月"+label2+":", 35, 85+Rect_Height);
int all0 = 0,all1 = 0;
for (int i=0;
i<Mon_Num;
i++)
{
all0 += par[0];
all1 += par[1];
}
g.drawString(label3+": "+all0, 290, 65+Rect_Height);
g.drawString(label4+": "+all1, 290, 85+Rect_Height);
}
/**Main method*/
public static void main(String[] args) {
Tour applet = new Tour();
applet.isStandalone = true;
Frame frame;
frame = new Frame() {
protected void processWindowEvent(WindowEvent e) {
super.processWindowEvent(e);
if (e.getID() == WindowEvent.WINDOW_CLOSING) {
System.exit(0);
}
}
public synchronized void setTitle(String title) {
super.setTitle(title);
enableEvents(AWTEvent.WINDOW_EVENT_MASK);
}
};
frame.setTitle("Applet Frame");
frame.add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400,320);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
}
}
 
借这个题目问一下,我在客户端不想用SWING或APPLET怎么办?
我的想法是这样的:
1。从数据源得到数据。
2。格式化成XML或其他的格式。
3。转化成PDF。
4。通过权限BEANS来存取。
有谁有这方面的经验,大家探讨一下
 
[blue]guangmin[/blue]:能把你的Jreport发一份给我吗?[blue]gdxuz@163.net[/blue]
Thank You!!
 
给我发一份jreport可以吗,谢谢了
 
顺便也请发给我一份吧。
ljklxlj@sohu.com
 
i have a sample that can control excel through java
http://delphi.mychangshu.com/dispdoc.asp?id=292
 
用java 生成PDF再打印
 
[:)]
各位大虾,jreport 发给我一份好吗?
wy@juyee.com
xuzhiling@263.net.cn
谢谢
 
后退
顶部