7,116 Posted Topics
Re: You should know by now that when there's an exception message we want to know WHICH LINE IS IT ON! | |
Re: [This Oracle tutorial](http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#combobox) shows how to put a combo box ina JTable - it's exactly the same for a check box. | |
Re: Your processing is preventing Swing from getting any CPU cycles, so any GUI updates are blocked until your processing finishes. You need to read up on the Swing Event thread and the SwingWorker class. Start here http://docs.oracle.com/javase/tutorial/uiswing/concurrency/dispatch.html | |
Re: PriorityQueue inherits its toString() from java.util.AbstractCollection, which doesn't know about sort orders. (println uses toString() on all its arguments). If you poll() the elements as intended, you get them in the correct order, eg Integer i; while ((i = pq.poll())!= null) System.out.print(i + " "); | |
Re: OK!!! 1) Just for simplicity. You can have a GridBagLayout on a JPanel, but there's often less need for sub-panels to achieve your layout than there would be for some other managers. On average its still very common to see multiple JPanels - relating to different logical parts of the … | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules | |
Re: Also, multithreading isn't just a Java thing. If a language and its libraries don't implement support for multi-threading then they're no use in the real world of software deveopment. Multi-threading is conceptually difficult, and can be very hard to wrap your head around. Java's support for multi-threading is as easy … | |
Re: MarieSim seems to have been written in Java, but you can't write MARIE programs in Java, so you probably won't find anyone here who can help. It's whole purpose is to introduce machine-level machine code programming in a highly simplified virtual machine. A very quick Google on "marie programming" lead … | |
Re: Yes, and I would place the buttons as a GridLayout inside a JPanel, so the JFrame has a text field and a JPanel, one above the other. A loop to create the buttons is a good idea. There's no need to have an array of buttons - once created and … | |
Re: We don't have the specs for CustomPlayer, but most players have a listener interface where you can get a callback when the track has finished playing. That would be the best way to do it. If not, there's loads of stuff on how to use timers, both in the API … | |
Re: For formatted text don't use a JTextArea, use an editor pane or text pane. See http://docs.oracle.com/javase/tutorial/uiswing/components/editorpane.html | |
Re: No, not toString for the JList. By default JList calls toString on each object that it displays to get some text to put in the list. You could change toString for your Person class, but that will probably mess up all the other places where it's used. You could write … | |
Re: Hi, welcome to DaniWeb There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to … | |
Re: There's a real problem with Scanner's design - so many people fall into this trap. You have some input with an int followed by some text, eg 101 John Doe ... and you try to read it with int num = scanner.nextInt(); String name = scanner.nextLine(); ... and name is … | |
Re: > at myapp1.init(myapp1.java:39) tells you its on line 39, ie `add(c4);` the only thing that can be null in that is c4. You declare c4 on line 9, but you never seem to give it a value, so it's null. On line 21 you give c1 a value. On line … | |
Re: When it said "Recompile with -Xlint:unchecked for details." that wasn't just to fill in a bit of spare time" Do what it says and you will get a proper error message with details of the problem and the exact place where it was found. | |
Re: They are all variables. Some veriables are "primitives", eg int, float, boolean, char (See Java Language Spec section 4.2 for the complete list, but they alll have names that begin with a lower case letter. All the *classes* in standard Java have names the begin with an upper-case letter). They … | |
Re: Java doesn't know what it means for a Person to be "equal" to another Person, unless you define an "equals" method in your person class. If you don't define your own equals then you inherit one from Object - which is just the same as ==, ie is exactly the … | |
Re: The simplest way is to use multiple JPanels to organise the groups of controls. eg Place 3 JPanels in your JFrame, flowing left to right. In the first one add the two checkboxes, in the second add the x,y labels and fields, in the third add the buttons. In each … | |
Re: The error message tells you exactly what the error was and the exact line where the error occurred. That would be very useful information to share. | |
Re: Have you tried a "clean and build" on the project? | |
Re: You can use a String array to hold all the previous answers and print them later. An ArrayList of Strings would be even better, if you have got that far in your Java course. | |
Re: Opening tags have stuff between `less than` and `greater than` symbols. Closing tags ditto, but the first thing after the opening `less than` is a `forward slash`. That should be enough for you to tell which is which and process or ignore them accordingly. | |
Re: 13: java.lang.NullPointerException 14: at DatabaseManager.getFaculty(DatabaseManager.java:14) would be a good place to start looking... | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there. | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there. | |
Re: Card swap = deck[k]; deck[N] = deck[k]; deck[k] = deck[N]; Here's a problem. You don't use "swap", you just put the original entry back. | |
Re: NetBeans is the "standard" Java development environment, and includes D&D window building etc. But stultuske is right - you may learn how to D&D but you won't learn how windows are built and operate in Java. Then, when you want to do something just a bit more complex, you'll be … | |
Re: No need to delete - this solution may be useful to someone else. I've marked it "solved" J | |
Re: http://docs.oracle.com/javase/tutorial/uiswing/components/filechooser.html | |
Re: The Date class was there in the very first Javas, but it was a poor piece of design - it doesn't handle time zones etc, wich makes it essentially useless for anything real. It was replaced by the Calendar interface, which has an implementation in the GregorianCalendar class. This is … | |
Re: Any special reason to use BYE_BINARY rather than the obvious int ARGB? | |
Re: Welcome to DaniWeb. "get an error here" tells us nothing. If you have a compiler or runtime error message please post the complete message plus the actual code it refers to. If your code is giving an incorrect result explain what result you get and what the correct result should … | |
Re: You didn't post the requirements definition, so we have to guess exactly what you were asked to do, but ... at a guess ... Either: Your expenses need to have a month number associated with them ( a third array? or: Each month should have its own arrays of items … | |
Re: The question is pretty vague, but seems to be in two parts: How to display random image? Have an array containing all the file names and pick a value from it using a random integer. You can get an array of all the files with a particular extension in a … | |
Re: Maybe its a problem with the byte arithmetic? The RGB byte values are unsigned (0 to +255), but Java bytes are signed (-128 to +127). You may need to do some masking (ANDing with hex FF) to stop the first bit being propogated as a sign bit when you convert … | |
Re: You should have created a "get" method in your machine class(es) to allow other classes to access the x,y coords. (If you have designed your classes to be immutable, then it's easier to declare the instance variables as `public final` to make them accessible.) How have you created you "master" … | |
Re: You can work with `setMinimumSize` to have a minimum height and width, (and `pack()`, of course), but that gives you no control over the width or where it will flow onto a new line. `setMaximumSize` may allow you to force it onto a new line, but the size is in … | |
Re: Sorry, it looks like you may be out of luck. I don't think there are many JavaFX users active in this forum (yet). Still, don't give up too soon - people are still coming back after the New Year. | |
Re: This was already covered in your previous thread. You use a Layout Manager. See http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html and http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html | |
Re: You *can* set the layout manager for the container to `null`, then use `setBounds` to set the size and position of your label in pixels. However, if you do it's going to look very silly when someone runs your code on a screen with "retina" resolution, or even just on … | |
Re: You have created Die as an inner class, but there's no reason to do that. I would move the declaration of Die to outside the JavaMonopoly class. | |
Re: It's a classic double-declaration problem. YOu have created two different "contentPane" variables. 13 protected JPanel contentPane; this is the contentPane variable that you use in the actionPeformed and which is initially null, and which is never initialised by you 26 JPanel contentPane = new JPanel(); this is the local variable … | |
Re: One way is for the app to link to a server that you control somewhere to check the trial licence period. | |
Re: ByteStreams looks like a Google Java class. I haven't tried this, but maybe you could try `ImageIO.read(blob2.getBinaryStream())` to get the image then pass that to an ImageIcon constructor. | |
Re: DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there. | |
Re: Where you create them and where you store them are two different things. It may be best for the Game class to have responsibility for creating everything, including Items, but then immediately adding them to the appropriate Inventory. Coupling is always a bit of a question in respect of the … | |
Re: http://www.daniweb.com/software-development/java/threads/99132/starting-java-java-tutorials-resources-faq | |
Re: Hi Vicky, welcome to DaniWeb. Start here: http://www.daniweb.com/software-development/java/threads/99132/starting-java-java-tutorials-resources-faq |
The End.