当前位置: 技术问答>java相关
请问各位高手,有关在WEB下做报表的问题?(现在给不了分,以后一定给)
来源: 互联网 发布时间:2015-01-18
本文导语: 请问各位高手,有关在WEB下做报表的问题?说实话我一直以来很被WEB下面开发报表很困惑,不知道怎样才好,以前都是利用表单显示,然后用浏览器的打印按钮,或者用JAVASCRIPT里的PRINT?来实现?各位有什么好的办法...
请问各位高手,有关在WEB下做报表的问题?说实话我一直以来很被WEB下面开发报表很困惑,不知道怎样才好,以前都是利用表单显示,然后用浏览器的打印按钮,或者用JAVASCRIPT里的PRINT?来实现?各位有什么好的办法,我以前看过别人做的报表他的风格就像VB做的报表,可能是利用了一个组件,但是我不知道怎样实现他,那为高人知道麻烦告之,(在PHP或者JSP里实现)。
谢谢
谢谢
|
/* My first graphing applet. */
/* Need to: put in a status line.
see why it doesn't use the full range of ymin to ymax
when I change functions.
put tick marks into a function.
*/
import java.awt.*;
import java.util.*;
import java.applet.Applet;
public class SimplePlot extends Applet {
TextField fromFld, toFld;
String MyText;
Label label, toLabel, fromLabel, statusLabel;
PlotCanvas canvas;
public int i;
Button redb, blueb, domainChangeb;
Color color;
Panel panel1, panel2, bottomPanel, statusPanel, xdomainPanel;
Choice fnChoice;
float beginXmin = -100, beginXmax = 100;
public void init() {
setLayout(new BorderLayout(5,5));
panel1 = new Panel();
label = new Label("Plotting a Function");
panel1.add(label);
add("North", panel1);
panel2 = new Panel();
panel2.setLayout(new GridLayout(0,1,5,5));
panel2.add(new Label("Choose a Color"));
redb = new Button("RED");
redb.setBackground(Color.red);
panel2.add(redb);
blueb = new Button("BLUE");
blueb.setBackground(Color.blue);
panel2.add(blueb);
panel2.add(new Label("Choose a Function"));
fnChoice = new Choice();
fnChoice.addItem("x^2");
fnChoice.addItem("x + 30");
fnChoice.addItem("x^3");
fnChoice.addItem("x^2 + x - 52");
panel2.add(fnChoice);
add("East", panel2);
canvas = new PlotCanvas(this);
add("Center", canvas);
fromLabel = new Label("-100");
/* Bottom Panel, with from and to and status line. */
bottomPanel = new Panel();
bottomPanel.setLayout(new GridLayout(0,1,5,5));
/* Domain panel */
xdomainPanel = new Panel();
xdomainPanel.add(new Label("Plot x from : "));
fromFld = new TextField("-100", 7);
canvas.setXmin(-100);
xdomainPanel.add(fromFld);
xdomainPanel.add(new Label("to : "));
toFld = new TextField("100", 10);
canvas.setXmax(100);
xdomainPanel.add(toFld);
domainChangeb = new Button ("Change Domain");
xdomainPanel.add(domainChangeb);
bottomPanel.add(xdomainPanel);
/* Status Line */
statusPanel = new Panel();
statusLabel = new Label(" ");
statusLabel.setForeground(Color.magenta);
statusPanel.add(statusLabel);
bottomPanel.add(statusPanel);
add("South", bottomPanel);
}
/** Draws a box around this panel. */
public void paint(Graphics g) {
Dimension d = size();
g.drawRect(0,0, d.width - 1, d.height - 1);
}
public Insets insets() {
return new Insets(5,5,5,8);
}
public boolean handleEvent(Event e) {
int newFn;
try {
if ((e.target instanceof Button)
&& (e.id == Event.ACTION_EVENT)) {
if (e.target == redb) {
canvas.changeColor(Color.red);
}
else if (e.target == blueb) {
canvas.changeColor(Color.blue);
}
else if (e.target == domainChangeb) {
float newXmin = 0, newXmax = 0;
/* Do this to get rid of a possible
"Domain must be a number" message */
statusLabel.setText(" ");
newXmin = Float.valueOf(fromFld.getText()).floatValue();
newXmax = Float.valueOf(toFld.getText()).floatValue();
if (newXmax
/* Need to: put in a status line.
see why it doesn't use the full range of ymin to ymax
when I change functions.
put tick marks into a function.
*/
import java.awt.*;
import java.util.*;
import java.applet.Applet;
public class SimplePlot extends Applet {
TextField fromFld, toFld;
String MyText;
Label label, toLabel, fromLabel, statusLabel;
PlotCanvas canvas;
public int i;
Button redb, blueb, domainChangeb;
Color color;
Panel panel1, panel2, bottomPanel, statusPanel, xdomainPanel;
Choice fnChoice;
float beginXmin = -100, beginXmax = 100;
public void init() {
setLayout(new BorderLayout(5,5));
panel1 = new Panel();
label = new Label("Plotting a Function");
panel1.add(label);
add("North", panel1);
panel2 = new Panel();
panel2.setLayout(new GridLayout(0,1,5,5));
panel2.add(new Label("Choose a Color"));
redb = new Button("RED");
redb.setBackground(Color.red);
panel2.add(redb);
blueb = new Button("BLUE");
blueb.setBackground(Color.blue);
panel2.add(blueb);
panel2.add(new Label("Choose a Function"));
fnChoice = new Choice();
fnChoice.addItem("x^2");
fnChoice.addItem("x + 30");
fnChoice.addItem("x^3");
fnChoice.addItem("x^2 + x - 52");
panel2.add(fnChoice);
add("East", panel2);
canvas = new PlotCanvas(this);
add("Center", canvas);
fromLabel = new Label("-100");
/* Bottom Panel, with from and to and status line. */
bottomPanel = new Panel();
bottomPanel.setLayout(new GridLayout(0,1,5,5));
/* Domain panel */
xdomainPanel = new Panel();
xdomainPanel.add(new Label("Plot x from : "));
fromFld = new TextField("-100", 7);
canvas.setXmin(-100);
xdomainPanel.add(fromFld);
xdomainPanel.add(new Label("to : "));
toFld = new TextField("100", 10);
canvas.setXmax(100);
xdomainPanel.add(toFld);
domainChangeb = new Button ("Change Domain");
xdomainPanel.add(domainChangeb);
bottomPanel.add(xdomainPanel);
/* Status Line */
statusPanel = new Panel();
statusLabel = new Label(" ");
statusLabel.setForeground(Color.magenta);
statusPanel.add(statusLabel);
bottomPanel.add(statusPanel);
add("South", bottomPanel);
}
/** Draws a box around this panel. */
public void paint(Graphics g) {
Dimension d = size();
g.drawRect(0,0, d.width - 1, d.height - 1);
}
public Insets insets() {
return new Insets(5,5,5,8);
}
public boolean handleEvent(Event e) {
int newFn;
try {
if ((e.target instanceof Button)
&& (e.id == Event.ACTION_EVENT)) {
if (e.target == redb) {
canvas.changeColor(Color.red);
}
else if (e.target == blueb) {
canvas.changeColor(Color.blue);
}
else if (e.target == domainChangeb) {
float newXmin = 0, newXmax = 0;
/* Do this to get rid of a possible
"Domain must be a number" message */
statusLabel.setText(" ");
newXmin = Float.valueOf(fromFld.getText()).floatValue();
newXmax = Float.valueOf(toFld.getText()).floatValue();
if (newXmax