1,963 Posted Topics
Re: So search for examples on how to read and write to a file. There are plenty in this forum. Also where are you having problems with? | |
Re: Actually, If I may add, it does not print the memory address. That is the hashcode of the object. When you call the [ICODE]System.out.println(anObject)[/ICODE] what it actually does is call the toString method: [ICODE]System.out.println(anObject.toString())[/ICODE] Since you haven't overridden the toString method it uses the one from the super class the … | |
Re: What do you mean each cell element. What do you want to do with the Jtable at the GUI ? | |
Re: You can pass to the KeyPad constructor the element you want to change. [CODE] JLabel label = new JLabel("THIS IS THE LABEL"); Keypad key1 = new Keypad(label); [/CODE] [CODE] public class Keypad extends JPanel{ private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12; [B][COLOR="green"]private JLabel label; public Keypad(JLabel lbl) { this.label = lbl; }[/COLOR][/B] { public … | |
Re: [QUOTE=Ms. Kavita;1231551][B][COLOR="Red"]U have to do it by your self my dear and submit to me in ur class on Saterday Regard Ms.Kavita[/COLOR][/B][/QUOTE] If this post is for real then 2 thumbs up. LOL! | |
Re: The only thing I see commented is the JColorChooser not the JFileChooser. Can you make that clear? I am talking about the first few lines of the openFile method. All the JFileChooser are there. Do they work? | |
Re: This is a java forum. For the first, you can have an int array of length the number of letters in the alphabet (24 or 26) Loop each String of the list and take each character and increase the right element of the array by one. the first element for … | |
Re: Why did you make 2 posts with one hour difference? Now people will start answering both and it would be a total waste of their time? | |
Re: That error tells you exactly what is the problem and where to look: Exception in thread "main" java.lang.NullPointerException .... at Clustering.main(Clustering.java:39) At the Clustering.java file line 39, in the method method, you are using something which is null | |
Re: Have an array of Color instances with the potential colors and a global index. With click of the button use the element at the current index and increase the index by one. So with the next click the next color will be used. When the index reaches the length of … | |
Re: [QUOTE=pavank_karanam;1236083]Hi, In student project have use 2 combo boxes (state and district) how to write the in jsp code please anybody tell me my mail[/QUOTE] Start a new thread, post some code and read for starters some tutorials. For html this helped me a lot: [URL="http://www.w3schools.com/default.asp"]http://www.w3schools.com/default.asp[/URL] | |
Re: When the Net Beans compile the project they create a jar file and a README.txt file. Take the jar file and follow the instructions in that file. Try to run the jar file from a command prompt. Also wouldn't you present the source code as well? And it most essential … | |
Re: [CODE]while (summan >= k){[/CODE] You set summan to be zero and I assume that k is something positive. Then how is it possible for 0(summan) to be greater then k ? Also this is redundant: [ICODE]summan = summan ++;[/ICODE] Try this: [ICODE]summan += 1;[/ICODE] Or this: [ICODE]summan++;[/ICODE] | |
Re: [QUOTE=zango;1234654]So after going over this a few times I found that the issue was with the 5/9 and 9/5. For some reason Java was not calculating them correctly so I had to input the decimal equivalents instead.[/QUOTE] You were right ti out the decimal equivalents, but java was calculating them … | |
Re: What you are trying to do is very simple and explained in all basic GUI tutorials. Try to search some at the site of SUN | |
Re: [QUOTE=MDCS;1232008]How is the code for ajax look like?[/QUOTE] Check the tutorials of AJAX at the w3schools site: [URL="http://www.w3schools.com/default.asp"]http://www.w3schools.com/default.asp[/URL] Or use jquery: [URL="http://docs.jquery.com/Main_Page"]http://docs.jquery.com/Main_Page[/URL] and [URL="http://malsup.com/jquery/form/"]http://malsup.com/jquery/form/[/URL] | |
Re: Look at the API of java.util.Vector, check some tutorials about sending data through request and come back with some code | |
Re: Telling you the solution will not solve anything. Net Beans tell you where the error is and what is the problem. If you can't fix it then I would suggest to stop what you are doing and start by reading very, very basic tutorials and try to learn simple basic … | |
Re: Well, you cannot mix java with JSP. Meaning that you cannot just execute a java function when a button is clicked, because java is executed at the server and when you are at the page, you are at the client. What you can do is, when you click a button … | |
Re: [CODE]<% String init= "3"; %> <select name="dropDown"> <option value="1" <%= ( "1".equals(init) )?"selected":"" %> >One</option> <option value="2" <%= ( "2".equals(init) )?"selected":"" %> >Two</option> <option value="3" <%= ( "3".equals(init) )?"selected":"" %> >Three</option> <option value="4" <%= ( "4".equals(init) )?"selected":"" %> >Four</option> <option value="5" <%= ( "5".equals(init) )?"selected":"" %> >Five</option> </select> [/CODE] Although … | |
Re: Class B has the username variable because it inherits A. But If you want to access it then you need to choose how to access it: private, public protected. I think that since you didn't add anything it is private so naturally you cannot access from outside that class. You … | |
Re: In one code you do this: [CODE]System.out.println(moviesList.get(1).printMovies());[/CODE] Which is correct. And at the other, you do this: [CODE] inputLine = n_moviesList.get[i].printMovies(); [/CODE] which is wrong. | |
Re: Is this java? It looks like it is some sort of C. | |
Re: How exactly did you write this: [CODE] out.print=(String)session.getAttribute("ana") //it prints null [/CODE] In your code? | |
Re: You do this to compare the users: [CODE] while(rs.next()){ String user=rs.getString(1).trim(); } if (!newUser.equals(user)) { } [/CODE] You put the username in the "user" variables that is defined and initialized in the while loop, but the one you are using for comparing the names is a different user variable. The … | |
Re: You hardly use session. Maybe you should put it in request and use request dispathcer to send the request to another jsp or servlet. Use the request.setAttribute(String, Object) and the request.getAttribute(String) | |
Re: Read this: [QUOTE=Ezzaral;831934]Do not hijack old threads merely to post "give me teh codez". If you have a question about an assignment, start a new thread and post the code that you have as a start.[/QUOTE] | |
Re: The alert will not fire because it is in the else block. The if is true: [CODE] <% // the if is always true. It will not go to the else and the alert which is inside the else will not execute if (true) { } else { %> <script>alert("error");</script> … | |
Re: [QUOTE] Make transactions: Many products are sold to customers by salesman in one visit. Transactions for each product with its quantity is recorded in transaction_product.dat file and the receipt no is recorded in transaction.dat file. It is important to note who sold the products. Salespersons bring the manual receipt to … | |
Re: First create a class Ferry with the necessary attributes and method for adding passengers. Use the assignment's specifications in order to find out what methods you should have and they should do. | |
Re: Check the API of the String class. There is a method that converts the String into an array of chars. Now loop that array and see if the first element is equal with the last. The 2nd with the last -1 The 3rd with the last -2 The 4th with … | |
Re: 2 for loops. Use the System.out.print() method to print at the same line and System.out.println() to change lines. The index will tell you which number to print and how many times(inner loop) | |
Re: When the button is clicked you can hide, or better dispose(I think that that is the name of the method of the JFrame class) and create new window. [CODE] class JLogin extends JFrame ... { .. public void methodUsedWhenLoginButtonClicked(ActionEvent evt) { JMainPage mainPage = new JMainPage(); mainPage.setVisible(true); this.dispose(); // use … | |
Re: I couldn't understand much from your question, but I think that meant this: [CODE] employee emp[]=new employee[5]; ..... if (order by id) { Arrays.sort(emp,new idComparator()); } else if (order by name) { Arrays.sort(emp,new nameComparator()); } for(int i=0;i<emp.length;i++){ System.out.println("empID : "+emp[i].getID()+" empName :"+emp[i].getName()); } [/CODE] | |
Re: This is the html code you are displaying at the page: [CODE] <a href=\"welcome.jsp\"> </a> [/CODE] But there is nothing between the <a> </a> , so the link is there and you can click it. The problem is that you don't display anything to show the user where the link … | |
Re: You wrote this: [CODE] private String[] typeStrings = {"Antonov", "Cessna"}; private JComboBox typeList = new JComboBox(typeStrings); [/CODE] How is it possible to change this "Antonov" or this "Cessna" into an int ? | |
Re: You can use the split method to create an array of the words of the String. Take that array and sort it. Then create a new String from that array. So now you have a new String with the words of the previous one sorted. Now you can use the … | |
Re: No, c is an array of objects. c[i] is the object which is null because you haven't initialized it. c[i] is null, c[i] is a College object, c is an array | |
Re: When the use logs in, put its username in the session: [CODE] session.setAttribute("USER", username); [/CODE] At the beginning of each page you can do this: String username = (String)session.getAttribute("USER"); if(username==null) { // session expired // FORWARD WITH ANY WAY YOU WANT // I don't know about this one. I usually … | |
Re: You mean display only one element of the array? You can create an array that has only one element, the element you want to display. But that would make the JList useless since that is not its purpose. Maybe you can change the way you add the JList to the … | |
Re: The String class has the charAt method. "Loop" the String using its length and get each character of the String. Then if you take that character and put it into an int, you have the ASCII: [CODE] for-loop { char ch = yourString.charAt(i); int ascii = ch; System.out.println(ascii); } [/CODE] | |
Re: [CODE] Staff staff1 = new Staff(); // and call its methods to set the name and the other values. Then call its other methods to display it. [/CODE] Doesn't this code works? [CODE] try { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); System.out.println("Please input a name and press Enter "); String … | |
Re: At that line something is null: [U]at model.dao.ConnectDerbyDAO.createTables(ConnectDerbyDAO.java:158)[/U] My guess is the connection. So try to go to that line and print the objects you are using. Also you need to close the connection, statement in the finally block. | |
Re: Then create instances of the BinaryNode class and construct the tree by giving values to the .left and .right nodes. Then call that method with argument the root node. For reading input use the Scanner class | |
Re: The first argument is with '?' [CODE] <a href="JSP2.jsp?id=1&name=2&aaaa=b">Link</a> [/CODE] And the others with '&' | |
Re: Also what will happen if the animalID is 3000? Look at your code. Maybe you need to add some >= to one of the expressions you have in the ifs | |
Re: Have you imported DecimalFormat? [ICODE]import java.text.DecimalFormat;[/ICODE] | |
| |
Re: [QUOTE=zreed;1213718] If someone could code this program by 5/9/10 it would be great. Thanks!![/QUOTE] When was this assignment given to you? |
The End.