3,927 Posted Topics
Re: Keep in mind that you won't get any sixes with that code for the random numbers. You'll get 0-5. You need to add one if you wish to work with 1-6 as your range. | |
| |
Re: Well, posting the error might help. We can't read your screen from here you know. | |
Re: You use File and the various input streams, just like any other file you would access. The CD rom is just another drive, you know. | |
Re: [QUOTE=kumarprabu;637391]change ur for loop like this and add new Frame() in ur JOptionPane [ICODE] for (int i = 0; i < count; i++) { System.out.print(studentScores[i] + " "); // Declare and initialize output JOptionPane.showMessageDialog(new Frame(), "Student Name: " + studentName + "\nScores: " + studentScores[i] + " " + "\nAverage: … | |
Re: Take a look at some of the methods on the [URL="file:///C:/Program%20Files/Java/jdk1.5.0_03/docs/api/java/lang/Long.html"]Long[/URL] and [URL="file:///C:/Program%20Files/Java/jdk1.5.0_03/docs/api/java/math/BigInteger.html"]BigInteger[/URL] classes. | |
Re: [QUOTE=technogeek_42;587035]and Y do u say it so...?[/QUOTE] Because it's the truth. A quick review of your post history is confirmation. | |
Re: Who knows? Never heard of "ArrayInitializer". Though that code does not compile due to a missing semi-colon, and it does not produce a correct result if corrected to compile. | |
| |
Re: A couple of System.out.println() statements at a few key points could probably illuminate exactly what it is trying to copy where in short order. If you are using an IDE with a debugger, stepping though would be even faster. | |
Re: Help with what? You haven't posted a question, and it's certainly not urgent to anyone here. | |
Re: Right-click is easy to handle[code]jButton1.addMouseListener(new MouseAdapter(){ public void mouseClicked(MouseEvent e){ JOptionPane.showMessageDialog(null,"Right-click stuff"); } });[/code]Changing the button select color is easy if you are wanting to change it for [U]all[/U] buttons in your program - even the ones that appear on dialogs and such. For that you can set "Button.select" property … | |
Re: Just run it like any other java file, from either the right-click menu or the Run menu. Netbeans will start it in the Applet Viewer. | |
Re: Please be aware that Javascript has it's own forum. This is the Java programming language forum. | |
Re: [QUOTE=mattsh;634578]But when I get into the second while loop, and try to access the information read in the first while loop (case 14), it is no longer there. That's when I get the "[B]The local variable tokens2 may not have been initialized.[/B]" message.[/quote]That is because you only assign the variable … | |
Re: You can "Flag Bad Post" on it and ask that it be moved to a different forum. | |
Re: Buttons that don't react to any events are pretty useless wouldn't you say? Maybe you should use JLabels instead? If you are wanting a praticular behavior from the buttons, you should describe it a little better, because what you have posted here isn't clear at all. | |
Re: Your images are not appearing on the panel because this code is so riddled with errors that it won't even compile, much less run correctly. Post some working code and then perhaps your question can be addressed. | |
Re: Why do you need to use a StringBuilder or StringBuffer prior to writing the data to a text file? Is there a reason you can't just use a BufferedWriter? StringBuilder and StringBuffer are the preferred way to construct long strings from many smaller strings or characters, instead of a large … | |
Re: Ok, the only thing preventing your loop from working is that that the call to hasNextInt() does not actually read (advance) past the input, it just determines what is there. If you enter a number then your code reads it with the nextInt() call, but if something other than an … | |
Re: I haven't messed around with styled text panes much, so there may be a more appropriate way to do this, but I did get it to alternate the alignment with the following listener: (txtInput is just a text field component and I pass the listener a reference to the text … | |
Re: Well, unless your BaseConversion.stackreturn() method throws that exception, nothing else in that code will. It looks like you are actually wanting to catch NumberFormatException from the parseInt() call. Read the API doc on that method: [url]http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#parseInt(java.lang.String[/url]) There's a lot of useful into in those docs - use them. | |
Re: Microsoft has one as well: [url]http://msdn.microsoft.com/en-us/data/aa937724.aspx[/url] As masijade said, this info takes mere seconds to find with Google - use it. If you encounter difficulties finding an answer [U]then[/U] post a question. We certainly aren't going to "write some sample code" for you, if you can't even take the time … | |
Re: You can either print it directly through the printing APIs: [url]http://java.sun.com/docs/books/tutorial/2d/printing/index.html[/url] or use a report engine like the [URL="http://reporting.pentaho.org/"]Pentaho Reporting Engine (formerly JFreeReport)[/URL] | |
Re: Returning results whether they match or not defeats the entire purpose of regex. If you want to split input into groups, you obviously have an idea as to how you want that data broken out. Those decisions drive the design of those capturing group patterns. They can be very broad … | |
Re: The thread was not yours to start with and you merely hijacked it with useless questions. Asking to have someone else's thread closed after you ruined it with gibberish is just foolish. It would have probably finished on its own 33 days ago if you had just left it alone. | |
Re: Wander outside for a smoke or a walk around the building. As mentioned, the nude thing just wouldn't work in the office - and I don't touch code when I'm at home with the exception of a very rare occurrence of having to remote in or work from home. | |
Re: Technically none of those will work as written, but your original is only wrong by one detail[code=java]MySuperType mytype = null; if (sub_type) { mytype = new MySubType (); // this is fine mytype.setD(4); // these will fail to compile mytype.setE(5); } else { mytype = new MySuperType (); } mytype.setA(1); … | |
Re: [QUOTE=Software guy;630665]hi I am an engineering student as well , i jus did my second year exams , i dont know abt .NET but java is very helpful , i am doing java this summer. Anyways it all depends on the type of engineering u doing , if its electronic … | |
Re: You could certainly define a [URL="http://java.sun.com/javase/6/docs/api/java/lang/Runnable.html"]Runnable[/URL] or [URL="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Callable.html"]Callable[/URL] task that takes a list of IDs to update and queue multiple [URL="http://java.sun.com/javase/6/docs/api/java/util/concurrent/FutureTask.html"]FutureTasks[/URL] on a thread pool [URL="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Executors.html"]Executor[/URL]. | |
Re: I don't know who this "u" person is, but simply put that condition in your cell renderer. If you can update it once, you can certainly write a condition that determines if it should be updated again or stay the same. | |
Re: [QUOTE=niek_e;621250]No they shouldn't. But Starbucks doesn't have a "singles table" right?[/QUOTE] This. A lounge thread is one thing, but a "Singles Scene" forum really has no relation to a technical forum site. A dating forum is a different genre altogther and adding one would only serve to commingle unrelated user … | |
Re: How did it come about that you are supposed to solve a problem with this method for your thesis, yet you don't even know what it is? | |
Re: Place your components on a JPanel instead and override the paintComponent method of that JPanel to paint the image[code]ImagePanel = new javax.swing.JPanel(){ Image img = new ImageIcon(getClass().getResource( "images/blackX.gif")).getImage(); public void paintComponent(Graphics g){ g.drawImage(img, 0, 0, getWidth(), getHeight(), this); } };[/code] | |
Re: Try [URL="http://www.lowagie.com/iText/"]iText[/URL] for PDF processing. | |
Re: [QUOTE=ithelp;625954]In unix is device is represented as a file , open it read , write it.[/QUOTE] What? This is even less coherent than the poster's question. rainny, you need to restate the question and provide a little more info on what you are trying to do. As written, it is … | |
Re: The instructions are very clear. You have to add an array to that class to store each "advice". The add method should add that string to the array and the get method should return a random entry from that array. Short of telling you exactly how to do it, I … | |
Re: [QUOTE=ladie-loo@hotma;624561]i am so confused were am i? i was only trying to find a site where you can chat to yer mates like msn... can u help me?[/QUOTE] Oh, you want the site just down the street for that. It's the blue one on the left. | |
Re: Take a look at the [URL="http://java.sun.com/javase/6/docs/api/java/util/Map.html#keySet()"]Map.keySet()[/URL] method. It will return a Set of the keys in the map. A for-each on that Set will allow you to compare the key value easily and Map.put(key, value) will replace the value if key already exists in the map. You should be able … | |
Re: Most of the example I can find use a small inner class for the Authenticator, such as[code]private class SMTPAuthenticator extends javax.mail.Authenticator { public PasswordAuthentication getPasswordAuthentication() { String username = SMTP_AUTH_USER; String password = SMTP_AUTH_PWD; return new PasswordAuthentication(username, password); } }[/code] The full example is here: [url]http://www.rgagnon.com/javadetails/java-0538.html[/url] | |
Re: Well, replace selection only replaces selected text. Why are you not using setText()? You may want to consider grouping the text entry components into a collection (List or Map perhaps) to make mass operations like that easier to handle. | |
Re: They can share the same UndoableEditListener. Example[code=java] import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.JComponent; import javax.swing.KeyStroke; import javax.swing.event.UndoableEditEvent; import javax.swing.event.UndoableEditListener; import javax.swing.undo.CannotUndoException; import javax.swing.undo.UndoManager; public class UndoDmeo extends javax.swing.JFrame { private javax.swing.JTextField txt1; private javax.swing.JTextField txt2; final UndoManager undo = new UndoManager(); final UndoableEditListener editListener = new UndoableEditListener() { public void … | |
Re: You need to cast e.getSource() to an appropriate type that implements the paste() method. | |
Re: Swing is a single-threaded event model. If you are executing the code that updates the table in a button action listener then you are essentially "holding-up" processing other UI events like repaints, table updates, etc. If you want the table to update over the course of a long running process … | |
Re: From what I can tell, JCreator has build capabilities that should allow you to create the jar within the IDE. After you have learned to create it from the command line (which you definitely should learn to do), you should also learn how to do it with the IDE build … | |
Re: It should work just fine for those components provided those character sets are available on your machine. This shows a bow-tie for me with no other setup[code]JOptionPane.showMessageDialog(null,"\u22c8");[/code] | |
Re: Read the API doc for [URL="http://java.sun.com/javase/6/docs/api/java/util/ArrayList.html#add(int,%20E)"]ArrayList.add(int,E)[/URL] It states that will be thrown if index < 0 or index > size(). Your error message gives that information to you as well. How can you insert an element at index position 1 when size is 0? The indexes are zero-based, so you … | |
Re: Not if you don't post the code. We really can't speculate what you have written. | |
Re: If you want step-by-step guidance then you need to hire a private instructor or seek out books and tutorials laid out in such a manner. peter_budo gave you the first step. It's up to you to follow it. We're here if you have questions. |
The End.