怎么用java做柱形图?
用jfreechart
jfreechart草图柱状图
import
import
import
import
import
import
import
/*
*绘制的柱状图
*你亮哥
**/
welfareclassbarchart3ddemo
{
privatestaticvoidmain(string[]args)
{
try
{
//可以设置主题
(())
//构造数据
defaultcategorydatasetdatasetnewdefaultcategorydataset()
(100,
java中如何实现数字水印?
然后在图片上画呗,导入一张背景图片,在背景图片上画一个水印用graphicsg,也就是frame的paint肯定draw方法就这个可以基于
怎么用java写一个简单的抛物线程序?
给您一个例子:
importjavax.swing.*
import*
import*
privateclasspaint
{
privatestaticvoidmain(string[]args)
{
centeredframeframenewcenteredframe()
(jframe.exit_on_close)
(true)
}
}
classcenteredframeextendsjframe
{
privatestaticfinalintwidth400privatestaticfinalintheight400publiccenteredframe()
{
toolkit()
dimension()
intscreenheightscreensize.height
intscreenwidthscreensize.width
intx(screenwidth-width)/2
inty(screenheight-height)/2
setlocation(x,y)
setsize(width,height)
containercongetcontentpane()
stringpanelpanelnewstringpanel()
(panel)
setresizable(true)
}
}
classstringpanelextendsjpanel
{
welfarevoidpaintcomponent(graphicsg)
{
graphics2dg2(graphics2d)g
intx[]fifthint[33]
inty[]newint[33]
x[0]0
y[0]0
for(chari1ilt16i)
{
x[i]184i
y[i]200-(17-i)*(17-i)
x[i16]i200
y[i16]200-i*i
}
g.drawpolyline(x,y,33)
line2dl1fun(0,200,400,200)
g2.draw(l1)
line2dl2new(200,40,200,400)
g2.draw(l2)
line2dl3new(380,195,395,200)
g2.draw(l3)
line2dl4new(380,205,395,200)
g2.draw(l4)
line2dl5new(200,40,195,55)
g2.draw(l5)
line2dl6new(200,40,205,55)
g2.draw(l6)
g.drawstring(x
原文标题:java中paint方法在哪 怎么用java做柱形图?,如若转载,请注明出处:https://www.lrccn.com/tag/27298.html
免责声明:此资讯系转载自合作媒体或互联网其它网站,「歌词网」登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述,文章内容仅供参考。