1,678 Posted Topics
Re: MasterGoGo. . is there any reason you're using Panel, Frame, Button, etc instead of JPanel, JFrame, JButton, etc? Reason being because I believe the latter are more up to date. As another note, variable names are by convention lowercase for the first letter, for example names that follow convention: reset, … | |
The important code: [CODE] Browser browser = new Browser(shell, SWT.NONE); URL url = this.getClass().getResource("/example.html"); browser.setUrl(url.toString()); shell.open(); [/CODE] P.S. I've carefully considered what Masijade and others told me in the other thread; the example.html file is located in multiple locations, including in the same directory as the .class file. . I … | |
Re: Maybe I'm not sure what you are saying. But image that you created a bunch of private JFrames in Java. Would you expect other applications to be able to get the references to those JFrames? | |
Re: I'm not sure if you want to consider process different from process. or if you want to consider them the same thing. Which is it? If you create a Scanner, read in things one by one, put them into an ArrayList if they are unique words, and increment a counter … | |
Re: you didn't use code tags. read the stickies. all of them. completely. | |
Re: Yeah, have your class implement the Comparable interface, then use Collections.sort(ArrayList goes here). With ints it is probably even easier than that though,. | |
Re: After you set the size call frame.revalidate(). It might be frame.validate() though. If you're expecting the actual thing to resize in the netbeans editor window, you're going to be disappointed. That resizes the frame in the running application. At least I think it works, it's been awhile since I've done … | |
Re: [QUOTE=KirkPatrick;869386] 1) Is it possible to add 6 columns while the last column is a drop down menu that takes care of the last 10 textfields data which would be entered upon the submit button? [/QUOTE] You can find code similar to this on the Java tutorials by looking up … | |
Re: You compiled it and had a problem? Then post your error including the line number. . | |
Re: You could start by posting this in the javascript forum. If the mods don't move it first. | |
Re: Netbeans is not a compiler, it is an IDE and it helps you build GUI programs in swing, so it will compile things for you but it itself is not a compiler. I don't know what bluej is (sounds familiar). edit: posted at the same time. | |
Re: You didn't explain what happy vs. unhappy is. And you didn't post your code in code tags. | |
Re: Use the modulus operator, %. If you type modulus in google you can learn everything you need to know about it, and you'll see why you need to use it, so I won't explain further. | |
edit: I see a lot of other threads on Daniweb on this. But after 2+ hours of reading about Sound in Java, I'm even more frustrated, so I have some questions. 1. Is the Java Sound API sufficient for the following operations: Playing mp3 audio files, pausing, and fast forward/rewinding … | |
[CODE=Java]URL myurl = this.getClass().getResource("/SummaryReport.rptdesign"); File file = new File(myurl.getFile()); System.out.println("Name=" + file.getAbsolutePath()); [/CODE] The above code seems to get the resource. But I guess I am going about creating a file connected to that resource wrong? Because I cannot subsequently open a FileReader connected to that file. . I am … | |
![]() | Re: Making variables global for the sake of easily doing something is usually a bad programming practice. Instead, you'd usually make get methods and set methods to get your data and to modify it. ![]() |
Re: It also looks like you need to separate your logic into methods that each do one specific task. Right now your code is pretty hard to read and understand. | |
Re: The purpose was more than likely to do it with some sort of loop. Regardless, don't post full code solutions to entire programs. | |
Re: Yes. At the top of whatever method you are in, create an int variable called counter. int counter = 0; Then, whenever you go onto a new line, counter++;. If you need to use the counter in more than one method, then declare the variable as a class variable. | |
Re: I have a feeling you wrote it in your head but didn't actually type it Masijade. Cheater! Lol. | |
Re: A queue implementation, if you wanted to write it yourself, is simple enough that you could just start coding if you know what a queue is, so I'm thinking maybe you have a more specific question, a part of the queue implementation or a concept you don't understand? | |
Re: [CODE=Java]for(int scan = index+1; scan<list.length; scan++) if(list[scan].compareTo(list[min])<0) min = scan; temp = list[min]; list[min] = list[index]; list[index] = temp;[/CODE] You need to use code tags, i.e., what I used in this post. The problem might be your use of brackets; did you mean to use brackets after the if statement? | |
Re: Whenever you no longer need to use an Object in Java, if you simply get rid of any references to that Object, Garbage collection will take care of it from there. Set any references to that Object to null. | |
Re: You could download a picture of a mouse and then paint that image. Or, you could always get some mice from under my stove - I think that's where they're all hiding. | |
Re: To confirm his opinion: ShawnCPlus is absolutely correct. You'd be wise to follow his advice. | |
After a little research I discovered some Calendar methods that were pretty nice. [CODE=Java]Date date = new Date(); int daysSinceSeen = - ( rand.nextInt() % 365 ); Calendar calendar = Calendar.getInstance(); calendar.setTime(date); calendar.add(Calendar.DATE, daysSinceSeen);[/CODE] How could this code be returning a date in 2010? Do I have a bug that … | |
Re: I don't know very much C programming but I am pretty good at google. [url]http://www.elook.org/programming/c/strtok.html[/url] | |
Re: Some things you can do to help us help you: 1. Use code tags. There is a sticky at the top of the forum that explains how to use Java code tags to put your code in a format that will show up with line numbering next to it and … | |
Re: In Java you can think of 'this' as being the same thing as the name of the Object. So if you are in the class MyClass, 'this' is your MyClass Object. | |
Re: Which is exactly what Masijade seems to be addressing, except he did not go into much detail. At the very least, you'd need your PDF data in a separate class, and a simple "controller" that provided access to the data. | |
Re: And also post what error you are getting. If you are successfully reading in the radius, then 2 * radius should give you the diameter without problems as long as the radius is declared as the correct type (i.e. float or double). | |
Re: I don't understand your code, but it shouldn't matter what order the user enters the Dates in. You can still get the difference between them either way. Also: Use classes that already exist. [url]http://java.sun.com/j2se/1.4.2/docs/api/java/util/Date.html[/url] If you wanted to, you could extend Date and override the compareTo method, making it return … | |
Re: Put your code in code tags so that we can see what line numbers those are. | |
Re: You should not use Frame. Use JFrame. I've never even seen anyone use Frame before, so it's safe to say that it doesn't matter why it isn't working as long as using JFrame works for you. [url]http://java.sun.com/docs/books/tutorial/uiswing/components/frame.html[/url] And I think it's safe to ignore the warning about Serializable unless your … | |
Re: Hi... use code tags as explained in the stick. And what is your question/problem? | |
Re: And inner classes can provide specific functionality for their parent classes. There are relevant examples in the Sun tutorials on inner classes. | |
Re: Yes. Because you have no main method - you need to put any code (other than variable declarations) inside methods. The main method is the method that runs when you first start your program, *edit* Oops, nevermind - I see that you do have a main method. For statements like … | |
Re: Try to post things when you figure them out so that other people can see them. Not a big deal, just saying. [CODE=Java]final JOptionPane optionPane = new JOptionPane( "Yes or no?", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_OPTION);[/CODE] | |
Re: They are not going to do that. I've seen them refuse to do it before, and rightfully so. Anyway, by posting here or on any other site, you essentially give the site the right to display that work indefinitely. Are you afraid of failing a class or something? | |
| |
Re: So let me see if I understand. You have five "areas", each of which you want to be connected to the other areas, and you want to be able to adjust the size of each of them? Sun tutorial on JSplitPane, some paragraphs in: "You can divide screen space among … | |
Re: I'm an intern right now for a fairly large company - they gave me a job offer so I'll be working full time next year. I've been talking a lot to people at my company, and learning about a lot of technology currently used in industry, so I'd be glad … | |
Re: Your explanations at the bottom look like a teacher wrote them. Nice attempt at a disguise. Either way, we don't do projects for people - post your attempt at a solution, then we'll guide you. | |
Re: Hi John, thanks for using code tags. In the first part of the code tags though, it should say CODE=Java which will put line numbers. If you do that and then tell us which line numbers are relevant (i.e. where you arrive at the end of the copying, and what … | |
Re: The problem is that timeRepaintIn - Calendar.getInstance().getTimeInMillis() is a negative value. Which means that Calendar.getInstance().getTimeInMillis() is greater than timeRepaintIn. So you might want to rethink your logic on deciding how long to sleep for. | |
Re: [url]http://www.cs.usfca.edu/~wolber/SoftwareDev/C/CStructs.htm[/url] Use a Struct, put both of your linked lists in there. I forget how to make a linked list in C but I think all you need is two pointers, one for each linked list. Beyond that I can't help you, because if your linked list had to have … | |
Re: I'd say your first problem is your inability to use code tags, leading to nobody caring enough to waste their time to read your code. | |
Re: That's a good question, and one I can't answer. Question though: is there any reason you didn't use a CardLayout for the center panel or whichever one was displaying the frames? I think that would make the display easier to manage. | |
Re: You'd need to make use of the knowledge that each line is 11 columns long. So every first number you read in goes in the first column and so on. You can use the modulus % operator to figure out which column things go in. If the number of columns … | |
Re: This depends on how the user is indicating that they are done filling out the JTextField. Are they clicking a button? Is an event fired when the key is pressed? Since you didn't say I'll assume the user is clicking a button once they put their input in the text … |
The End.