137 Posted Topics
Re: i did a search on this page for the words 'try' and 'catch' and didnt find them. | |
Re: you should be more specific on mistakes. does it compile? is your action performed working? i notice your panel doesnt implement action listener, your frame does. the button is on the panel. Mike | |
Re: edited thought you didnt have a panel i see you do. I havent used your method of nesting main within the frame class and creating a frame within the frame class. maybe someone can comment if there are any issues there. | |
Hi, when i run my java program it has that little java coffee cup image in teh task bar. All my apps have this. i guess its default. How do you set that to something custom? i cant seem to come up with teh proper name for what that image … | |
Re: All the points on cloud computing are good and I think i'm in agreement with what I see as the two main points: one- you don't own your data, and two- you lose internet and your employees are on vacation. But i want to make a point on a different … | |
I have a gameboard class: class gameboard extends JInternalFrame In the constructor i have the line: setDefaultCloseOperation(DISPOSE_ON_CLOSE); my gameboards are actually in an array myboards[500] were each is an object of this class. the deal is I want to be able to tell which are open and i want to … | |
Re: two things. one you are hard coding lastDay[11], you may know this and its for debugging. the second is you are setting valid twice. First you set valid to true or false on the day issue. But then you set it again wiping out any previous answer it had on … | |
Re: i was amused that you called it Peception of c++ when it sounds like you meant perception, with an r. Now this type of party foul wouldnt normally phase me much but then i started reading the post and the mismatch between your convoluted hard to read language and the … | |
I have a chat window, JTextBox i think, and you hit enter and it invokes an action listener, to send text. It generally works, but now and then i hit enter, and nothing. I have to hit enter again and typically it sends text. the focus is there for typing, … | |
I got a basic telnet socket connection working in an applet. YOu can log onto a server and type and read text. My issue is to show the servers chat i'm using a JTextArea. now this may be the best to use i dont know, maybe i just need to … | |
Re: [code] int b=value.length(); for (int i=0;i<=b;i++) { if (value.charAt(i)==' ') maxSize +=1; [/code] I didnt have time to look at all your code but noticed something at the top. your going to <=length in your loop here. String c= "cat"; has stringlength 3. but charAt() will only work on spots … | |
Hi, I was playing around last night with having one main frame that contains several windows you can open under the window menu. For example you might have a chat window and you might have a game board window. I want these windows contained by one larger frame that represents … | |
Re: i googled and found this link. developer.android.com with any of these phones you have to download their SDK. They use a java like language if they are java compatible but are not exactly java as we know it from sun. I had limited experience doing this with the LG phone … | |
Re: yea sounds like you are at no data. this below isn't by chance suppose to be "patientNo" ? [code] v.addElement(rs.getString("patienNo")); [/code] | |
Re: Take a look at the java page on FileReader() which lists 3 possible constructors. [url]http://java.sun.com/j2se/1.4.2/docs/api/java/io/FileReader.html[/url] I do not see a constructor that can be used without passing a parameter to the constructor. i.e i don't see new FileReader(); maybe this constructor they list there would work: FileReader(String fileName) Creates a … | |
Re: google an ActionListener. Your class that has the listener has to implement ActionListener, ( capitalization on that?). i.e. class mypanel extends JPanel implements ActionListener (above is from memory , check spelling syntax but i think that works) when you extend you are using inheritance, you can only extend from one … | |
Re: one of the things you can drop onto a form ( like you drop a text box) is a timer. You would also need to create an action listener for your timer. i'm not sure on details of adding controls on the fly to a form, but you should easily … | |
Re: when you start coding it maybe ask more specific questions about arrays etc. i have looked into how to solve mastermind, wikipedia has some methods ( one or two not sure) on how to through an algorithm to solve mastermind. google wikipedia mastermind maybe. Another possiblity is ( i dont … | |
Re: I'm curious myself about the answer. His title says this is an Applet. So the problem is how to save info from session so session since i believe java applets cant write to local files. Would it be possible to save info server side? How would you identify that a … | |
Re: try this page for a java tutorial: [url]http://java.sun.com/docs/books/tutorial/[/url] It sounds like this is a class assignment. Is there a textbook you can look at? Mike | |
Re: [QUOTE=amishraa;1072250]So I have calculated the total of students on all of their 6 grades but now I want to be able to calculate the average of all the grades and list the averages next to the total column. Any help would be greatly appreciated! [CODE] //preprocessor directive #include<iostream> #include<iomanip> #include<fstream> … | |
Re: I'm not clear what the issue is, just that there are problems. I did notice you said you couldn't use if statements with strings. Maybe this could help. [code] // you have a string dogtype if(dogtype.equals("large")) size = 3; if(dogtype.equals.("medium")) size = 2; if(dogtype.equals.("small")) size = 1; [/code] StringName.equals("matching text") … | |
Re: you are checking if it contains that string on every line you read. if the page has 1000 lines and you find it on line 963, you had to do your contains method, 962 times when it came up negative. If the page is huge it can make sense to … | |
Re: [code] for(int z = 0; z < consumables.length; z++) { if(Array[i][0].equals(ables[z].getWord())) [/code] i''m not sure how ables max index or top relates to consumables.length. if ables went to 10 you would want to loop from 0-9 not consumables.length so maybe ables.length instead Mike | |
Re: you can use a text box to draw your hangman if you want and just use character based graphics. i.e. ____________ __________ | | \ / | /|\ / | \ | / \ just draw your hangman in the textbox in stages. Mike | |
I was planning on releasing the source of my applet but I wanted to wait till i was done to do that. It got decompiled before i was ready. Is there any practical way to prevent decompiling? i googled and all the articals said how easy it is to decompile … | |
Re: i googled and found this code on the web, untested: int *pI = new int; int *pArr = new int[10]; delete pI; delete [] pArr; notice their delete is delete [] variablename. maybe this is it. Mike | |
Re: hi, in my applet i have a paint components method. not sure if there are any other paint choices, [code] public void paintComponent(Graphics g) { Color mycolor, mycolor2, mycolor3; mycolor = new Color(5,0,0); setBackground(mycolor); super.paintComponent(g); // now i can draw shapes with the g2 methods Graphics2D g2 = (Graphics2D) g; … | |
Re: it sounds like you write something like class coins { } and you make another class to run class coins. so class testinginterface { coins mycoins; // i..e coins is a variable of this class so this class can invoke it. // have methods to do operations with class coins, … | |
I"ve thought i have noticed some strange behavior after compiling. most of the time i compile the class files update with my changes. Now and then i feel i need to delete my class files in the folder and do essentially a rebuild all to make the program start working … | |
Re: well two things come to mind, you have a listener and i think that means you need to have your class implement it. i.e. public class MyClass implements ActionListener { you can also use your extend as well. if i remember right extend is inheritance and implement is an interface … | |
Hi, I'm doing a bouncing ball game. i'm using y=mx + b I want to know when y hits certain numbers. that means it had a collision. the numbers are whole numbers like 539 etc. I increment Y slowly because i also want to not let x move much. when … | |
Re: without reading all the code, though i looked through it, if you call repaint multiple times in different threads, or in one thread, assuring linearity, after each repaint(); you can do Thread.sleep(50); to sleep 50 milliseconds and sort of stop for now tell its repainted. Maybe have a counter in … | |
Re: you mentioned making it sleep you will need import java.lang.Thread.*; and Thread.sleep(1000); put in the program at any line, will make it sleep 1 second or 1000 milliseconds. The program tells the operating system, i'm done for now, come back to me in 1000 ms. Mike | |
Re: i can't answer all your questions but this is a simple java telnet client i wrote to talk to a server ( in this case chessclub.com): [url]www.adammr.com/chessbot5.zip[/url] it implements a socket connection for sending text back and forth, it can listen and parse text it hears on the server, and … | |
Re: It doesn't look like you have coded any type of AI at all. in terms of how to make it the computers turn and draw the board, using your design of a loop, something like this: turn=0; while(gameover==0) { turn++; if(turn%2==1) // users turn { hi input move check for … | |
Hi, i've started making a simple breakout game with java swing. This is just for fun and to learn more about java and swing. I got a frame and a panel and a mouse listener. I draw a paddle on the screen and it moves as the mouse moves. I … |
The End.