1,678 Posted Topics
![]() | Re: setSelected(true) would make a check box checked, setSelected(false) would make the check box unchecked. It does the equivalent for a JToggleButton, so I imagine it'd make it appear pressed if you set it to true. |
Re: Then use a JPanel for your splash screen, but add the JPanel to a JFrame, and set it to visible. | |
Re: That is a lot of code - the short answer is that you'd use a JComboBox. It's fairly simple and there are plenty of examples here: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/combobox.html[/url] | |
Re: There are a lot of tutorials available on the web, some of which were linked to in this forum in the stick that was mentioned before. Use those. Ask questions. Get help. | |
Re: I couldn't disagree with you more, PirateTUX. Jurors are forbidden from doing this kind of research because it introduces bias into the process and it takes control away from the court. Anyone who is doing outside research is introducing "facts" which may or may not be true and is researching … | |
Hey guys, I bought a new computer with 4 gigs of ram, 64 bit windows vista OS, dual core 2.4 ghz processor. . and I'm having some problems with it. Firefox frequently seems to mess up. Sometimes it won't stop loading a page when I click 'X', it will become … | |
Re: Yeah, I can't enter a consonant either. I tried doing so in all of the open text boxes. | |
Re: RPS is an extremely simple game. . because of that, it isn't really necessary to do it OP style - what would your objects be? The Rock, Paper, and Scissors need not be Objects because they are better represented as Strings (in my opinion). I suppose you could make the … | |
Re: I'm not sure about this, but I think using Collections.sort(yourArray) would also do the same thing javaAddict is suggesting. But it seems like your assignment is to write the sorting method yourself, so you'll need to specify what vernon mentioned. | |
Re: This sounds like a very cool project - one I can't help with - but please post the solution once you've worked your way through it! | |
Re: Vernon already gave you great advice. . I noticed you have the following line of code: [CODE=Java]double totalOilChangeCost = (distanceTravel / 3000) * 30;[/CODE] Since distanceTravel is an integer, and 3000 and 30 are integers, the whole expression will, I think, result in an integer. You can use a println … | |
Re: You can also use Java 3D for 3D graphics. A lot of people use OpenGL bindings for Java also. | |
Re: If you want to print a price list and then print a receipt, one good way to do it would be to look at the similarities: both a receipt and a price list contain items. So you could build an item class that had variables such as cost and sales … | |
Re: I don't think Java 3D is a dead technology. . but I asked a similar question of an enterprise developer, and he said that he thinks OpenGL for Java is better than Java 3D. I've heard that OpenGL with C++ is faster though. | |
Re: All you need to do to draw the circle in its final position is call repaint, set the coordinates of where you want the circle to be drawn, then draw the circle at that position. You'd put the method calls to do that inside of mouseReleased. | |
Re: I don't really see anything wrong. You said they are JPanels but they are JLabels. (You can set the background on either, so again, no problem). Do you mind posting your code? | |
Re: "What I am not checking for is a character response." You can look into ASCII character values; in order to make sure that something is an integer (or is not a character), you would compare the character to a range of ASCII values which can be found on the table. … | |
Re: GridBagLayout gives you a pretty good deal of customizability.. [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/gridbag.html[/url] Alternatively, you could stick with whatever Layout Manager you're using and explicitly set the size of the text fields using setSize or setPreferredSize - either of those should stop the text fields from taking up the whole window. | |
Re: Yes, both are possible. Resizing the image may be tough but it is definitely possible, however, you'll have to wait on someone else to answer how to go about doing that. For forcing a window to stay open until a correct password is entered, you'd look into WindowListener. [url]http://java.sun.com/docs/books/tutorial/uiswing/events/windowlistener.html[/url] | |
Re: Have you read about JMF? There are a lot of explanations of why it is difficult to do things such as writing pause methods for audio clips. And there is guidance to how to accomplish doing it if you really decide to take on the challenge. | |
Re: popupPanel.setLayout(null); ^^ Looks like a bad idea although the layout manager might use a default layout as a result of you doing that. Although it was already using a default layout so.. why? You also might want to try calling the pack() method on the popupPanel. Perhaps setVisible as well. … | |
Re: This isn't a website for hand holding. The information is readily available. Look it up. Figure it out. | |
Re: Try to avoid giving people solutions unless it is impossible to help them without pointing out the exact code. | |
Re: "However, since I've only learnt Linked List so far so I thought that playing some tricks on Linked List would do create the Circular." You are pretty much correct. The differences that I can think of off the top of my head: 1) Obviously, the circularly linked list needs a … | |
Re: I'm not sure that this is the issue, but just so you know, the while loop condition is only going to be checked [I]after[/I] the method call that is inside the while loop completes. You probably knew that. Other than that, I'm not sure I understand what problem you're having. … | |
Re: terence - I apologize for not having comments on your code, but I just don't have time to wade through it right now. But keep in mind that comments should be used for clarifying the code when it is necessary to do so, or for explaining what a line (or … | |
Re: You can accomplish this in a number of ways using Swing and basically every other GUI toolkit available. Swing is easy to learn though, and it can be accomplished with only one panel, but peter's suggestion is good. | |
Re: And why can't he override paintComponent, setting the color to whatever he wants, using the drawString method to write text, then changing the color when he wants to? | |
Re: php is not a programming language it is a scripting language. | |
Re: If you just want something to practice then just go to a college's website, find the level course that matches your skill level, and do a random project on there. We aren't here to give project ideas. | |
Re: I'd recommend JFreeChart. It isn't that hard to use. I'll tell you what, I'll give you a sample piece of code that my teammate wrote on our project that produces a bar graph. You'll have to edit it a lot (hopefully) to get what you want, but it should give … | |
Re: The method you must implement has the method header commandAction(Command, Displayable) whereas the method you wrote has the method header CommandAction(Command, Displayable). These are considered two different methods since Java is case sensitive, which is why you're getting the error. Also, keep in mind that commandAction follows the recommended syntax … | |
Re: [url]http://en.wikipedia.org/wiki/JavaOS[/url] yes | |
Re: [CODE=Java]If you truly made an effort to use the code tags you would have used them correctly. There is a sticky at the top of the forum showing how to use them. There is a button on the post reply box that inserts code tags. You can also "reply w/ … | |
Re: "...and in a specific spot on the page?" I don't understand. Where on the page do you want it to print? | |
Re: If your inner classes are implemented in a way that does not cause a compiler error, I do not think you can get errors such as memory leaks or anything of that nature. However, when defining inner classes inside an abstract class, I'd be careful about what techniques and syntax … | |
Re: I'm not sure of your level of experience so I'll post this just in case you don't know stack issues, which you may: [url]http://en.wikipedia.org/wiki/Stack_overflow[/url] | |
Re: Use the setSize method. The preferred size is just that - preferred. The layout manager is probably ignoring your preference, whereas if you use setSize, you might have better luck. Oh, and set the size of the scroll pane, which contains the other object. If that doesn't work try setting … | |
Re: Post the code for your class in the code=java code tags and I'll help you solve this error. I've gotten similar errors before as well. If you don't know how to use code tags then read the sticky at the top of this forum. | |
Re: Easy to use or easy to build? I recommend Java, although surely I'm pretty quick to recommend Java so you might want some other opinions as well. Java is great for user interfaces - ease of programming and ease of use, but I'm not so sure about processor and time … | |
Re: First of all it looks like you have a bunch of arrays that contain related information. . the item number, price of DVD, and name of a DVD all go together, correct? If the answer is yes, then you should create a class, perhaps called DVD, that has the necessary … | |
Re: You can't "dynamically name" variables in Java. I don't know of any language where you can do that, although one might exist. I might be confused by what you're trying to do, but there is a LinkedList class in Java. If you were to use [CODE=Java] LinkedList<YourClassnameHere> list = new … | |
Re: An easier way to do it might be to have a JPanel inside a JPanel. The outer JPanel would use a BorderLayout, and the JPanel that you add to that one would have a GridLayout with one column. The idea being that when you added the second JPanel to the … | |
Re: Yes. Use the getResource method. You can find a lot of stuff on daniweb in this forum about loading images. Try this first though. [url]http://java.sun.com/docs/books/tutorial/uiswing/components/icon.html[/url] ] | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#combobox[/url] | |
Re: Correct. You have no entry point for your application (it can not run). The correct declaration is public static void main(String[] args). You're missing the brackets. Also, the code tags that you would have used had you read the forum rules. :) | |
Re: I don't understand your description. You want to "break" after a parameter like value is displayed? What? And how can you do something after 30 threads, when you only have one thread running in your program? | |
Re: How about you show us your code. Because I'm almost positive that calling setVisible on a JButton will work, so your code must be setting it to visible again after you set it to "invisible". | |
Re: It doesn't work because you declared a variable, "c", inside of a for loop. When that for loop ended, that variable went out of scope (was destroyed). So in the next for loop where you tried to refer to "c", the compiler has no idea what you're talking about. |
The End.