이 기사는 두 가지 효과를 달성합니다.
첫 번째 유형, 동심원 원 렌더링 :
/***프로그램 요구 사항 : 600*600 픽셀의 새 응용 프로그램 창을 만들고 창에 다른 색상의 5 개의 동심원을 그립니다. 50 픽셀* 렌더링은 아래 그림 (색상 무작위로 설정)에 표시되며 소스 프로그램은 Ex7_1.java로 저장됩니다. *WWJ*날짜 : 2012/4/25*5 가지 색상의 동심원을 표시합니다 jframe {int red, green, blue; // 가시적 인 setDefaultCloseOperation (jframe.exit_on_close); (int) (Math.random ()*255 (int)*255; (175,175,250,250). *255); 새로운 색상 (빨간색, 녹색, 파란색) (g.filloval); green = (int) (int) (math.random ()*255; .filloval (225,225,150,150); ()*255; 녹색 = (int) (math.random); G.Filloval (275,275,50,50);
두 번째 유형은 음악을 재생하고 사진을 전환하는 미니 프로토리 렌더링입니다.
/** * 프로그램 요구 사항 : 애플릿 애플릿을 쓰고, 5 개의 사진과 3 개의 음악 파일을 준비하고, 애플릿에 그려서 * 그리고 여러 버튼을 추가하여 음악 파일의 스위칭을 제어하고, 축소하고, 축소하고 재생하십시오. *저자 : WWJ*날짜 : 2012/4/29*참조 : Neicole*기능을 변환 할 수있는 애플릿 **/import javax.awt.*; ; p3 = jpanel (); New Jbutton ( "Zoom in"); JBUTTON NEXTPIC = 새로운 JBUTTON ( "ZBUTTON"; JBUTTON PLAY = JBUTTON LOOP = "연속"; 드롭 다운 목록 jcombobox xx; "트랙 1.wav", "트랙 3.wav"}; /window this.setlayout (); // p1.add (setLarge) (setlittle); Jcombobox (xx.additemlistener); nextsound.addactionListener (int i = 0; i <3; i ++) {getaudioclip (getCodeBase (), "music/"+"type"+integer.tostrin g (i+1 ). 추가 (nextsound); , BorderLayout.north) (P2, BorderLayout.South); .getSource () == lastpic) {showphotos.changephotoshow ( 'p'); == setLarge) {showphotos.changephotosize ( 'b') else (e.getSource () == setLittle) {showphotos.changephotosize ( 's'); {// playingsong (playingsong); ) == play) {// 재생 버튼 소리 [playingsong] .play (); if (e.getSource () == loop) {// 루프 버튼 소리 [playingsong]; loop (); } else if (e.getSource () == stop) {// 스톱 버튼 소리 [playingsong] else {// playingsong (playingsong); ); playingsong] = getaudioclip () int coordinatex = 0; = 0; i <5; i ++) {img [i] = getImage (getCodeBase (), "image/"+integer.toString (i+1)+"}} private void changePhotoIndex (int index) nowimageindex = changephotosize ( 'm'); 'n'= 명령) {changePhotoIndex (nowimageIndex + 1) %}}} { 'm'== 명령) {currentwid = maxwi dth; if ( 'b'== command) {if (maxWidth> = (currentWidth + 100) = (currentHeight + 100)) {currentWidth + = 100; == 명령) {if (0 <(currentWidth -100)) && (0 <(currentHeight -100))) {currentWidth = currentHeight = currentHeight -100; / 2; coderinatey; , curre ntwidth, currentheight, this);
위의 것은 Java의 그래픽 디자인과 멀티미디어 처리에 관한 것입니다.