7,116 Posted Topics

Member Avatar for vivanie

Hello vivanie, welcome to DaniWeb 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 stultuske
-1
137
Member Avatar for ankit.pandey3

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 bguild
0
294
Member Avatar for game06

pricesolo: 1. This is the Java forum, Python has its own forum http://www.daniweb.com/software-development/python/114 2. 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

Member Avatar for JamesCherrill
0
164
Member Avatar for wolwayne

I'm not reading all that code either, but it sounds like you need a single controller class that deals with the database, keeps the timer(s) and creates or re-displays the question frame(s) as required.

Member Avatar for stultuske
0
408
Member Avatar for Stuugie

The version of exec that takes a single String as its argument is full of problems if you have a command with arguments, or spaces or quotes anywhere in it. It tries to parse the command/arguments itself and often gets it wrong. There is a version of exec that takes …

Member Avatar for Stuugie
0
687
Member Avatar for joseph.lyons.754

Did you try calling pack() on your JFrame after adding all the components?

Member Avatar for JamesCherrill
0
426
Member Avatar for game06

That seems clear enough. Obviously Tester doesn't implement an add method, and doesn't extend any class that it can inherit add from. ps the paint method is seriously wrong. Every time it's called you add jName again. Depending on what's happening on the screen paint may be called many times …

Member Avatar for bguild
0
144
Member Avatar for Violet_82

^ like he said, plus you don't need to put the variable names in parenthesis `if (variable1 && ! variable2) ...`

Member Avatar for Violet_82
0
194
Member Avatar for Gruff
Member Avatar for peymankop

I can't understand your description of the requirement! Maybe it would help if you gave a couple of examples of typical inputs and expected results.

Member Avatar for JamesCherrill
0
202
Member Avatar for Translucentbill

Hi goodtaste. Please don't be worried about the tough replies that some people get when they expect us to do their homework for them. Firstly this isn't a "we do your homework" service, and secondly we assume that the teacher has set a project that the student should be able …

Member Avatar for goodtaste
0
1K
Member Avatar for Violet_82

There's no one right answer to this, but here are two very short answers to start the discussion... If those values represent something persistent about the MyTest instance that is relevant to a number of methods then they should be instance vars (with getters/setters) and should not be passed in …

Member Avatar for Violet_82
0
173
Member Avatar for jared.j.roberts.7

... just shows why it's a good idea to compile (and even test!) any code before you post it here ... nothing gets past the eagle eyes ... makes you look a bit silly when you tell a beginner "do it like this" where "this" doesn't even compile :)

Member Avatar for radhakrishna.p
0
187
Member Avatar for joseph.lyons.754

> i can't seem to find the place to delete the articles you post There is no such place. You posted a real-life question and someone spent time and effort answering it. Now it's part of our knowledge base where it may help others in future. No way do we …

Member Avatar for JamesCherrill
0
379
Member Avatar for sainaleni.guttula
Re: java

When you create a Java program you usually create a whole load of methods. How does Java know where to start executing your program? So Java was designed to always look for a method `public static void main(String[] args)` and call that to start your program ps Welcome to DaniWeb …

Member Avatar for stultuske
0
95
Member Avatar for newGains

