7,116 Posted Topics

Member Avatar for MichaelCJ10

All you need is a counter in your DisplayButtonMessage class that you can increment inside the actionPerformed until it reaches 6. You need to declare it in the class so its value will persist between the sucessive calls to actionPerformed.

Member Avatar for MichaelCJ10
0
929
Member Avatar for cobaltfive

Take a short break, then go back to 1stDAN's post above, which spells out exactly what you need to do.

Member Avatar for JamesCherrill
0
367
Member Avatar for matt.harding.14203

Hello again Matt. These follow-on questions could have been added to your original thread, but if you want to start a new thread when the actual question changes perhaps you could take a second to mark the previous threads as solved. Just consider what conclusions people may draw from you …

Member Avatar for 1stDAN
0
386
Member Avatar for arifsaroha

Youhave the Event - it's the parameter in actionPerformed. That gives you the source component. You can then test the attributes of that component (eg its actionCommand) to see which component it is. Eg if ( ae.getSource().getActionCommand().equals("Save"))...

Member Avatar for stultuske
0
100
Member Avatar for manel1989

That link refers to the old Runtime.exec method, which was mostly superceeded in Java 1.5 by the ProcessBuilder class - the doc is in the usual places.. http://docs.oracle.com/javase/7/docs/api/java/lang/ProcessBuilder.html

Member Avatar for stultuske
0
274
Member Avatar for matt.harding.14203

