3,927 Posted Topics

Member Avatar for raju123007

Your question is not clear on what you want to do with the extra text field, but you are already manipulating two fields just fine. Why can you not just add the third and do whatever you want with it? What is giving you difficulties?

Member Avatar for Ezzaral
0
190
Member Avatar for juxD

If you passed the animation reference to the Timer as a final reference (which would have been required for an anonymous inner class for the ActionListener), then you can't re-instantiate that reference and have it still work in the Timer. Have you tried recreating the Timer?

Member Avatar for Ezzaral
0
71
Member Avatar for lasher511

[QUOTE=lasher511;584992]Problem resolved. It seems my supervisor thought it would be funny if he put a keylogger on my computer and kept giving the passwords to this kid so that it would confuse me.[/QUOTE] I would be looking to get a new job if my supervisor "thought it would be funny …

Member Avatar for jbennet
0
190
Member Avatar for cage

You could use a while loop, but with arrays a standard for() loop or a foreach loop is usually preferred. A do while loop is seldom used to loop an array because a do while always executes at least once before the test and you would have to make sure …

Member Avatar for Ezzaral
0
816
Member Avatar for Kusno

See the api for [URL="http://java.sun.com/javase/6/docs/api/java/text/DecimalFormat.html"]DecimalFormat[/URL]. Also, after 50 posts, you should be familiar with [noparse][code] [/code][/noparse] tags - use them.

Member Avatar for Ezzaral
0
106
Member Avatar for Adila

All of this portion could go into a method called setupGame()[code=java] JPanel p1 = new JPanel(new GridLayout(3, 3)); int randomNumber = (int)(Math.random()*9)+1; if(randomNumber == 1){ p1.add(myButton1); p1.add(myButton2); p1.add(myButton3); p1.add(myButton4); p1.add(myButton5); p1.add(myButton6); p1.add(myButton7); p1.add(myButton8); p1.add(myButton9); } if(randomNumber == 2){ p1.add(myButton2); p1.add(myButton1); p1.add(myButton3); p1.add(myButton4); p1.add(myButton5); p1.add(myButton6); p1.add(myButton7); p1.add(myButton8); p1.add(myButton9); } add(p1, BorderLayout.CENTER); …

Member Avatar for Adila
0
728
Member Avatar for tro

That depends entirely on the constructors you have written for DisplayDie and DisplayPanel.

Member Avatar for tro
0
244
Member Avatar for webguru07

