7,116 Posted Topics

Member Avatar for N S K

It depends on what kind of anti-virus. If you are just scanning files for suspicious content on demand, then Java is perfectly suitable. If, on the other hand, you want a useful anti-virus that automatically scans all downloaded files, and monitors the system for suspicious behaviours, then Stuktuske said it …

Member Avatar for stultuske
0
209
Member Avatar for shaik sajida
Re: java

Then write one, and read the Daniweb member rules before posting again

Member Avatar for JamesCherrill
-1
57
Member Avatar for jeram.burbon

Line 30 is an import statement that comes after a class def. that's an error, imports must come at the beginning of the file.

Member Avatar for stultuske
0
1K
Member Avatar for Atlanta15Braves

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question "Do provide evidence of having done some work yourself if posting …

Member Avatar for stultuske
0
3K
Member Avatar for henryz_box

if you use a classic model/view pattern then this is straighforward. Your "model" classes encapsulate the current state of the game (who has which cards, whose turn is it next etc) in a purely logical form (no user interface artifacts). Your "view" classes display the current state as a GUI …

Member Avatar for henryz_box
0
665
Member Avatar for My_1

If there are only 256 possible keys, just try each one in a loop until you get one that works.

Member Avatar for JamesCherrill
0
256
Member Avatar for KetraCoder

It looks like you draw all the strings at the same position. You need to draw each string at increasing y coordinates so they appear one below another

Member Avatar for KetraCoder
0
232
Member Avatar for 2384443

Line 39, l2 is uninitialised, so its value is `null` - you create the scroll pane with null as its content Lines 42,43 you initialise l2, but it's too late.

Member Avatar for juanpa_2510
0
234
Member Avatar for bmwwbb54

You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java …

Member Avatar for bmwwbb54
-1
186
Member Avatar for Search_not

The target "client" has to be listening on ServerSocket for the other client to connect, but that's the same as the code in our existing server. The problem is usually to find the target client's IP. Having a registered domain name is one way, or a dynamic DNS solution like …

Member Avatar for Search_not
0
269
Member Avatar for N S K

Those are the first bytes in the file, yes? Just open a FileInputStream with that file and read the first 4 bytes into a 4 byte array where you can check the values. Then close the stream. https://docs.oracle.com/javase/8/docs/api/java/io/FileInputStream.html ps: Although those bytes correspond to "%PDF" in ASCII, don't be tempted …

Member Avatar for N S K
0
3K
Member Avatar for Garidius

Is the rest of the file just text? If so, just read the file using a Scanner with your D2A7 bytes as the delimiter https://docs.oracle.com/javase/7/docs/api/java/util/Scanner.html

Member Avatar for Garidius
0
2K
Member Avatar for salahuddin_1

English is not your first language? OK. But that sentence does not make sense. Please try to explain with more detail.

Member Avatar for JamesCherrill
0
48
Member Avatar for UK-1991

Look at line 33. As soon as you test a name that's not in the very first element of the array you break from the loop and stop looking. You probably intended to break after finding a match.

Member Avatar for JamesCherrill
0
107
Member Avatar for shungkiu.lee

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
186
Member Avatar for divinity02

Write down a brief description of what the game is - its rules etc. Write down a few examples of how it would look when a user uses it. (Use any format or medium that suits you - pencil & paper, blackboard etc) Then (and not before) think about what …

Member Avatar for JamesCherrill
0
298
Member Avatar for nataraja833

I simplu doesn't work like that. If you want a reference to an object, use a reference variable of the right kind. Java references are "opaque" - you can use them but you can't manipulate them. There's no way to turn a String into an object reference. If you want …

Member Avatar for nataraja833
0
228
Member Avatar for ardi_lucy

