7,116 Posted Topics

Member Avatar for 2concussions

Is the problem calculating what the line should be, or is it just drawing it? How are you drawing your solar system so far?

Member Avatar for 2concussions
0
249
Member Avatar for pbj.codez

That sounds like a perfectly reasonable and interesting Java project, assuming you can get access to the live info through some kind of internet service. Downloading/copying databases is unlikely to give you the kind of real-time data you want. Finding that access must be step one, because if you can't …

Member Avatar for pbj.codez
0
259
Member Avatar for Violet_82

Beware of confusing your terminology here... methods can not be "unchecked", only Exceptions can be. If you drill further into the JavaDoc you will see that all three exceptions that nextInt may throw extend RuntimeException and are therefore unchecked. The definition of nextInt() in the API source code does not …

Member Avatar for Violet_82
0
398
Member Avatar for cleve23

Probably refers to the different ways that numbers are typed, thousands separator, decimal point etc eg US 12,34.56 in France would be 12.345,56, and I think some countries leave a blank as the thousands separator

Member Avatar for JamesCherrill
0
200
Member Avatar for CoilFyzx

I guess you could create a *TableColumnModelListener* to monitor changes in your *JTable*'s *TableColumnModel* and get the updated widths of each *TableColumn* and use those to update the bottom table? A bit tortuous, but probably not very much code when you finally work it all out.

Member Avatar for JamesCherrill
0
478
Member Avatar for abra_ka_dabra
Member Avatar for JamesCherrill
0
247
Member Avatar for london-G
Member Avatar for JamesCherrill
0
149
Member Avatar for vehement66

Hello Anil I assume that you are the Anil who wrote the code that link refers to? Please remember that this is not a forum for self-promotion. The DaniWeb rules that you agreed to include "Do ensure that all posts contain relevant content and substance and are not simply vehicles …

Member Avatar for jwenting
0
5K
Member Avatar for pspwxp fan

There's too much missing code there to be able to diagnose this (just one eg is there a second declaration of jComboBox1 somewhere?). Have you tried the obvious debugging steps, eg print theTeams at various points in the code to check that it has the data you expect?

Member Avatar for pspwxp fan
0
845
Member Avatar for hackoman96

Learning the language itself from c++ ... you'll have 95% of it with a few days Learning the API - a lifetime

Member Avatar for iamthwee
0
275
Member Avatar for Violet_82

Since you don't actually do anything with those classes it doesn't matter what attributes they have, so maybe this example is a bit *too* simple? Do you still have your code for two or more console-based games (tictactoe, hangman, scissors/paper/rock or whatever)?. If so it may be interesting to package …

Member Avatar for Violet_82
0
6K
Member Avatar for 1bung100
Member Avatar for JamesCherrill
0
2K
Member Avatar for QuentinTanio

I admit that I don't understand this question fully, but since nobody else has any answer at all, here's my best shot. The diagram you linked to looks like a UML class diagram, in which case that will map to Java (very briefly) as follows: Each box is a class …

Member Avatar for JamesCherrill
0
196
Member Avatar for pspwxp fan

The row count tells you the number of rows in yout table's model, just like length() tells you the number of chars in a String. It makes no sense to set it, because then it would be wrong. Just make your model the right size.

Member Avatar for JamesCherrill
0
3K
Member Avatar for game06

*Typically* you would have main create the model then create the GUI, passing a ref to the model into the GUI constructor, so the GUI can use the model's accessor methods. Model m - new Model(...) // model knows nothing about the GUI GUI g = new GUI(m, ...) // …

Member Avatar for JamesCherrill
0
222
Member Avatar for samoslook

I think this is probably a JavaScript thing, not Java. Try posting it in the Web Development section

Member Avatar for samoslook
0
132
Member Avatar for Huang xiao

I see no code to paint bullets! In your paintComponent, around line 79, you need to loop through your arraylist of bullets, painting each bullet at its current x,y position.

Member Avatar for JamesCherrill
0
189
Member Avatar for rohansharma

It's not clear whether this is a genuine recommendation or just commercial spam. I'm following it up with the OP, but in the meantime I suggest you all treat this with great care and suspicion.

