fikus Posted January 23, 2009 Report Share Posted January 23, 2009 Tak jak w temacie mam problem z kompilacją programu, który po kliknięciu myszyką w różnych miejscach na ekranie odtwarza dźwięki. import java.applet.*; import java.awt.*; import java.awt.event.*; public class Sound extends Applet implements MouseListener { AudioClip audioClip1, audioClip2, audioClip3, audioClip4; FilledRectangle rect1, rect2, rect3, rect4; Color color1, color2, color3, color4; public void init() { addMouseListener (this); audioClip1 = getAudioClip (getDocumentBase(), "ding.au"); audioClip2 = getAudioClip (getDocumentBase(), "beep.au"); audioClip3 = getAudioClip (getDocumentBase(), "yahoo1.au"); audioClip4 = getAudioClip (getDocumentBase(), "yahoo2.au"); rect1 = new FilledRectangle (50, 50, 200, 100); rect2 = new FilledRectangle (350, 50, 200, 100); rect3 = new FilledRectangle (50, 250, 200, 100); rect4 = new FilledRectangle (350, 250, 200, 100); color1 = Color.red; color2 = Color.orange; color3 = Color.yellow; color4 = Color.blue; } public void paint (Graphics gDC) { gDC.setColor(color1); rect1.draw(gDC); gDC.setColor(color2); rect2.draw(gDC); gDC.setColor(color3); rect3.draw(gDC); gDC.setColor(color4); rect4.draw(gDC); } public void mousePressed (MouseEvent evt) { int x = evt.getX(); int y = evt.getY(); if (rect1.contains(x, y)){ audioClip1.play(); } else if (rect2.contains(x, y)) { audioClip2.play(); } else if (rect3.contains(x, y)) { audioClip3.play(); } else if (rect4.contains(x, y)) { audioClip4.play(); } } public void mouseExited (MouseEvent evt){} public void mouseEntered (MouseEvent evt){} public void mouseReleased (MouseEvent evt){} public void mouseClicked (MouseEvent evt){} } 6J'Z,\"zZ+Z'w*huJ&Ś)Zr8mśh=)!i.łŚ?ncŚ +k9%jĆY^uZVŹjhŹJ&Ś)n import java.awt.*; public class FilledRectangle extends Rectangle { public FilledRectangle(int x, int y, int width, int height) { super (x, y, width, height); } public void draw(Graphics gDC) { gDC.fillRect (x, y, width, height); } } Gdzie jest problem? Może ktoś wie, bo ja już na to pomysłów nie mam. Link to comment Share on other sites More sharing options...
Toster Posted January 23, 2009 Report Share Posted January 23, 2009 brak importu ? lub brak sciezki do tej klasy Always Dark<br /> Link to comment Share on other sites More sharing options...
fikus Posted January 23, 2009 Author Report Share Posted January 23, 2009 brak importu ? lub brak sciezki do tej klasy ale jak tą klase może importować? próbowalem takim sposobem import FilledRectangle.*; lecz i tak był jeden bląd Link to comment Share on other sites More sharing options...
Toster Posted January 23, 2009 Report Share Posted January 23, 2009 import nazwa_pakietu_z_klasa.* lub import nazwa_pakietu_z_klasa.FilledRectangle rozumiem ze ten jeden blad byl na tyle intymny ze nie warto o nim wspominac na forum ? Always Dark<br /> Link to comment Share on other sites More sharing options...
fikus Posted January 23, 2009 Author Report Share Posted January 23, 2009 Co to znaczy nazwa pakietu? tzn. nazawa clasy jaka chcę importować? Czyliw moim przypadku FilledRectangle.class tak? Wyskakiwal jeden błąd, lecz i tak nie dawało rady skompilować. Także widzisz, że problem jest poważniejszy. Link to comment Share on other sites More sharing options...
Toster Posted January 23, 2009 Report Share Posted January 23, 2009 RTFM Always Dark<br /> Link to comment Share on other sites More sharing options...
fikus Posted January 23, 2009 Author Report Share Posted January 23, 2009 tylko tyle masz do napisania? widze ze tez nie masz pomyslu Link to comment Share on other sites More sharing options...
Toster Posted January 23, 2009 Report Share Posted January 23, 2009 a ja widze ze ty nie czytasz ze zrozumieniem i zamiast siegnac po to po co inni siegaja szukasz kogos kto wezmie za raczke, posadzi, zalozy sliniaczek, nakarmi, otrze buzke, poglaszcze i polozy do lozeczka. Always Dark<br /> Link to comment Share on other sites More sharing options...
fikus Posted January 23, 2009 Author Report Share Posted January 23, 2009 jak nie czytam ze zrozumieniem? napisałeś mi o RTFM na wikipedii ejst wyjaśnione co i jak. dodałem do sound import i to samo jest. Może sprawdzisz czy u ciebie ten programik chodzi? Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.