永发信息网

画图是用那种鼠标好一点

答案:6  悬赏:70  手机版
解决时间 2021-02-08 01:32
  • 提问者网友:风月客
  • 2021-02-07 07:52
光电还是机械
最佳答案
  • 五星知识达人网友:空山清雨
  • 2021-02-07 09:24
如果想做专业画图的话,用鼠标是不行的,应该用手写板来代替.
全部回答
  • 1楼网友:像个废品
  • 2021-02-07 14:32
应该用 轨迹球
  • 2楼网友:鱼忧
  • 2021-02-07 13:43
上学的时候写过,不过不在公司的电脑里面。呵呵,回去想到了给你…… packageguitest.myboard; importjava.awt.*; importjava.awt.event.*; importjava.awt.geom.*; importjava.io.*; importjava.util.*; importjavax.swing.*; //thepoint //impresstheinfoofonepoint,thexandy classonepointimplementsserializable{ intx; inty; inttool; colorc; intborder; publiconepoint(intx,inty,inttool,colorcc,intborder){ this.x=x; this.y=y; this.tool=tool; this.c=cc; this.border=border; } } classdrawingboardextendsframeimplementsmouselistener,itemlistener,actionlistener,mousemotionlistener{ buttonpen; buttonline; buttonellipse; buttonrect; buttonclear; buttoncolorboard; buttonstorebutton; buttonopenbutton; choicesizechoice; choicecolorchoice; labelpensize; labelpencolor; panelpanel; filedialogstorefile; filedialogopenfile; fileinputstreamfilein; fileoutputstreamfileout; objectinputstreamobjectin; objectoutputstreamobjectout; intflagtool=0; colorflagcolor; intborder; basicstrokesize; onepointp1,p2; vector<onepoint>points=newvector<onepoint>(); publicdrawingboard(){ pen=newbutton("画笔"); line=newbutton("直线"); ellipse=newbutton("圆"); rect=newbutton("矩形"); clear=newbutton("清除"); colorboard=newbutton("调色板"); storebutton=newbutton("存储文件"); openbutton=newbutton("打开文件"); pensize=newlabel("画笔大小"); pencolor=newlabel("画笔颜色"); storefile=newfiledialog(this,"存储文件",filedialog.save); storefile.setvisible(false); storefile.addwindowlistener(newwindowadapter(){ publicvoidwindowclosing(windowevente){ storefile.setvisible(false); } }); openfile=newfiledialog(this,"打开文件",filedialog.load); openfile.setvisible(false); openfile.addwindowlistener(newwindowadapter(){ publicvoidwindowclosing(windowevente){ openfile.setvisible(false); } }); sizechoice=newchoice(); sizechoice.add("1"); sizechoice.add("2"); sizechoice.add("4"); sizechoice.add("6"); sizechoice.add("8"); sizechoice.additemlistener(this); colorchoice=newchoice(); colorchoice.add("black"); colorchoice.add("red"); colorchoice.add("blue"); colorchoice.add("green"); colorchoice.additemlistener(this); pen.addactionlistener(this); line.addactionlistener(this); ellipse.addactionlistener(this); rect.addactionlistener(this); clear.addactionlistener(this); colorboard.addactionlistener(this); storebutton.addactionlistener(this); openbutton.addactionlistener(this); panel=newpanel(); panel.add(storebutton); panel.add(openbutton); panel.add(pen); panel.add(line); panel.add(ellipse); panel.add(rect); panel.add(clear); panel.add(sizechoice); panel.add(pensize); panel.add(colorchoice); panel.add(pencolor); panel.add(colorboard); add(panel,borderlayout.north); setbounds(100,100,700,600); setvisible(true); addwindowlistener(newwindowadapter(){ publicvoidwindowclosing(windowevente){ system.exit(0); } }); addmouselistener(this); addmousemotionlistener(this); } publicvoidpaint(graphicsg){ graphics2dg2d=(graphics2d)g; if(flagtool==2){//qingchu g.clearrect(0,0,getsize().width,getsize().height); } for(inti=0;i<points.size()-1;i++){ p1=(onepoint)points.elementat(i); p2=(onepoint)points.elementat(i+1); g2d.setcolor(p1.c);//////////////需要使用graphics2d从graphics类中继承下来的方法setcolor()设置当前的颜色 size=newbasicstroke(p1.border,basicstroke.cap_butt,basicstroke.join_bevel); g2d.setstroke(size); if(p1.tool==p2.tool){ switch(p1.tool){ case0: line2d.doubleline1=newline2d.double(p1.x,p1.y,p2.x,p2.y); g2d.draw(line1); break; case1: line2d.doubleline2=newline2d.double(p1.x,p1.y,p2.x,p2.y); g2d.draw(line2); break; case3: ellipse2d.doubleellipse=newellipse2d.double(p1.x,p1.y,math.abs(p2.x-p1.x),math.abs(p2.y-p1.y)); g2d.draw(ellipse); break; case4: rectangle2d.doublerect=newrectangle2d.double(p1.x,p1.y,math.abs(p2.x-p1.x),math.abs(p2.y-p1.y)); g2d.draw(rect); break; default: } } } } publicvoidmouseclicked(mouseevente){} publicvoidmouseentered(mouseevente){} publicvoidmouseexited(mouseevente){} publicvoidmousepressed(mouseevente){//鼠标点下时候,将当前的点信息记录 onepointpp1=newonepoint(e.getx(),e.gety(),flagtool,flagcolor,border); points.addelement(pp1); //repaint(); } publicvoidmousereleased(mouseevente){//鼠标松开时候,如果是画笔,则当前截断,是其余状态记下一枚点信息 if(flagtool==0){ points.addelement(newonepoint(-1,-1,22,flagcolor,border)); } else{ onepointpp2=newonepoint(e.getx(),e.gety(),flagtool,flagcolor,border); points.addelement(pp2); points.add(newonepoint(-1,-1,22,flagcolor,border)); } repaint(); } publicvoiditemstatechanged(itemevente){ if(e.getsource()==colorchoice){ stringselected=colorchoice.getselecteditem(); if(selected=="black"){ flagcolor=newcolor(0,0,0); } elseif(selected=="red"){ flagcolor=newcolor(255,0,0); } elseif(selected=="blue"){ flagcolor=newcolor(0,0,255); } elseif(selected=="green"){ flagcolor=newcolor(0,255,0); } } elseif(e.getsource()==sizechoice){ stringselected=sizechoice.getselecteditem(); if(selected=="1"){ border=1; } elseif(selected=="2"){ border=2*2; } elseif(selected=="4"){ border=4*2; } elseif(selected=="6"){ border=6*2; } elseif(selected=="8"){ border=8*2; } } } publicvoidupdate(graphicsg){//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ paint(g); } publicvoidactionperformed(actionevente){ //todoauto-generatedmethodstub if(e.getsource()==pen){ flagtool=0; } elseif(e.getsource()==line){ flagtool=1; } elseif(e.getsource()==clear){ flagtool=2; points.removeallelements(); repaint();//此语要有,否则今生无法删除! } elseif(e.getsource()==ellipse){ flagtool=3; } elseif(e.getsource()==rect){ flagtool=4; } elseif(e.getsource()==colorboard){ colorcolor=jcolorchooser.showdialog(this,"调色板",flagcolor); flagcolor=color; } elseif(e.getsource()==openbutton){ openfile.setvisible(true); if(openfile.getfile()!=null){ inttemp=flagtool; flagtool=2; repaint(); try{ points.removeallelements(); filefile=newfile(openfile.getdirectory(),openfile.getfile()); filein=newfileinputstream(file); objectin=newobjectinputstream(filein); points=(vector)objectin.readobject(); objectin.close(); filein.close(); flagtool=temp; repaint(); } catch(exceptionee){ system.out.println(ee.tostring()); } } } elseif(e.getsource()==storebutton){ storefile.setvisible(true); if(storefile.getfile()!=null){ try{ filefile=newfile(storefile.getdirectory(),storefile.getfile()); fileout=newfileoutputstream(file); objectout=newobjectoutputstream(fileout); objectout.writeobject(points); objectout.close(); fileout.close(); repaint(); } catch(filenotfoundexceptione1){ system.out.println(e1.tostring()); e1.printstacktrace(); }catch(ioexceptionee){ system.out.println(ee.tostring()); ee.printstacktrace(); } } } } publicvoidmousedragged(mouseevente){//鼠标拖动时候,//当且仅当flagtool==0,或者表示为橡皮的时候 //才将拖动过程中涉及到的点全部记录下来,并且调用repain()方法,重画当前 //todoauto-generatedmethodstub if(flagtool==0){ onepointpp3=newonepoint(e.getx(),e.gety(),flagtool,flagcolor,border); points.addelement(pp3); repaint(); } } publicvoidmousemoved(mouseevente){ //todoauto-generatedmethodstub } } publicclasspaintboard{ publicstaticvoidmain(string[]args){ drawingboardoneborder=newdrawingboard(); } }
  • 3楼网友:醉吻情书
  • 2021-02-07 12:07
想专业一点还是用手写板比较方便 我个人认为 机械<光电<激光
  • 4楼网友:西岸风
  • 2021-02-07 11:38
画图专业鼠标就是球在上面的那种
  • 5楼网友:往事埋风中
  • 2021-02-07 10:13
微软的极动鼠标非常适合!
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