3,927 Posted Topics

Member Avatar for pat8

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.

Member Avatar for Ezzaral
0
992
Member Avatar for itdupuis

No and no. Hydrogen is not currently a feasible replacement solution.

Member Avatar for Ene Uran
0
159
Member Avatar for shraddha_gupta

Well, posting the error might help. We can't read your screen from here you know.

Member Avatar for Ezzaral
0
70
Member Avatar for nuwan243

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.

Member Avatar for Ezzaral
0
106
Member Avatar for perezfl

[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: …

Member Avatar for Ezzaral
0
114
Member Avatar for thorneko

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.

Member Avatar for Ezzaral
0
1K
Member Avatar for lAmoebal

[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.

Member Avatar for stephen84s
0
364
Member Avatar for saurabh92

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.

Member Avatar for saurabh92
0
129
Member Avatar for sreein1986
Member Avatar for Ancient Dragon
0
141
Member Avatar for new_2_java

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.

Member Avatar for new_2_java
0
159
Member Avatar for k.samdani

Help with what? You haven't posted a question, and it's certainly not urgent to anyone here.

Member Avatar for ninjaneer
0
242
Member Avatar for sciwizeh

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 …

Member Avatar for Ezzaral
0
218
Member Avatar for Alex Edwards

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.

Member Avatar for Alex Edwards
0
182
Member Avatar for coolvision

Please be aware that Javascript has it's own forum. This is the Java programming language forum.

Member Avatar for Ezzaral
0
87
Member Avatar for mattsh

[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 …

Member Avatar for Ezzaral
0
144
Member Avatar for t_serva
Member Avatar for Ezzaral
0
40
Member Avatar for zyaday

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.

Member Avatar for Ezzaral
0
36
Member Avatar for zyaday

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.

Member Avatar for Ezzaral
0
133
Member Avatar for k_en

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 …

Member Avatar for Ezzaral
0
81
Member Avatar for esy928

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 …

Member Avatar for esy928
0
135
Member Avatar for sciwizeh

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 …

Member Avatar for sciwizeh
0
722
Member Avatar for darklich13

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.

Member Avatar for darklich13
0
205
Member Avatar for mansoorhacker

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 …

Member Avatar for Ezzaral
0
149
Member Avatar for anuragatiiith

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]

Member Avatar for Ezzaral
0
88
Member Avatar for Alex Edwards

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 …

Member Avatar for sciwizeh
0
128
Member Avatar for newprogrammer

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.

Member Avatar for camthalion95
0
156
Member Avatar for joshmo

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.

Member Avatar for 0named
0
355
Member Avatar for new_2_java

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); …

Member Avatar for new_2_java
0
144
Member Avatar for tigerkartik

[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 …

Member Avatar for icorey
0
84
Member Avatar for new_2_java

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].

Member Avatar for new_2_java
0
112
Member Avatar for shaikh_mshariq

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.

Member Avatar for Ezzaral
-1
119
Member Avatar for stopah2008
Member Avatar for ericstenson

[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 …

Member Avatar for jephthah
0
471
Member Avatar for Alex_

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?

Member Avatar for Alex_
0
99
Member Avatar for zyaday

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]

Member Avatar for Ezzaral
0
134
Member Avatar for vedmack
Member Avatar for rainny

[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 …

Member Avatar for Ezzaral
0
267
Member Avatar for sktr4life

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 …

Member Avatar for sktr4life
-1
182
Member Avatar for ladie-loo@hotma

[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.

Member Avatar for The Dude
0
78
Member Avatar for Magda

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 …

Member Avatar for Ezzaral
0
337
Member Avatar for VernonDozier

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]

Member Avatar for VernonDozier
0
847
Member Avatar for C41R0

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.

Member Avatar for Ezzaral
0
183
Member Avatar for C41R0

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 …

Member Avatar for C41R0
0
192
Member Avatar for C41R0

You need to cast e.getSource() to an appropriate type that implements the paste() method.

Member Avatar for C41R0
0
121
Member Avatar for deineMutti

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 …

Member Avatar for woo37830
0
16K
Member Avatar for suriname0

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 …

Member Avatar for suriname0
0
134
Member Avatar for CK01

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]

Member Avatar for CK01
0
108
Member Avatar for Software guy

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 …

Member Avatar for Ezzaral
0
130
Member Avatar for nelson13

Not if you don't post the code. We really can't speculate what you have written.

Member Avatar for Ezzaral
0
86
Member Avatar for ChuksPierr

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.

Member Avatar for Ezzaral
0
146

The End.