Member Avatar for JamesCherrill
-2
248
Member Avatar for stefanienikole

> you'll have instantiate a new enum. ? You can't instantiate enums. They are created some time before they are first needed and that's it.

Member Avatar for jwenting
0
817
Member Avatar for gyno

... between 0 to 99 > public int nextInt(int n) > > Returns a pseudorandom, uniformly distributed int value between 0 (inclusive) and the specified value (exclusive),

Member Avatar for JamesCherrill
0
259
Member Avatar for abra_ka_dabra

Use unbuffered output streams when you want each write to be processed immediately - eg Writing a log file - you don't want the last few messages to be lost when the program crashes and the buffer is lost. Another eg - writing to a network stream to send chat …

Member Avatar for abra_ka_dabra
0
181
Member Avatar for KRUX17

Line 18 `if (rs.next...` will only execute the following code zero or one times. Didn't you mean `while (rs.next...` ? ps line 43 is a disaster. You get the message string and completely ignore it, so you will never see any error messages. Replace that line with `e.printStackTrace();` to see …

Member Avatar for KRUX17
0
202
Member Avatar for vani krishnan

Swing was not part of the first version of Java - which only had java.awt So originally swing was a java extension.

Member Avatar for jwenting
0
198
Member Avatar for abra_ka_dabra

JRE is everything you need to run Java programs, primarily (1) a JVM and (2) all the class files for the Java API and (3) other bits and pieces that are needed for some of the API classes (DLLs etc)

Member Avatar for abra_ka_dabra
0
201
Member Avatar for Osaid9

Hi tyranx, welcome to DaniWeb. Did you notice the date of this thread? It was marked as "solved" five months ago, so your answer is a little late! Your contributions are very welcome - have a look at some of the more recent topics tha thave not yet been marked …

Member Avatar for JamesCherrill
0
2K
Member Avatar for sk8ergirl

The normal sort is an ascending sort, the lesser objects sort before the greater, so is o2 is greater than o1 it will sort after it. Just think of numbers - you expect them to sort 1,2,3,4,5... smaller/lesser first, greater/larger after

Member Avatar for JamesCherrill
0
172
Member Avatar for godzab

You have an input that is not a multiple of 8 bytes, but you specify a encryption with no padding. If you don't allow the algorithm to pad your string then it's up to you to make sure its a multiple of 8 bytes. See http://stackoverflow.com/questions/4183853/encryption-message-in-java

Member Avatar for JamesCherrill
0
3K
Member Avatar for lena1990

Hello lena1990 Well done! Please share your solution with us all - how did you solve it?

Member Avatar for lena1990
-1
747
Member Avatar for wolwayne

Each tab should be created as an instance of a class, so each instance will have its own instance variable values for its own fields. Wherever you have the code to control the creation of new tabs, keep an ArrayList of those instances so you can reference them, and thus …

Member Avatar for mKorbel
0
425
Member Avatar for sash_kp

TitledBorder is because you don't import it. It's javax.swing.border.TitledBorder, so importing javax.swing.* won't import it. As for java.awt.GridBagConstraints, I don't know why that is giving a problem when you import java.awt.*

Member Avatar for JamesCherrill
0
176
Member Avatar for incxx

> I would like to know if there is a way to put the code for each of the four operators into their own method, and just have the main method print the questions and ask for the answers? Yes, it's just like you said! Put the code for each …

Member Avatar for JamesCherrill
0
211
Member Avatar for vivosmith

One case where you won't have a setter is where the field is immutable by design. Often this will be some kind of ID or serial number field which cannot change becuase it's used as the unique persistent identifier fr this object (the primary key in the underlying data storage).

Member Avatar for stultuske
0
247
Member Avatar for Afi83

> this makes the program runs so slow that makes it out of the question Is this an assumption, or did you try it? You can sort a lot of objects in milliseconds on a 21st century PC. Anyway, without seeing more of your code it's hard to understand why …

Member Avatar for JamesCherrill
0
148
Member Avatar for ktsangop

Create a new JOptionPane, let it create a JDialog that contains it, position the JDialog, make it visible... eg something like JOptionPane pane = new JOptionPane("Click one:", JOptionPane.QUESTION_MESSAGE, JOptionPane.YES_NO_CANCEL_OPTION); JDialog d = pane.createDialog(null); // see mKorbel's post for better ways to do this d.setLocation(400,400); // see mKorbel's post for better …

