7,116 Posted Topics
Re: "Executable" jars are not executable in the same sense as a .exe They are just a data repository, containing .class files etc, which must be processed by a java runtime executable (java.exe or javaw.exe). | |
Re: Put a JTextArea in the scroll pane, and keep adding your RSS text to the text area. | |
Re: OK, Java may be overkill for this app, but if your intention is to learn/practice some Java then... Start with the "business model" - the classes that will model the employees, sheets graded or whatever. The work upwards from there to the user interface, and downwards to the database (JavaDB … | |
Re: > say I have user A and want to be able to add some information (such as his age) about him, would I have to create another arraylist You can do that, but you will find it hard to keep the two arraylists synchronised (eg, suppose you want to sort … | |
Re: Forget the Java program for now. Try calculating the subordinate functions by hand with a pencil and paper. Think about how you did that. This will give you the logic you need. Now try to write that in Java. | |
Re: JTable has methods to `addColumn` and `removeColumn` which affect the visible table (but do not change the underlying table model). | |
Re: YOu can use a CardLayout to swap between different JPanels in a JFrame http://docs.oracle.com/javase/tutorial/uiswing/layout/visual.html#card | |
Re: Is this Java or JavaScript? ![]() | |
Re: You can use a java.util.Timer When you receive anything from the user, cancel any existing Timer and start a new one with a 2 hour delay. If the Timer's TimerTask ever runs it means 2 hours have expired without any input, so it can close the connection. | |
Re: Have a look at the URLDecoder class http://docs.oracle.com/javase/6/docs/api/java/net/URLDecoder.html | |
Re: You can sleep the current thread by using Thread's sleep method http://docs.oracle.com/javase/6/docs/api/java/lang/Thread.html#sleep%28long%29 ps: I assume you know that your constructor will loop recursively until you run out of memory? | |
Re: http://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners | |
Re: You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java … | |
Re: http://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners | |
Re: How are you running the program? In particular, if you run it with javaw.exe then there is no console. If so, run it with java.exe instead. | |
Re: That's not Java. Either re-post in the correct forum or let me know what language it is and I'll move it for you. | |
Re: What EXACTLY is the error message? | |
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: The "Java" way to do this is to create a tiny class with members for name, id, date. Then use the data to create one instance of that class for each line in the input file. Store those in an ArrayList, then sort as per the previous two posts. Because … | |
Re: There's no problem to search all the files names in a folder, or in opening a docx file once you've got it (assuming the machine has Word installed). I wonder if you really need the power (ie complexity/difficulty) of Java to do this - there are probably simpler tools to … | |
Re: You don't have any value for teamName - it's declared but never initialised. Presumably you intend at some stage to read it from the scanner, but for step-by-step testing (which, by the way is a VERY good thing to do) you could simply give it some temporary sensible value. Once … | |
Re: bob.henry: The first thing to learn here is "never just copy code that someone else has given you". No matter how well-intended they may be, and no matter how good the code is, you won't learn much. Maybe phorce could use his/her time now to help you learn how to … | |
Re: Why not just *Enum* (This is the common base class of all Java language enumeration types)? No need for generics. | |
Re: For mp3 files javazoom's javalayer is a popular choice: http://www.javazoom.net/javalayer/javalayer.html (ps: I have no connection, commercial or otherwise, with javazoom.) | |
Re: There are some simple layout managers, but sooner or later you want to get more precision and control than they offer. That's when it's time to get into GridBagLayout. Yes, it's intimidating at first with so many options, but that's what gives it it power. The layout you described (including … | |
Re: If you really must post an answer to a 6 year old thread, please make more of an effort to post decent code. Starting a line 2 (ignores Java naming standards), continuing with line 4 (throws exception from main instead of handling it), to line 6 (a pile of cryptic … | |
Re: Lines 13-15 look like a method definition, but they are right in the middle of an if inside another method. That has baffled the compiler and is the source of all three errors. Remember you can only define a method inside a class but outside any other method definitons. (OK, … | |
Re: ImageIO.read may return null rather than throwing an exception if, for example, it can't find a suitable decoder (not one of Sun's greatest decisions!) - so test for image == null after the read. You may also want to check what getWidth() and getHeight() are giving you there. You didn't … | |
Re: Use `Image`'s `getScaledInstance` method to resize an Image | |
Re: I doubt that anyone will study 139 lines of code to find your syntax error. Why not make it a bit easier by posting the exact complete error message? | |
Re: That's just the first part of a program, full of redundant (experimental?) code, and with some obvious mistakes (overriding paint, loading a new ImageIcon every time the user presses a key, repeatedly starting the same Timer... but most important, it doesn't show any code for adding or moving the enemy, … | |
Re: In practice it's limited by the available memory, but if each instance does not have big data members you can create tens of millions of instances | |
Re: You could put the data in an array of arrays.. int[][] data = {{12345, 13455}, {12745, 13755}, etc then use that to construct Sectors to add to the arraylist 17: sectors.add(new Sector(data[i][0]. data[i][1])); or have a Sector constructor that takes a two-element array, so it's just 17: sectors.add(new Sector(data[i]); | |
Re: Java is case-sensitive. "While" is not the same as "while". | |
Re: In your `getTableCellRendererComponent` method just test the `row` parameter to see if this is the first row, then return a JPanel or a JLabel as appropriate | |
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: It's highly unlikely that you have found a bug in Java's execution of if tests, so try a little debugging to confirm what's happening. Print B and PA immediately before the if test, put one print statement in the if, one in the else to confirm what is or isn't … | |
Re: `16: String A1 = rowSet.getString("County_ID");` Maybe this should be `String A1 = rowSet.getString("Town");` ? | |
Re: Your catch block is passed an Exception to tell you exactly what went wrong. You should always start by printing all that info: catch (Exception e) { e.printStackTrace(); ... | |
Re: There's no reason at all to use JFrames like that. (In fact it's not even legal to add a JFrame inside another JFrame.) Just use JPanels, add your components to them, and pack() them. The layout manager will sort out the sizes. If you do have a suicidal comittment to … | |
Re: OK, we're ready to help... but you need to explain your thoughts so far, then we can make suggestions from there. | |
Re: You declared getRotatedModel as returning a object of class Model, but the method does not return anything | |
Re: If you just want JComponents to disappear/reappear why not just setVisible(true/false)? | |
Re: It seems to me that the great majority of the people starting threads here are beginners/early stage learners anyway, so if there were a new forum as you suggest, what guidelines would you give people to tell them which forum to post in? | |
Re: Replace all your System.out.printf statements with add statements for your text area, using String's format method to format just like in printf. | |
Re: Your use of ArrayLists corresponds to how Java was years ago, before version 1.5, and that's why your calculations (line 50) are difficult. With modern Java you can declare what kind of Objects the ArrayList can hold, eg `ArrayList<Double> priceList = new ArrayList<Double>();` now Java knows the contents will always … | |
Re: The first thing to do is to fix your indentation to match exactly the { and } in your code. That will help you see where blocks end and which if's the else's match up with. If you are using an IDE or programmer's editor, use that for the indentation … | |
Re: `((javax.persistence.Query)null).getResultList();` What did you intend with this particular piece of syntax? | |
Re: Here is some (random) feedback on your program: There's not much wrong with that code really. This application is very small, and doesn't have much need for multiple classes or objects. You comment lines 11-27 with comments that add zero information to the code that follows, but then you have … | |
Re: You could open two connections, one for the file transfer and the other for the chat. Each would run in its own thread. |
The End.