3,927 Posted Topics
Re: Bleh, got back to this thread just a little too late I guess, but perhaps you will still see this post. If you wish to organize the UI sections in a more modular and manageable way, you might consider this arrangement[code=java] import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Interface … | |
Re: This really has nothing to do with Java and a quick search would have yielded an answer: [url]http://en.wikipedia.org/wiki/32-bit_processor[/url] | |
Re: You can't at this point. The "EmailSender" class has no methods to interact with and is just a series of commands in main(). You'll have to re-write "EmailSender" to be a class with methods to set the parameters for the email and a send() method to send it. The interface … | |
Re: I don't think you want to increment "i" here [code]for (int j = 0; j<grid[0].length; i++){[/code] :P | |
Re: Add a stack trace to the catch block for ClassNotFoundException[code]} catch (ClassNotFoundException notfound) { notfound.printStackTrace(); lName.setText("Illegal Information in address book file ..."); }[/code]If your code above compiles and does not complain "symbol" not found about the "controller" class, then it's probably a class within "controller" that is causing your problem. … | |
Re: comjisu33, based on sukatoa's response it looks like your original code was quite different and you edited it after the response. If you make changes to the code, make a new reply with those changes instead of altering the original. After your edits, sukatoa's response seems to make no sense … | |
Re: What part is "wrong" in your estimation? Wrong is a pretty broad area. Just glancing at the smooth() method it looks like a basic 3 point moving average. Where is the issue? | |
Re: "execution is stopped" isn't a lot of information to go on. You have an exception? What is it exactly? The code just never returns from that method? You're going to need to give a little bit more detail on your issue if you expect anyone to offer some advice. | |
Re: Well, you didn't ask any questions. You just posted your assignment, and certainly no one is going to just write it for you. Post the code that you have written for the assignment and specific questions or error messages that are giving you trouble. | |
Re: You probably need to flush the Image resources. Try adding this to see if it gets rid of the cached image[code]ImageIcon oldIcon = (ImageIcon)jLabel3.getIcon(); oldIcon.getImage().flush(); Icon icon = new ImageIcon("graph.png"); jLabel3.setIcon(icon);[/code] Is there a reason that it has to generate a .png instead of rendering directly to the screen? | |
Re: Take a look at [URL="http://java.sun.com/javase/6/docs/api/javax/swing/JTree.html"]JTree[/URL] and [URL="http://java.sun.com/docs/books/tutorial/uiswing/components/tree.html"]How To Use Trees[/URL]. If you don't want to use a JTree then you'll have to decide just how you want to represent that data and how you want to interact with it. | |
Re: I think your trouble is actually these two lines[code] buttonCalc.addActionListener(this); buttonClear.addActionListener(this);[/code] because you never initialize those buttons. There is nothing wrong with the line that you posted. | |
Re: Just call [URL="http://java.sun.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html#removeRow(int)"]DefaultTableModel.removeRow(int)[/URL] on the TableModel. You will need to cast it to DefaultTableModel to call that method, since it is not part of the TableModel interface. | |
Re: [QUOTE=Taz x;590907]im doing a java project on creating a music database, i need to store an array of cd objects, each entry in the array will be a single object for a cd. The objects are: Artist, Album, No of tracks could sum1 point me in d right direction, thanks[/QUOTE] … | |
Re: What error specifically and what have you tried to resolve it? | |
Re: This tutorial might provide a starting point on the design: [url]http://www.javacoffeebreak.com/text-adventure/index.html[/url] | |
Re: Check your project properties and make sure that in "Libraries" you have selected the 1.6 platform and that in "Sources" you have selected JDK 6 for "Source/Binary Format". | |
Re: Also, with the basic structure that Peter showed above, if your game classes extend JPanel (or a similar container class), you can swap that game panel in to replace your menu panel and then swap it back if they exit the game. | |
Re: If you have a reference to the Element you can simply use the Element.setTextContent(String) method. After you have updated all of the DOM elements as needed, just write it back to a file: [url]http://java.sun.com/j2ee/1.4/docs/tutorial/doc/JAXPXSLT4.html[/url] | |
Re: You would be much less stressed if you paid attention in class and started your homework before the day that it was due. This forum is not a homework completion service. Good luck with your studies. | |
Re: [QUOTE=imma.infotech;592186]i am preparing for placement..please help me to become expert in c,c++java...by tutorials[/QUOTE] Sorry to burst your bubble, but you are not going to become an expert in any of those through tutorials. | |
Re: Start with a simple tutorial on JTable: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/table.html[/url] (These examples that you keep asking for are incredibly easy to locate with a very simple search. You should take a little initiative to find them before asking others to give them to you.) | |
Re: [QUOTE=The Dude;585956]Hi guys... This is a petition against the [b]live[/b] skinning of cats,dogs and other animals in China. [/quote]Of course it's live skinning - the dead have a hard time handling knives. [QUOTE=The Dude;585956][b]Please be aware if you click on the video it is VERY GRAPHIC - the most disturbing,graphic … | |
Re: Sorry, not going to do your homework assignment for you. If you want to post what code you do have done and ask specific questions, someone may be able to provide some advice. | |
Re: Well, the only piece of the code you wrote that will be of any use for that assignment at all is the Scanner (though a BufferedReader would be my own choice for that). The instructions are pretty clearly laid out and does tell you what you need to use from … | |
Re: After you have computed the quarterly totals and before you display the differences seems like a pretty good candidate. | |
Re: They're great! I find myself annoyed now at other forums that don't have them :) | |
Re: You have executed a new query here through your statement so the result set you obtained with that statement is no longer valid and you cannot retrieve field values from it.[code=java]stmt.execute( "DROP TABLE " + rs.getString(1));[/code] Create a separate statement object to make your "DROP TABLE" calls with.[code=java]PreparedStatement updateStmt = … | |
Re: In the first version you declared that the method returned a double value, but it does not return anything at all - hence that "missing return statement". If your method declares a return type, it has to return a value of that type. | |
Re: Well, the documentation at [url]http://www.superwaba.com.br/en/default.asp[/url] would certainly be the best place to start. This has little to do with the standard Java APIs. | |
![]() | Re: The code to read into the array looks reasonable enough, though your while loop should use scanner.hasNext() to determine if more tokens are available before calling next() and you will need to guard against overflowing your array length. The code at the top to read the text file is never … |
Re: Well, I guess that depends on what you have covered in class so far. My guess would be simple file I/O with a BufferedWriter. Review your class notes. | |
Re: [QUOTE=harisagar;589644]help me or keep quiet i don't need your suggestions:angry:[/QUOTE] I think you just threw all of your chances for any help here right out the window. | |
Re: You can't set the system time in Java without making system-specific calls through a Process or with JNI. | |
Re: You just used the wrong method call for the Frame sizing - easy to fix. [URL="http://java.sun.com/javase/6/docs/api/java/awt/Window.html#setSize(java.awt.Dimension)"]setSize()[/URL] will take either a (width,height) or a Dimension argument. There is another method [URL="http://java.sun.com/javase/6/docs/api/java/awt/Window.html#setBounds(int,%20int,%20int,%20int)"]setBounds()[/URL] that takes (x,y,width,height), which is probably the one you are trying to use. | |
Re: Use String.split(), which will return an array of Strings that result from the split on your expression. You can then work with the characters in the string from that portion separately. | |
Re: [QUOTE=techbound;586575]I am unsure of the author because it didnt state it, but anyway here it is.[/QUOTE] Nope. It was lame. | |
Re: [QUOTE=kv79;588425]I know the answer on my question .[/QUOTE] That's good - because most of us could not understand it to offer you one :P | |
Re: You have to cast them to the appropriate type if you wish to call methods on them. To call ArrayList methods on an Object you retrieved you would do this[code]ArrayList retrievedList = (ArrayList) otherBigList.get(0); retrievedList.someListMethod();[/code]That's the technical aspect of it. The bigger question is why are you storing a mixed … | |
Re: Yep, you are still missing the close of some block or expression. Check the braces, semi-colons, and parenthesis in the code above the [icode]public double match(String addr)[/icode] line. Strict adherence to proper indentation will help a lot in seeing structural errors like this. | |
Re: I think that would depend upon how long pondering the question held you up. | |
Re: JAI offers plenty of functions for your task, but if you are expecting to find some "MatchImage" API you are probably out of luck. You have to code such algorithms yourself because there are many ways to go about it. | |
Re: Not sure what you are doing with the "hash.t..." stuff there and the whole operation seems odd, but this will put "elephant" and it's value from "hash" value into hash2[code=java]hash2.put("elephant", ((WhateverClassForAnimal)hash.get("elephant")).getDescrip());[/code]If you typed the HashMaps with generics then you can drop the cast to WhateverClassForAnimal. | |
Re: It looks like you are trying to execute that from the command line directly ("java Draw"). Applets cannot be run like that. They need to be embedded in a web page or run through the AppletViewer. You can find more info in the Applet tutorial: [url]http://java.sun.com/docs/books/tutorial/deployment/applet/deployindex.html[/url] | |
Re: Use English, not "text-speak", and first make your own attempt at your homework. Please read the rules and FAQ for the terms of the forum. | |
Re: Trying to Find the imp in the system that has been Needlessly Capitalizing Words and stealing Punctuation Whats Up With You | |
| |
Re: And what problem would that be? The JVM manages the memory allocation when an object is created and the garbage collector frees that memory when there are no more references to the object. What exactly is your question? | |
Re: On a side-note, change your class name and variable names to something less meaningless. Descriptive names for classes, variables, and methods are immensely helpful to both you and others who read the code. Also, after 22 posts here you should get familiar with [noparse][code] [/code][/noparse] tags and [U]use them[/U]. |
The End.