bguild's solution is certainly the simplest, and is probably all you need, but for future reference here's the general way to add any amount of into to an Execption: Create your own Exception by extending Exception, add the extra info to the constructor, have accessors for that info (or just …

Member Avatar for JamesCherrill
0
303
Member Avatar for JustLeftRavenholm

Hello JustLeftRavenholm, welcome to DaniWeb That's a whole lot of code. It's unlikely that anyone will take the time to understand a 600 line method with very few comments, a strange mixture of arrays and repeated variables (price1-20), and little or no indentation to clarify the structure. Exactly what is …

Member Avatar for stultuske
0
219
Member Avatar for game06

How big are dx and dy? If, for example they ate 10, then your ball could be 9 or 10 pixels inside the player in just one clock interval.

Member Avatar for JamesCherrill
0
114
Member Avatar for Sanjeev_2

You may be thinking of interfaces like Serializable that have no methods. When you declare a class as implementing Serializable all you are doing is announcing that your class can be safely serialised. Such interfaces are caled "tag" interfaces because they tag a class as having some attribute that the …

Member Avatar for JamesCherrill
-1
66
Member Avatar for StefanRafa0

You can write Java programs to perform math calculations, solve equations, plot graphs etc, but that requires you to understand what you are trying to do. If you don't undertand the math, writing a Java program isn't going to help, in fact it will just add a whole load of …

Member Avatar for JamesCherrill
0
194
Member Avatar for sliobra

> from where will your toDate() method get its string? ??? Nobody has any such method! There *is* a toDate(String str) method, and it's obvious where that gets its String.

Member Avatar for JamesCherrill
0
205
Member Avatar for l.worboyz

If you look at the mouseClicked method you will see how that adds a counter - there's a simple method it calls. You jiust need to call that same method 3 times for each column in your initialisation.

Member Avatar for JamesCherrill
0
217
Member Avatar for bhallarahul

A lot depends on how robust you want he to be. A simple public static getInstance with a private constructor that's called from a static initialiser block is good enough for some situations, but there are all kinds of problems in a multi-threaded situation, or if you have multiple class …

Member Avatar for JamesCherrill
0
185
Member Avatar for trishtren

It may be a lot easier to extend something that has a paintComponent method, and include the rounded rectangle by composition rather than subclassing... class RRectText extends JComponent { RoundRectangle2D rect; String text; public RRectText(float x, y, w, h, arcw, arch, String text) { rect = new RoundRectangle2DFloat(z,y, ... this.text …

Member Avatar for JamesCherrill
0
382
Member Avatar for woolf

Just read the API documentation for the String class - it's all explained there http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#String%28byte[],%20int,%20int%29

Member Avatar for peter_budo
0
805
Member Avatar for nah094020

You could create a simple small test driver that starts multiple instances of the client, passing different values for host name, port number or whatever else can't be shared with its default value by two clients on the same meachine.

Member Avatar for jwenting
0
256
Member Avatar for Violet_82

The idea of pseudo-code is to capture/plan ypur logic without getting buried in the details of Java syntax or API method signatures. If you were writing this code for a non-programmer end user you may even be able to go through bits of the pseudo-code with him/her to confirm that …

Member Avatar for Violet_82
1
4K
Member Avatar for l.worboyz

That looks 99% right! getSubimage (note capitals - Java is case-sensitive) is a method in the BufferedImage class, so you need an instance of BufferedImage to call it, eg `myImage.getSubimage(0, 0, 100, 100)` returns the top left 100x100 pixels of myImage as a new BufferedImage

Member Avatar for JamesCherrill
0
2K
Member Avatar for pooran.c

You seeem to be confused about the Date class. A Date object represents an instant in time, and has methods to access it. It does NOT have a format. When you convert a Date to or from a String that's when a format is applied.

Member Avatar for pooran.c
0
2K
Member Avatar for jvcv

Step one is to disentagle your current GUI from the code about pizzas that you will need in the GUI version. eg at lines 23-35 you could create new method eg `choseSize(int size)` and move the code from lines 24-35 into it, so the code now reads: choice = inScan.nextInt(); …

Member Avatar for JamesCherrill
0
124
Member Avatar for G_S

I don't understand what point your teacher is trying to make. The Java Language Spec doesn't use the term "attribute" except in two places. One is a very technical discussion of garbage collection, and the other uses it to mean a variable that can be accessed via get/set methods. So …

Member Avatar for G_S
0
196
Member Avatar for MasterHacker110

Calling your class Applet isn't an error as such, but is guaranteed to cause problems since Applet is an exsting class in the API that you are trying to use at the same time. First thing to do is to change it to a unique name. (Don't forget to change …

Member Avatar for JamesCherrill
0
186
Member Avatar for joseph.lyons.754

This is where the column names are created... for (int i = 1; i <= columns; i++) { columnNames.addElement( md.getColumnName(i) ); } .. so instead of that just add your own preferred Strings to the Vector colmnNames

Member Avatar for joseph.lyons.754
0
284
Member Avatar for yyzdslr

DaniWeb Member Rules (which you agreed to when you signed up) include: Do not post articles that you have already published on another website Thread closed

Member Avatar for JamesCherrill
0
312
Member Avatar for skbluecollars

Just read the API documentation for the String class - it's all explained there http://docs.oracle.com/javase/7/docs/api/java/lang/String.html#String%28byte[],%20int,%20int%29

Member Avatar for JamesCherrill
0
127
Member Avatar for game06
Re: oop

Around line 8 you know how many bullets there are in enemyBulletStore, so maybe you could use that to pick a counter value for the next bullet.

Member Avatar for game06
0
141
Member Avatar for jalpesh_007

Lines 16-22: portList = CommPortIdentifier.getPortIdentifiers(); ... System.out.println(portList.nextElement()); while (portList.hasMoreElements()) { ... portId = (CommPortIdentifier) portList.nextElement(); This may be a problem. You call nextElement for the println, which will print the first element in the Enumeration, so your while loop will start with the second element (if any) in the Enumeration. …

Member Avatar for JamesCherrill
0
338
Member Avatar for dlgmu537

It's nothing to do with Parent/Child. It's because you have an executable statement (`avg = st_marks/2;`) that's not inside a method or other executable block. You could do that as an initialisation expression as part of the declaration of avg...

Member Avatar for jalpesh_007
0
195
Member Avatar for HankReardon

1 arr is an array of ints, setText needs a String, so you need to convert your value 2 SetText replaces any existing text, so setting it in a loop will just show the last value; you need to append att the text together. One way is to start with …

Member Avatar for jalpesh_007
0
2K
Member Avatar for Red_Rain

Red_Rain Maybe you misunderstand what we do here. We are not a homeowrk service. 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 …

Member Avatar for mKorbel
0
255
Member Avatar for game06

That code looks like every Boss fires a new bullet on every pass through the game loop - that's a lot of bullets. Or is there some other code that determines how often a new bullet is fired?

Member Avatar for JamesCherrill
0
206
Member Avatar for nova4005

> ... ou dont need to write how a set of code conventions state ... Possibly the worst advice of 2013 so far in this forum. Even if you never write a single program for real, even your teacher will read and mark your code. Coding standards and conventions are …

Member Avatar for nova4005
1
468
Member Avatar for hitro456

One possibility is a list where each element is a list of 3 numbers, but it looks like each line represents a single "something", so one obvious approach would be to create a "Something" class to encapsulate those 3 values, and have a List<Something>. That also puts you in a …

Member Avatar for JamesCherrill
0
184
Member Avatar for ceelos1974

In general (Windows), if you have a path with spaces in it you have to enclose the whole thing in " quote marks.

Member Avatar for JamesCherrill
0
169
Member Avatar for game06

Do you mean keep going down untill it's completely off the screen? I don't understand your hit method how often will that be executed?

Member Avatar for game06
0
137
Member Avatar for riahc3

> StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead. Java 7 API doc for StringTokenizer

Member Avatar for mKorbel
0
554
Member Avatar for klin1344

Every time you call getDays you increment the elements of dayCounts - I can't see any code where its values are reset. Eg the loop counter on line 36 calls getDays each time the loop is iterated, each call incrementing dayCounts.

Member Avatar for klin1344
0
1K
Member Avatar for ef_mag

If you are using Eclipse then ou could use its debugger to trace the execution of your program to see what is, and what is not, being executed. If you don't know how to do that yet, just add print statements at key points in the code so you can …

Member Avatar for JamesCherrill
0
2K
Member Avatar for JamesCherrill

Java SE JRE 7 update 21 is now available, with fixes for dozens of security-related issues. Immediate installation is highly recommended. Head on over to Oracle's Java download page and grab it now. There is also a version for Java 6 users, if any such animals still exist.

Member Avatar for jwenting
2
181
Member Avatar for joseph.lyons.754

Just to understand what you are saying... the option pane on line 9 displays, but then you do nor see any of the option panes on lines 18, 21 or 25?

Member Avatar for joseph.lyons.754
0
197

The End.