1,678 Posted Topics
Re: There are two obvious things you could do as far as how you're thinking about the section of the Seats. Scenario 1: Think of the section the seat is in as a property of the seat. (In other words, since the seat will always be in the same section, you … | |
Re: Haha I just realized what was going on. At first I read this and I was thinking "how is ezzeral's code going to produce that pound symbol?" because I literally thought you wanted that sign before the amount | |
Re: The code is the same in a static method as it would be in main. and main [I]is[/I] a static method - just look at the method header. | |
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Java Sun's site is down right now so I can't check but I'm guessing this is an old method since according to Eclipse, the method doesn't exist anymore. So my question is, are there any other ways to do the same thing? | |
Re: [CODE=java]public class anExample{ private Object obj; private static Object obj2; public Object obj3; public static Object obj4; public static void main(String[] args){ } //other methods }[/CODE] From a method inside the class with an instance of anExample: You can refer to (use) obj and obj3. From a static method inside … | |
Re: if you just say imgIcon = new ImageIcon("jhtp3.gif"); it's probably going to assume that jhtp3.gif is located somewhere under your current project. So download it and put it there, or at least download it to your computer and specify the pathname in your argument to ImageIcon. Also, use code tags. | |
Re: If you want examples consult Java Sun's tutorials on Swing. They have plenty. | |
| |
Re: Post your code (the part that is relevant to your question). [url]http://java.sun.com/docs/books/tutorial/networking/sockets/readingWriting.html[/url] Also, take a look at that example, particularly the part where the PrintWriter and BufferedReader objects are created. | |
Re: For one, you don't have a main method (that you showed), so you never constructed a PermutationGenerator object and int[] result = new int[length]; has no effect since it is never called. Secondly, if you wanted to put the stuff from the result array into the choices ArrayList, it would … | |
Re: The problem is that nextDouble does not advance past the newline. You can use the methods in any order that works for you; none of the methods is necessarily better or worse, it depends on your situation. For example, you could continue to use nextDouble in your case, and simply … | |
Re: Sort it yourself, even use a BubbleSort if you want, since its a small collection of cities. I used a PriorityQueue for one of my projects before and it isn't hard to implement the default Java class for it, but you'll learn more doing it yourself probably. | |
Re: You can use Integer rather than int. null, as far as I know, can only be used with Objects. int is a primitive type whereas Integer is an Object or class type. So change the return type of your method to Integer. | |
Re: You only need to do a few things: Read in the characters from the file. As you go, assign a number to each character (make sure you don't assign the same number to two different characters). Keep these number-character pairs in a list. Then read the numbers from the file, … | |
I have to write a program that mimics a digital clock w/ seconds, minutes, and hours. I'm sure I can get the displays working on my own and everything. My concern: what is the most efficient way to check the time? Should I just do Thread.sleep for 1 second then … | |
Re: You didn't ask a question or explain what was wrong with the program. Surely if you've worked on it you know an area where your code doesn't work. | |
Re: Or you could think of it in a few other ways. For example 1 * 10 ^ -1 is the same as 1/10^1 or 1/10. It is also equivalent to moving the decimal place back a few spots. | |
Re: I think you have to call the revalidate method on your JTable, after removing or adding a column, to make it work. Its been a while, but I think that's the advice Ezzaral gave me when I asked a similar question before (I could be misquoting him; whatever advice he … | |
After some research I found this link [url]http://splainhow.com/jogl_eclipse.html[/url] which explains how to set up a project in Eclipse to use OpenGL with it. But I want to integrate the OpenGL libraries for JOGL with Eclipse so that I can import and use them with any projects. Does that make sense? … | |
Re: Post your code in code tags and indent it properly (before posting it in code tags) and people will help you. | |
Re: I did a project like this, except with more strict guidelines. What you do is use either a stack or a queue. Push the start space onto the stack/queue. Then, push any adjacent cells (that you can move to!) from the cell you're currently at (at first, this will be … | |
Re: Make the changes that Ezzaral suggested, then re-post your code. You are more than likely just missing a closing brace somewhere. For every opening { brace, you need a closing } one. | |
Re: if (today.before(birthDate)) You're passing a GregorianCalendar Object to the before method. Are you sure this is correct? I wouldn't really know, but I don't see how a calendar and a day are the same thing.... you should be passing a day to the before method, probably. edit: Yeah, it seems … | |
Re: You could also make an Object that holds a name and an integer. The integer would be timesSeen. Then you'd only need one array. Either way works. | |
Re: So the numbers have to be in a continuous sequence? Or is that just a coincidence in the bad example you picked? Because from what you [I]stated[/I], you could just generate four random integers and display them and you're done. Or do two of the numbers have to be the … | |
Re: You need to keep track of the size of your array, then loop over the contents which have been filled, adding them. If it was an array of Objects, and the array was initialized to null (same as Java?), you could also use an if statement such as... if (element … | |
Re: That doesn't make sense. Maintain a sorted linked list by making sure that every time you do an insert, it is inserted in sorted order. No need for a sorting algorithm. | |
Re: And I quote you the same post I made to you when you posted this exact thread on PFO: [QUOTE=Me to your stupid ass] Lol. I coded it already; took me 2 minutes and I don't even know C++. No, but seriously, nobody is going to do your homework for … | |
Re: Any Object can be inserted into a queue. Think about it logically - a queue is just a collection of items where the first thing put in the queue will be the first thing to come out of the queue. A line at a grocery store is an example of … | |
Re: 4-5 4-5-6 4-3 4-3-2 I count 4 ways. And the number you start at will never matter if I'm doing this correctly, so whats the point? If I'm not doing it correctly than perhaps you should explain. | |
Re: Items will be aligned in a container in the order that you add them. So yes, it is possible. Is that what you're asking? If you wanted the button above, just add the button first and add the table second. | |
Re: [QUOTE=jwenting;327654](only universities can have professors, and those won't touch introductory programming courses) [/QUOTE] The second part is false. And Chico, post your own thread, post what code you've written in code tags, and explain what problem you're having and what part of the code you're having it in. | |
Re: Can you post the error you are getting? It should include the line number, method names, and error name... info that would be incredibly helpful in helping you. | |
Re: I could be wrong, but I think that is what the sticky at the top of this forum is there for. ;) [url]http://www.daniweb.com/forums/thread99132.html[/url] | |
Re: An easy way to do this would be to google "Eclipse" and then download the Eclipse editor from their website. It comes with everything else you need (although if you don't know what you need, you should learn what those things are). | |
| |
Re: If you want to parse a String into Integers, use the method Integer.parseInt(stringParseableAsIntHere). If you're sending the String to a char array, you could use the " + " operator and "" to put it back as a String and use the parseInt method. | |
Re: So what is your definition of a subsequence? I still don't understand what you are saying at all. | |
Re: [url]http://www.daniweb.com/forums/announcement9-2.html[/url] Maybe that will help. | |
Re: Look at the Java Sun tutorial on ActionEvents and ActionListener. They have all the examples you need as well. I was able to learn all about them by myself, and so will you, if you read. If you have any specific questions, ask those... | |
Re: What error are you getting? Where do you need help? [B]Can you identify any portion of your code that isn't working as you expect it to?[/B] If so, how do you expect it to work? If you can't answer these questions, don't bother posting a question on this site because … | |
Re: See this [url]http://www.daniweb.com/forums/announcement9-2.html[/url] And your directions say to make it 'trivial to implement other letters' but I'm not sure how trivial it can be to do print output like this. It's not that difficult, but it was always aggravating to me. A relatively easy way to do this might be … | |
Re: Personally I would write this in C over Java. Only because Java is Object oriented and the problem you have posed isn't. Well sort of, but even more the fact that C will probably be much faster than Java for this project. Also, this topic has been posted on daniweb … | |
Re: You can't instantiate a 'Blob'. According to the API, it is an interface. You can, however, instantiate SerialBlob. | |
Re: Use code tags. [CODE]system.out.println("You entered a wrong month"); Should say: [B]S[/B]ystem.out.println .... [/CODE] And in at least one spot that I noticed, you're using "=" to compare things, when you should be using "==". One equals is used for assignment (to set day = today; for example), two equals are … | |
Re: You have to tell us what a multiple stack is. I don't think very many people have heard that term before. Then we can help you. If a multiple stack is just more than one stack, which would seem likely, then just use a Vector of Vectors. So a Vector … | |
Re: Post the code [I]in code tags[/I] that you think is incorrect, or at least post the compiler errors you are getting. | |
Re: ^ Huh? What S.o.S said is correct, and also, if I'm not mistaken, is what Eclipse and a lot of other IDE's and editors use to 'check' whether or not there is a syntax error (w/ parens and brackets). | |
Re: This might also be useful to you, as it gives greater control than most of the other layout managers. But I'm not sure why setSize isn't working... post your code? [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html[/url] |
The End.