Take a look at the InetAddress class. You can use it to parse your text into an internal-form inet address InetAddress.getByName("10.4.23.16") then extract it as a byte array byte[] bytes = InetAddress.getByName("10.4.23.16").getAddress(); It will then be easy to write the comparator using those four numeric bytes (four nested tests OR …

Member Avatar for anita_2
0
1K
Member Avatar for kinbo

That's not enough information for anyone to help. You need to post the whole code, and the complete text of any error messages. If there are no error messages but it's not working right, explain what it should do and what it actually does.

Member Avatar for bmwwbb54
0
224
Member Avatar for chubbyy.putto

The game "Scrabble" needs a list of valid English words. If you search the web you will find downloadable files with suitable word lists.

Member Avatar for Taywin
0
120
Member Avatar for JamesCherrill

Although layout managers usually scale text properly, with the spread of "retina" Macs with screen resolutions over 200 d.p.i. we can't just keep ignoring pixel size for grahics or animation. Toolbox has a method for getting the screen resolution, but I don't have access to enough varied machines to see …

Member Avatar for Slavi
0
196
Member Avatar for Stefce

Java will call your paint method when necessary. You can use the repaint() method to let Java know that a new paint is needed. Instead of the literal on line 9, use a String variable. Then you can update that variable in your mouse clicked method, and call repaint()

Member Avatar for JamesCherrill
0
323
Member Avatar for marvin.lerias
Member Avatar for Nikki_77

[CODE]public void AccelerateSpeed (int speed) { speed = speed + 5; }[/CODE] This code takes the value of the parameter "speed",adds 5 to it, and returns. It has no effect on the "speed" defined in the class because the parameter has the same name and "masks" the class variable. What …

Member Avatar for stultuske
0
22K
Member Avatar for Slavi

This is nothing to do with the compiler. The compiler has no way to know whether the array reference will be valid at run time. It's the Java runtime that checks every actual array index and throws the exception if it finds one out of range. What is the value …

Member Avatar for Slavi
0
137
Member Avatar for bob.smithy.10

You use a loop when you want to do something a number of times. You use an `if` if you want to do something only under some circumstances. Reading the description of step 5, there's nothing repetitive there, but there is something you have to do only when all the …

Member Avatar for bob.smithy.10
0
224
Member Avatar for Varunkrishna
Member Avatar for Dinesh_9

Did you really write that code? It displays a wide knowledge of Java syntax, including some of the latest language enhancements. Someone with that kind of programming skill would surely know how to handle parts 2-4.

Member Avatar for vighnesh.anap
0
6K
Member Avatar for nipur23

"But token in my opinion works better" Obviously not. If the input can be multiple words separated by blanks then either you have to loop reading all the tokens on the line then concatenate them again, or just read the whole line.

Member Avatar for stultuske
0
2K
Member Avatar for redtribal23

You will need to test for incorrect input and throw an Exception if it's incorrect. If one of the existing Exceptions in the Java API correctly describes your situation (maybe DataFormatException ?) then use that. If not, define your own Exception. There's no right or wrong here, just do whatever …

Member Avatar for Taywin
0
216
Member Avatar for divinity02

Your code is the solution to a different problem (count the number of odd numbers in an arbitrary list of numbers entered b the user). Looks like you copied from the wrong source.

Member Avatar for stultuske
0
314
Member Avatar for joshua_8
Member Avatar for JamesCherrill
0
98
Member Avatar for mxwarning

OK stultuske has given you excellent advice, but all you need to do now is to use tha `append` method instead of the `setText` method so that your strings are appended into the text area, not overwritten.

Member Avatar for stultuske
0
3K
Member Avatar for Reverse_1
Member Avatar for Sylvia_H
Member Avatar for Slavi
0
237
Member Avatar for Wendy_2

Line 6 of the error message tells you that it was trying to parse the user input on line 47, and failed to parse it as an int. Did the input dialog appear OK? What did you enter in it?

Member Avatar for Wendy_2
0
276
Member Avatar for divinity02

See the very first topic at the start of the Java forum main page https://www.daniweb.com/software-development/java/threads/430542/java-projects-for-learners

Member Avatar for llgms
0
322
Member Avatar for hedrun

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
178
Member Avatar for Heba_2

No, it's not Vector. Vector has *not* been formally deprecated (just look at the current API doc). The nearest it gets is the following quote from nthe Java 8 API JavaDoc: "If a thread-safe implementation is not needed, it is recommended to use ArrayList in place of Vector."

Member Avatar for JamesCherrill
0
114
Member Avatar for joshua_8

I don't know anything about PdfPCell, but it looks odd that you create new instance of it on line 7, but you don't do anything with it. Similarly you add a `table` on each pass of the loop, but I don't see any code to change `table`'s value in the …

Member Avatar for JamesCherrill
0
110
Member Avatar for Search_not

I doubt very much that the HTML support in Swing will ever be updated for HTML 5. The future of rich graphical GUIs in Java is JavaFX, so maybe you should be doing this in JavaFX not Swing. The JavaFX docs do refer explicitly to HTML 5.

Member Avatar for Slavi
0
155
Member Avatar for sciprog22

You are stopping and starting to switch between two timers, so the timing keeps changing. One solution: Have 1 Timer that just moves block 1. Start this and leave it running Have another Timer that just moves block 2. Stop and start it however you like because that won't affect …

Member Avatar for sciprog22
0
162
Member Avatar for redtribal23

Your catches will catch exceptions thrown inside the corresponding try block (lines 35-47). The nextInt method (line 32) can throw the IMM exception, but that's outside your try.

Member Avatar for stultuske
0
566
Member Avatar for sciwizeh

Do you override equals for your User class and use that for all "equals" tests? That woud be the normal approach, == is never going to work all the time if objects are being re-created.

Member Avatar for sciwizeh
0
282
Member Avatar for joshua_8

First pass through the loop you `add` and `close`, so on the secand pass through the loop the document is already closed, so the `add` fails

Member Avatar for JamesCherrill
0
157
Member Avatar for miladrahimi93

The JDK comes with [JavaDB](http://www.oracle.com/technetwork/java/javadb/overview/index.html) (a fully Oracle-supported version of Apache Derby) as standard. If you use that in embedded mode you just need to add one 2.6 MB jar to your application, and the user doesn't have to install anything else. Unless you plan an enterprise-scale roll-out I can't …

Member Avatar for JamesCherrill
0
215
Member Avatar for Jamalelyafi23

Nobody is going to give you the answer. That destroys the whole point of giving you this to do as part of your education. Here's some info that may help you do this yourself... The String class has a method that converts to String into an array of characters You …

Member Avatar for stultuske
-1
249
Member Avatar for Trevor_4

the array student is created on line 8 but you have no code to inialise it, so it is just full of zeros. So on line 20 when you print student[i] that's always zero.

Member Avatar for Trevor_4
0
122
Member Avatar for sciprog22

Why the duplicated code in the two BattleShipX classes? At a quick look it looks like you should have an abstract superclass with all the common code, and have those 2 classes as subclasses, with pnly the methods that are different. (Or if the differences are just in data values, …

Member Avatar for sciprog22
0
152
Member Avatar for redtribal23

If you don't put them in an array (or some other container eg ArrayList) then you would have to re-read the file for each user input, which would be a messy and inefficient solution.

Member Avatar for redtribal23
0
209

The End.