Java chars are really numeric values that represent Unicode (ASCII) characters, and as it happens the ASCII value for the character '1' is decimal 49 (see http://web.cs.mun.ca/~michael/c/ascii-table.html). Your bit0 variable is an int, so Java displays it as a numeric value, not the character that it represents. If you declare …

Member Avatar for JamesCherrill
0
251
Member Avatar for matt.harding.14203

If you read it in as a String you can then use String's toCharArray method to give you an array where each element is a single character from the String.

Member Avatar for JamesCherrill
0
232
Member Avatar for Yasir_2

See http://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners One of the more advanced projects there should be suitable as a starting point.

Member Avatar for stultuske
0
119
Member Avatar for aiojou

Do you mean cut into quarters, or reduce to one quarter of the size (in which case use Image's getScaledInstance method)?

Member Avatar for JamesCherrill
0
247
Member Avatar for minnie19

[QUOTE]Error: The serializable class MyGrid2 does not declare a static final serialVersionUID field of type long[/QUOTE] Serialisable classes are supposed to have a serialVersionUID field so, in theory, you can update the serialisation in the future and know which version you are using. In practice this is complete rubbish, but …

Member Avatar for JamesCherrill
0
2K
Member Avatar for sammygreat1234

A JTextArea is really bad choice of component to display an image - it's specifically designed to display lines of text. Maybe you should re-think your choice of components? If you explain what you are trying to achieve maybe someone can suggest an easier way to achieve it.

Member Avatar for sammygreat1234
0
2K
Member Avatar for mikewyatt

getScaledInstance - just pass it the desired width/height and a scaling method (use SCALE_DEFAULT if yo don't know). It returns a new Image that is the size you requested.

Member Avatar for JamesCherrill
0
194
Member Avatar for eldiablo1121

On lines 34-46 you prompt for first and second number, even if the user's menu choice was not a calculation (1,2,3 or 4) If the user's choice was 5 your program exits properly after prompting for those two values. You may want to make prompting for 1st and 2nd number …

Member Avatar for eldiablo1121
0
359
Member Avatar for somjit{}

No time to read your code now.. but... You will learn an awful lot now from looking at the source code fr the actual API classes (eg how exceptions are handled in arrayCopy) - you should have a source.zip file in your jdk directory which contains it all. I recommend …

Member Avatar for somjit{}
0
297
Member Avatar for michaellooks

Yes, you can read or write the bytes of any file, Java doesn't care what the extension is. But you will need extra libraries to interpret the contents of MS office files, PDFs etc. It's easy to find them, just Google.

Member Avatar for michaellooks
0
130
Member Avatar for YumnaZia

Just use readLine inside a simple loop to read all the lines and append them to your edit buffer.

Member Avatar for YumnaZia
0
337
Member Avatar for eldiablo1121

3 errors: First is self-explanatory while(i... i is defined inside the while loop's {}, so it's not accessible outside those {}. Define it before starting the loop. Ditto result - defined inside the loop so not accessible outside it. Define it before starting the loop

Member Avatar for eldiablo1121
0
440
Member Avatar for somjit{}

Iterable would be a good thing so you can use the enhanced for/each loop with your data structure. For the absolute pinnacle of professionalism implement the whole Collection interface. Frankly I think your code is very good.

Member Avatar for somjit{}
0
1K
Member Avatar for ZombieKnight93

Lines 118-125 you get the date info, but you don't call your set method to save those values. Without date of birth the age/target heart rate etc won't give correct values.

Member Avatar for asaa
0
252
Member Avatar for beanboy

Yes, it will help show just how bad a beginner's code can be. If you enjoy schoolboy howlers like these then go ahead and feast on Vaibhav's code. if you want to score more than an "E" on your assignment then write something yourself. public static void main(String args[])throws IOException …

Member Avatar for JamesCherrill
0
200
Member Avatar for JadeRayne

I don't understand how "Welo" is an increasing sequence! I would have thought that "elo" was the answer for "Welcome", and either "el" or "co" from the longer example. Maybe a few more examples would help?

Member Avatar for JamesCherrill
0
511
Member Avatar for darylglenng

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for pallav89
0
643
Member Avatar for ANGELA SENKUNG

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for JamesCherrill
0
84
Member Avatar for YumnaZia

Oracle's tutorials are excellent - see http://docs.oracle.com/javase/tutorial/essential/concurrency/

Member Avatar for YumnaZia
0
272
Member Avatar for Neha_4

Hi Neha Sorry so late in replying; somehow I failed to notice you original post. What you did was a good solution - for the length of the line you can just call getWidth() which you inherit from JSeparator and which tells you the current width (ie the necessary line …

Member Avatar for JamesCherrill
0
220
Member Avatar for fadi 751

You will find excellent tutorials, plus the complete detail of every single API class and method on Oracle's web site http://www.oracle.com/technetwork/java/javase/documentation/api-jsp-136079.html For example, in the API doc you will find the detail on the Calendar class that alows you to add or subtract hours, days, months etc to a date/time

Member Avatar for JamesCherrill
0
164
Member Avatar for cleve23

== means "refers to exactly the same object (same address in memory)" equals(...) usually means "may be a different object, but the two objects have equivalent values, so I will treat them as equal"

Member Avatar for ashishyete
0
159
Member Avatar for srikanth2321
Member Avatar for KellzDD

ArrayList is a Collection, which means you can use its `contains` method to see if it already contains an "equal" Line > contains(Object o) returns true if and only if this collection contains at least one element e such that (o==null ? e==null : o.equals(e)).

Member Avatar for stultuske
0
604
Member Avatar for kay19

It's exacty the same as addition except for the occasional minus sign instead of a plus sign. Just compare those two methods to see where sub deviates from the correct pattern in add

Member Avatar for kay19
0
227
Member Avatar for Lmbcabhi

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there.

Member Avatar for somjit{}
1
6K
Member Avatar for somjit{}

I have no major comments, but There a some loops that could use the simpler enhanced for loop syntax, eg for (int index = 0; index < data.length; index++) { dmap.put(data[index], 0.0); } vs for (String s : data) { dmap.put(s, 0.0); } Instead of `for (Double s : dmap.values().toArray(new …

Member Avatar for somjit{}
0
158
Member Avatar for Eccoo

To debug a problem like this, put a temporary print startement inside your loop (eg print the value of nSlices). Then you will be a ble to see if it is looping, and ifits an infinite loop you will get clues as to why that is. And yes, you will …

Member Avatar for Eccoo
0
398
Member Avatar for brylle.kunot
Re: atm

DaniWeb rules include: "Do post in full-sentence English" It is OK if your English is not perfect.

Member Avatar for ChrisHunter
-1
89
Member Avatar for Ken1234

the counting looks ok, but when you print I don't understand why you do that stuff with "num". countA[i] contains the count for value i, so why not just print that?

Member Avatar for Ken1234
0
330
Member Avatar for Birol
Member Avatar for prakash.kadam.5851127
0
301
Member Avatar for vikkox7

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for JamesCherrill
0
92
Member Avatar for Ken1234

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there.

Member Avatar for JamesCherrill
0
166
Member Avatar for Chinthanie

I guess there are quite a few of us here who don't understand exactly what you are trying to achieve. Perhaps you could make it clearer with an example? You have an exec of WinWord.exe in one of your earlier posts. Suppose your application was complete and correct; what output …

Member Avatar for Chinthanie
0
238
Member Avatar for kingarthur

Hi Aditya, wecome to DaniWeb. kingarthur posted this 4 years ago, and hasn't been seen here for the last 2 years, so you probably won't get a reply from him now. Start a new thread of your own and someone will help. ps Don't be surprised by long run times …

Member Avatar for JamesCherrill
0
665
Member Avatar for crizied

The declarations on 42/43 hide the variables declared on lines 17/18 - probably not causing trouble in this case, but a bad idea anyway.

Member Avatar for JamesCherrill
0
185
Member Avatar for kedxu

Swing has been double-buffered by default from around Java 1.5, so all this stuff, while interesting, is now completely unnecessary. Also overriding paint is a bad idea for JFrame - override paintComponent for a JPanel inside a JFrame instead. See http://www.oracle.com/technetwork/java/painting-140037.html#swing

Member Avatar for JamesCherrill
0
318
Member Avatar for NajwaMY
Re: JDBC

rs is an instance of ResultSet, so you can use the Java API documentation to learn all about its methods, eg http://docs.oracle.com/javase/7/docs/api/java/sql/ResultSet.html#getString%28int%29

Member Avatar for 1stDAN
0
207
Member Avatar for murali2489

That cross-posted version shows two different versions of the SQL satement (both different from this one), so until OP gets his head straight we're all just chasing will-o-the-wisps here.

Member Avatar for murali2489
0
389
Member Avatar for cobalt555

Lines 259-297 contain empty methods that will be called when the user clicks etc on the corresponding controls. All you need to do is to put your code into those methods. Start by just putting a simple System.out.println, so you can confirm that the method is being called when you …

Member Avatar for cobalt555
0
261
Member Avatar for thewayoftheduck

Yes, what exactly is the question? Which part of the exercise can't you do? Is it just to extend the prof's code to perform the same calculation using your new class?

Member Avatar for JamesCherrill
0
709
Member Avatar for rgrs2007

Yes, it's possible, in fact easy, and a very common kind of thing to do. It's directly supported in the Java language. The Oracle Java tutorials are an excellent source of info. For "a brief overview on how to tacle this problem" start reading about locks [here](http://docs.oracle.com/javase/tutorial/essential/concurrency/locksync.html).

Member Avatar for JamesCherrill
0
299
Member Avatar for lena1990

Without seeing the relveant code it's impossible for anyone to know what's wrong with your application.

Member Avatar for JamesCherrill
0
408
Member Avatar for Vinodh_1

Presumably you could start a java.util.Timer when you start the query, then when the Timer expires after 6 seconds its TimerTask could call Connection's abort method to terminate the connection (which in turn will abort the query with a SQLException). It's a bit crude, but should work.

Member Avatar for Vinodh_1
0
1K
Member Avatar for MasterHacker110

Your e.getStackTrace on line 208 is presumably a mis-type for e.*print*StackTrace. Fix that and see if you are getting any exceptions

Member Avatar for IIM
0
602

The End.