Because you are calling nextLine() on the scanner and that method returns a String, not a char[code]char chars = scan.nextLine();[/code]Capture a String instead and use String.charAt(0) to get the first char.[code=java]String input = scan.nextLine(); char choice = input.charAt(0); switch (choice) { ...[/code]

Member Avatar for Ezzaral
0
81
Member Avatar for msnider9

The code has numerous issues with empty blocks, misplaced semi-colons, missing braces, etc.

Member Avatar for KimJack
0
92
Member Avatar for kelvin_b

First you'll want to get a BufferedImage object for the input image. Example code for this here: [url]http://exampledepot.com/egs/java.awt.image/Image2Buf.html?l=rel[/url] BufferedImage will allow you to access the grid of pixels ([url]http://exampledepot.com/egs/java.awt.image/ImagePixel.html?l=rel[/url]). You may be able to apply a thresholding function to the pixels to create an array map of the identified paths, …

Member Avatar for Ezzaral
0
91
Member Avatar for msnider9

Having the sleep() in main() after you have called the mortArray() method will not cause your output to pause. The loop will continue to run until complete and then return to execute the rest of your code in main() - which is your pause code. You need to place the …

Member Avatar for Ezzaral
0
97
Member Avatar for Adila

It doesn't need to be reloaded - it just needs to be reset. How to do that depends upon how you have structured the code that initializes it.

Member Avatar for Ezzaral
0
156
Member Avatar for steven woodman

[QUOTE=bumsfeld;582615]Just waiting till Google comes out with their neat no nonsense (NNN) OS.[/QUOTE] Named HAL...

Member Avatar for jbennet
0
158
Member Avatar for sonia sardana
Member Avatar for clueless101

The demo class needs to create "Ages" objects and use the methods you have defined. As written your demo just defines some variables and prints the "avgAge" - which is still 0 because you haven't done anything with it.

Member Avatar for clueless101
0
147
Member Avatar for minamoda

This is your third thread on the [U]exact[/U] same issue and this has been answered in the other two already.

Member Avatar for minamoda
-1
76
Member Avatar for minamoda

Another loop inside that one on [code]while( tokens.hasMoreTokens() )[/code] is all you need.

Member Avatar for minamoda
0
74
Member Avatar for gsanson-2019

The error message should also include the name of the class that is not found. Check that method for classes you may have missed on the class path and if it is a third-party library check that those runtime dependencies are also in your classpath.

Member Avatar for gsanson-2019
0
94
Member Avatar for piyush09

The stack trace clearly indicates that in your actionPerformed method on line 99 that you are attempting to call a method on an object that is null. Examine the call that is being made on line 99 and examine why it might be null.

Member Avatar for piyush09
0
228
Member Avatar for maydhyam

Your question is too vague. By "upload" do you mean with a JSP page or from a desktop Java application? (This is the Java forum by the way. There is a separate JSP forum here:[url]http://www.daniweb.com/forums/forum24.html[/url]) Without more information no one can really help you.

Member Avatar for Ezzaral
0
114
Member Avatar for denniskhor

[QUOTE=denniskhor;580808]wat is import?? how?? i jz beginner in java...[/QUOTE] Then obviously you didn't copy [U]all[/U] of the appropriate code from wherever you copied this routine. You need to specify "import <package>.<class>;" for each of those classes that you are using. Honestly, if you don't know what an import is then …

Member Avatar for Ezzaral
0
190
Member Avatar for Katherine692008

You haven't ended the main() method block. Until you do that you can't start a new method.

Member Avatar for javaAddict
0
143
Member Avatar for debee

That line is actually the entirety of this statement[code]b[index[j]][k] = b[index[j]][k].subtract( a[index[j]][i].multiply (b[index[i]][k]));[/code] You are performing an operation on a value in b[][], but you haven't initialized all of the elements in b[][]. You have only initialized the diagonal of that matrix here[code]for (int i=0; i<n; ++i) b[i][i] = new …

Member Avatar for debee
0
401
Member Avatar for D boss

Use this constructor for your FileWriter to append to the file instead of overwriting it: [URL="http://java.sun.com/javase/6/docs/api/java/io/FileWriter.html#FileWriter(java.lang.String,%20boolean)"]FileWriter.FileWriter(java.lang.String,boolean)[/URL] You will also need to change [icode]\\ file to output or save to[/icode] to [icode]// file to output or save to[/icode] if you want that to compile - wrong slashes for an inline comment.

Member Avatar for D boss
0
147
Member Avatar for Neeraj Sharma
Member Avatar for ajithraj

Which method are you wanting to pass an object to? "idMethod" is getting a no-arg method and "getMethod" is getting this method [icode]getInstance(String)[/icode] with this line [code]Method getMethod = Class.forName(ClassName).getMethod("getInstance", new Class[]{Class.forName("java.lang.String")});[/code]. If you need [icode]getInstance(Object)[/icode] the you need to use [code]Method getMethod = Class.forName(ClassName).getMethod("getInstance", new Class[]{java.lang.Object.class});[/code] Your question is …

Member Avatar for Ezzaral
0
125
Member Avatar for Kusno

The row must be added to the TableModel, not the JTable as you are attempting. In particular, that method is provided by DefaultTableModel and is not in the general TableModel interface, so you will either need to keep a reference to the DefaultTableModel that you are creating[code=java]DefaultTableModel tableModel = new …

Member Avatar for Kusno
0
600
Member Avatar for Swetham5236

There is no guaranteed return path because your return is within a conditional statement. This means that when your if() test is false the function has no return value - and the compiler won't allow that. You need a return outside of the if statement as well.

Member Avatar for Ezzaral
0
74
Member Avatar for jimJohnson

[icode]DecimalFormat("#.##")[/icode] will show up to 2 decimal places if applicable. If you want to always show 2 digits after the decimal use [icode]DecimalFormat("#.00")[/icode] Edit: Just noticed, but you are not even using the DecimalFormat you created. You need to use that instance to format your numbers like so[code=java]System.out.println("The maxiumum score …

Member Avatar for Ezzaral
0
540
Member Avatar for Thamizh Bharat

A search across this site (that little box in the upper right corner) on "final year topic" yields 50 pages of results. That should get you started I would think.

Member Avatar for jwenting
0
35
Member Avatar for Kusno

I doubt you want to disable the cells but rather make them uneditable. Example here: [url]http://exampledepot.com/egs/javax.swing.table/NoEdit.html[/url] For the row selection, see these: [url]http://exampledepot.com/egs/javax.swing.table/GetSel.html[/url] [url]http://java.sun.com/docs/books/tutorial/uiswing/components/table.html#selection[/url]

Member Avatar for Ezzaral
0
84
Member Avatar for Dio1080

It would help a lot if you either used [noparse][code=java][/noparse], which would place line numbers in the listing or highlighted the line number in your code, since most can't just quickly pick out line 174. Here is that code with line numbers: [QUOTE=Dio1080;580346]I can't figure out why it is saying …

Member Avatar for Dio1080
0
170
Member Avatar for karlee

Then you need to make sure that the BufferedWriter is being created correctly and the "myList" has been initialized by the point you are calling that loop.

Member Avatar for Ezzaral
0
172
Member Avatar for Dr Windows (XP)

Because your toString() method is not returning a string, it's just printing stuff out to the console. It needs to build a string and return it. Also, after 18 posts, you should learn to use [noparse][code] [/code][/noparse] tags around code that you post.

Member Avatar for Ezzaral
0
92
Member Avatar for it2051229

Take a look at this example on disallowing edits: [url]http://exampledepot.com/egs/javax.swing.table/NoEdit.html[/url] The signature of the method that they are overriding should give you a pretty good idea on how to disallow editing on any particular row or column.

Member Avatar for majestic0110
0
95
Member Avatar for debee

The stack trace is showing the error occurring in sigmoidActivationFunction [code]at newtonsMethod1.sigmoidActivationFunction(newtonsMethod1.java:118)[/code] and if you look at the constructor you are using for BigDecimal there the error should be pretty clear. I doubt what you wrote there can be formatted as a number.

Member Avatar for debee
0
292
Member Avatar for 1337455 10534

See the resources outlined in the [URL="http://www.daniweb.com/forums/thread99132.html"]Read Me post[/URL] at the top of this forum. There is a lot of info there to get you started.

Member Avatar for Ezzaral
0
99
Member Avatar for it2051229
Member Avatar for Sirjames_da1st

It's the same principle as with an array but you update the list pointers instead of shifting the array elements. If you need more specific answers, you need to ask more specific questions. No one here is going to write the sort for your homework assignment, so post the code …

Member Avatar for Sirjames_da1st
0
262
Member Avatar for minamoda

You need to have the read in a loop like so [code]while ((line = reader.readLine()) != null){ StringTokenizer tokenizer = new StringTokenizer(line," "); // do stuff }[/code]I have no idea where the "BbmReader" class comes from, so I can't speak to any specifics on that, but the general loop should …

Member Avatar for Ezzaral
-1
2K
Member Avatar for CaffeineCoder

This tutorial has examples of working with the available layout managers: [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/index.html[/url]

Member Avatar for CaffeineCoder
0
163
Member Avatar for it2051229

You actually need to add the data to the TableModel. You can either implement the TabelModel yourself against your existing data (whether that is in an array, list, or whatever) or create an instance of DefaultTableModel with your data. Read through these for more info and examples: [url]http://www2.sys-con.com/ITSG/VirtualCD_Spring05/Java/archives/0405/hatmaker/index.html[/url] [url]http://java.sun.com/docs/books/tutorial/uiswing/components/table.html[/url]

Member Avatar for Ezzaral
-1
113
Member Avatar for vinnodraina

[URL="http://java.sun.com/javase/6/docs/api/java/lang/String.html#substring(int,int)"]String.substring(int,%20int)[/URL]

Member Avatar for Ezzaral
0
59
Member Avatar for toomuchfreetime

You can do it with a custom cell renderer like so:[code=java]class CustomIconRenderer extends DefaultTreeCellRenderer { ImageIcon defaultIcon; ImageIcon specialIcon; public CustomIconRenderer() { defaultIcon = new ImageIcon(CustomIconRenderer.class.getResource("/images/defaultIcon.gif")); specialIcon = new ImageIcon(CustomIconRenderer.class.getResource("/images/specialIcon.gif")); } public Component getTreeCellRendererComponent(JTree tree, Object value,boolean sel,boolean expanded,boolean leaf, int row,boolean hasFocus) { super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, …

Member Avatar for Ezzaral
0
1K
Member Avatar for Tyster

Each container can only have one layout manager, however you can easily create any layout you wish by nesting containers with the layout that you want for each one. This could include using a few JPanels inside a JFrame with each JPanel containing a few components. Breaking up the layout …

Member Avatar for Tyster
0
238
Member Avatar for sam18

Well, a couple of things. This query makes little sense [code]executeQuery("select * from result where result='"+ b1 + "'");[/code] The field name in the where clause is the same as the table name. Second, after you run the query and call .next(), you need to retrieve the field value like …

Member Avatar for Juma
0
158
Member Avatar for oneguy

And how do you figure it's a silly answer? You don't say what about the code you do not understand. Is he supposed to just know that you understand pointers? Do you? Do you expect someone to just explain every portion of "that top template part" to you in excruciating …

Member Avatar for Ezzaral
0
109
Member Avatar for debee

Multiplying at those magnitudes are putting you beyond the precision of double. Use [URL="http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html"]BigDecimal [/URL] instead. [code=java]double a = 1.190597027811988E-273; double b = -2.513498651481222E-273; System.out.println("double: "+(a*b)); // double: -0.0 BigDecimal c = new BigDecimal(a); BigDecimal d = new BigDecimal(b); System.out.println("BigDecimal: "+new DecimalFormat("0.#######E0").format(c.multiply(d))); // BigDecimal: -2.992564E-546[/code]

Member Avatar for debee
0
87
Member Avatar for leroi green

Just use a BufferedReader for the read. Example here: [url]http://www.exampledepot.com/egs/java.io/ReadLinesFromFile.html[/url]

Member Avatar for leroi green
0
125
Member Avatar for jlaw1027

Why does MVDList extend Queue but work with an internal Queue reference "aQueue"?

Member Avatar for Ezzaral
0
95

The End.