Member Avatar for ktsangop
0
3K
Member Avatar for sash_kp

Yes, it's completely possible. All you need is to run your server program on a computer that your client can connect to. For example that could be your own computer if you configure your router/firewalls to make it accessible from the web, or you could use a commercial hosting service.

Member Avatar for sash_kp
0
305
Member Avatar for jemz

Along with your x and y coordinaltes you could have a boolean for mouth up. In your key event handler set the boolean correctly when the user presses up or down. In your paint method use that boolean in an if test to draw the arc up or down

Member Avatar for jemz
0
1K
Member Avatar for thijo

Hello kssk Please note the [DaniWeb rules](http://www.daniweb.com/community/rules), including "Do not hijack old forum threads by posting a new question as a reply to an old one" Please start a new topic for your question, and also remember "Do provide evidence of having done some work yourself if posting questions from …

Member Avatar for JamesCherrill
0
527
Member Avatar for Sheetal Krishna
Member Avatar for proconfusion

"identify all the end points that are that distance away" Does that imply that there is a finite list of known end points? If not, just get a random deltaX in the range (0 - drivingDistance), set deltaY to (drivingDistance - deltaX), so the sum of the x and y …

Member Avatar for JamesCherrill
0
232
Member Avatar for proconfusion

The Random class has a nextGaussian() method, so that's obviously going to be part of yur solution... http://docs.oracle.com/javase/7/docs/api/java/util/Random.html#nextGaussian%28%29

Member Avatar for proconfusion
0
149
Member Avatar for sash_kp

You could write a simple Java program to read a text file, delete any leading integers and write it back out. 15 minutes tops.

Member Avatar for ddanbe
-1
298
Member Avatar for DrEinstein

Check the API documentation for JTextField, you know, the one that starts "JTextField is a lightweight component that allows the editing of a single line of text." Try JTextArea, "A JTextArea is a multi-line area that displays plain text"

Member Avatar for DrEinstein
1
676
Member Avatar for tdoggrme

Hi hlut, welcome to DaniWeb. Thanks for your feedback. It's good to know that people are finding our service useful. (ps: Don't worry about stultuske's post - I think he misunderstood yours.)

Member Avatar for JamesCherrill
0
7K
Member Avatar for abra_ka_dabra

First thing to remember is that Java doesn't really have a "2D array". All arrays have a single dimension BUT any element may itself be an array (etc recursively). So what you have is an array of arrays. It sounds like you want to sort the "outer" array using the …

Member Avatar for JamesCherrill
-1
332
Member Avatar for khairullah.kazimi.1
Re: game

That's possibly the worst first post I have ever seen! 1. You give exactly zero idea of what kind of game - tic-tac-toe on the console, WoW-type massive online role play, chess with AI that can beat a grand master, a completely new game...? 2. What makes you think this …

Member Avatar for stultuske
-2
109
Member Avatar for angelivanov

One thing looks odd... "globalStack" is an instance variable, not static, so there is one "global" stack for each Thread. At the very least that's a *terrible* name

Member Avatar for JamesCherrill
0
1K
Member Avatar for pooh1234qwerty

\ is an escape character, eg \n = newline. For a single \ you need to code two \

Member Avatar for JamesCherrill
0
162
Member Avatar for vinnitro

You could make this easier for us by explaining what it's supposed to achieve, or at least posting some sample output, but at a guess, how about String stars = "***********************************************"; int n = 5; for (int i = 1; i <= n; i++) { System.out.println(stars.substring(0, Math.min(i, n - i …

Member Avatar for vinnitro
0
150
Member Avatar for moeketsi.mathe_1
Re: GUI

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 doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence …

Member Avatar for JamesCherrill
0
95
Member Avatar for Pobunjenik

Comments: I looked quickly at that code and decided I didn't have time to try to understand it. It's just too complex & nested. IMHO that's a result of not breaking the app up into enough classes. Read the rules of the game - the most common noun is "ship". …

Member Avatar for JamesCherrill
0
2K

The End.