1,678 Posted Topics

Member Avatar for llemes4011
Member Avatar for llemes4011
0
37
Member Avatar for transplantedNYr

I don't know what the name of your class is, but I do think I know why you are getting static reference errors. You are in a static method, main (look at the declaration of the method - it says static), and you are probably trying to put things into …

Member Avatar for transplantedNYr
0
160
Member Avatar for klactose

Yes, it is possible. It is actually pretty easy. Before you get into it though, I'd recommend that if you have different sized panels, you do not use cardlayout, as I tried this, and it is very difficult to resize them. [url]http://java.sun.com/docs/books/tutorial/uiswing/layout/card.html[/url] Use this link to learn how to do …

Member Avatar for klactose
0
179
Member Avatar for esesili

You managed to make the try catch block. Now all you have to do is System.out.println(variable nexocentric told you to output). Debugging is a very important part of programming, so you need to learn to do it. Debugging tools are very helpful, but I personally prefer print statements. If you …

Member Avatar for JamesCherrill
0
145
Member Avatar for benatschool

What are you having trouble with? You said you're having trouble storing things in a list, but I see from your diploma code where you add the thing to the TreeSet that you are doing this fine. An ArrayList works the same way. Going off of JavaAddict's earlier example, ArrayList<People> …

Member Avatar for javaAddict
0
117
Member Avatar for grisha83

For testing whether or not a Character is a digit, you can use the Character class's method isDigit(). So, for example, [CODE=Java] String s = stdin.readLine(); for(int i = 0; i < s.length(); i++){ if (s.charAt(i).isDigit()){ System.out.println("It's a digit!"); } } [/CODE] But for your purposes, if you don't want …

Member Avatar for grisha83
0
81
Member Avatar for puk

The problem is 1. You didn't post your [I]properly formatted[/I] code in code tags so it is hard to read your code. 2. You never explained what you want to be output. What is the content that should be in the file? Is it an array of ints, called myInts? …

Member Avatar for BestJewSinceJC
0
100
Member Avatar for Dio1080

Personally I wouldn't listen to anyone who pastes code at you and doesn't explain it at all, but that's just me. I don't understand what you mean by "median of three", care to explain?

Member Avatar for BestJewSinceJC
0
936
Member Avatar for valenchang

[url]http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics.html[/url] This class^ pretty much has all the methods you need. drawRect and drawOval or fillRect and fillOval are probably the ones you will use. What you need to do is shown here: [url]http://java.sun.com/docs/books/tutorial/2d/geometry/primitives.html[/url] . I can never remember when you're supposed to override the paintComponent method instead of the …

Member Avatar for Ezzaral
0
115
Member Avatar for genuis1

I don't really understand you, no. But if you're trying to do different chats then you need to use separate threads....

Member Avatar for genuis1
0
77
Member Avatar for bdrose64

Just increment an int until it is less than a certain value or something if you don't want to take Vernon's advice. int i = 0; do{ i++; } while(i<10000000)

Member Avatar for VernonDozier
0
97
Member Avatar for kbmmartin
Member Avatar for siddhant3s
0
6K
Member Avatar for epoe

I'm sure there is a better way to do this, but for lack of any other responses right now, why don't you use the substring method and the equals method to determine whether something matches the pattern?

Member Avatar for javaAddict
0
126
Member Avatar for Atomika3000

You are reading from and writing to the same file. After you are finished reading everything from it, delete the file, [I]then[/I] write to the file. Then tell me if you are still having problems. Without reading the PrintWriter documentation, it seems like it is just appending the new text …

Member Avatar for javaAddict
0
96
Member Avatar for radhasb

I remember a discussion about this on Daniweb before. You might want to do a search for it. But I'm pretty sure the only way to do what you want is to read the file, delete it, and write what you want the file to be back to the same …

Member Avatar for DotA
0
494
Member Avatar for wedunnit

By any chance do you go to umbc . . ? This just looks somewhat similar to a program they typically have students do (although the one they do is a lot more complicated, but that could be because you just started or omitted code, etc). Could also just be …

Member Avatar for wedunnit
0
95
Member Avatar for BestJewSinceJC

I'm using netbeans and I have a problem. I'm using a card layout to flip between multiple windows. Two of these windows are wider than the others, and this cannot really be helped. Ideally, it would be best to design each window so that they are all the same size, …

0
62
Member Avatar for Gman36

You can do all of this in one class if you really want to, but there is no need to do so - you can just as easily do it the way you have things set up. The way to make a button do something when it is clicked is …

Member Avatar for VernonDozier
1
192
Member Avatar for wedunnit

I think he wants to do something more like int total = 0; //where array is an array of strings for (int i = 0; i < array.length; i++){ total+=Integer.parseInt(array[i]); }

Member Avatar for BestJewSinceJC
0
103
Member Avatar for Rastabot

It seems like you would have to do a few things to compare two Infinite Integers. 1. Does one have more nodes than the other? If so, the one with more nodes is greater, since each node holds 3 numbers. 2. Do they have the same number of nodes? If …

Member Avatar for ~s.o.s~
0
332
Member Avatar for bahr_alhalak

[QUOTE=bahr_alhalak;854624] 1)What is the difference between an instance data field and a static data field?? [/QUOTE] [URL="http://java.sun.com/docs/books/tutorial/java/javaOO/classvars.html"]You need to look things up on your own.[/URL] :)

Member Avatar for digirandi
0
102
Member Avatar for Atomika3000

To "delete" stuff from the text file, you have to read in the entire file, while deciding what you do and don't want in it, then write the output (the stuff you [I]do[/I] want in the text file) back to the same file. You can do this one of two …

Member Avatar for Atomika3000
0
140
Member Avatar for adnana1024

You need two methods because there are two independent patterns in that picture. The first pattern is the one that looks like: * ** * And the second pattern is the one that switches between printing 4 stars and 8 stars. All you need for the first method is something …

Member Avatar for BestJewSinceJC
0
124
Member Avatar for carloscarlos

Is there any reason you extended Applet and not JApplet? Just curious; I have no idea if it matters or not.

Member Avatar for Frickelmeier
0
111
Member Avatar for hopzta

I don't know if this is relevant or not, since looking at your code, I see nothing really. But to switch the item in the combo box you'd just use jComboBox.setSelectedItem(index). And your method would obviously have to check the array to make sure you're in bounds, then flip to …

Member Avatar for BestJewSinceJC
0
95
Member Avatar for compscinerd69

[QUOTE=compscinerd69;854102]The programming assignment is to implement a class Purse. A purse contains a collection of coins. Each coin object must contain its name. You should not put a limit on the number of coins that a purse can hold. This program should provide the user with the ability to display …

Member Avatar for BestJewSinceJC
0
1K
Member Avatar for BestJewSinceJC

How can I check if an event is user generated? When the user clicks on a combo box and changes the displayed/selected content, I want the code in the itemStateChanged method to be executed. But I only want this code to be executed if the method call was due to …

Member Avatar for BestJewSinceJC
0
96
Member Avatar for BestJewSinceJC

[CODE=Java]java.util.Vector<EmergencyContacts.ContactInfo> contacts = Application.getPatient().readEmergencyContacts().readContactInfos(); for (int i = 0; i < contacts.size(); i++){ EmergencyContacts.ContactInfo info = contacts.get(i); } public Vector<ContactInfo> readContactInfos(){ return contacts; } private Vector<ContactInfo> contacts = new Vector<ContactInfo>(); [/CODE] As you can see, it returns a Vector of ContactInfo. Why would I be getting an error saying, "Exception …

Member Avatar for quuba
0
132
Member Avatar for KingsKidy

You cannot compare Strings using '==' you must use the String class's equals method. if(titlelisting.getSelectedValue()=="OxbridgeBaby")

Member Avatar for Ezzaral
0
116
Member Avatar for d0813008

We don't do problems for you, we help you do them. Ask a more specific question. If you just want the code I'm sure you will find it all over the internet anyway. This isn't exactly an original problem.

Member Avatar for BestJewSinceJC
0
43
Member Avatar for mzdiva041986

Yes, but that still isn't a question, it is a project description. In order to help you without doing your project for you, we need to know specifics about what you're having trouble with, where in the code, what you've attempted, what isn't working, etc. "What isn't working" is usually …

Member Avatar for BestJewSinceJC
0
74
Member Avatar for jsully1

To do it with netbeans, you add one JTabbedPane to a JPanel or JFrame. Then I think you add JPanels to that JTabbedPane, and it automatically makes these JPanels into tabs. To flip between the tabs, you click them on the side where it has the listing of all your …

Member Avatar for BestJewSinceJC
0
70
Member Avatar for Grn Xtrm

You can use the removeElementAt method to remove the last item. To know where the last item is, your program can either keep track of the size of the Vector, or you can use the Vector class's size() method. [url]http://java.sun.com/javase/6/docs/api/java/util/Vector.html[/url]

Member Avatar for Grn Xtrm
0
142
Member Avatar for Zass101
Member Avatar for peter_budo
-3
222
Member Avatar for Thayland

char dash = phoneNumber.charAt(1); Why do you seem to think the character at that index is 1? That will only be the case if you enter it in the form 1-whatever. Since you determined that your '-' is at phoneNumber.indexOf("-"), the next part of your phoneNumber is going to be …

Member Avatar for Thayland
0
2K
Member Avatar for BestJewSinceJC

Question directed at JamesCherill specifically, (and anyone else who can answer it) I've never had [I]too[/I] much trouble with communicating between the model and the view, in an application that only has a model and a view. However, looking at the observer pattern (at the bottom) of this [URL="http://leepoint.net/notes-java/GUI/structure/ui-model-communication.html"]link[/URL], I …

Member Avatar for Ezzaral
0
1K
Member Avatar for Mubo
Member Avatar for smsamrc
Member Avatar for trombadorez
Member Avatar for BestJewSinceJC
0
82
Member Avatar for lstjean

It depends on what programs you are running and what is taking up your RAM. Vista definitely isn't using more than a gig, so I would say it is probably bad. But like I said. . it depends what you are running.

Member Avatar for Suspishio
0
81
Member Avatar for neha_p
Member Avatar for k2k

I'm hardly an expert, but have you tried programmatically "clicking" the menu item again after the JPanel is set visible? That might make it appear on top again. Worth a try anyway, although even if it works, there is probably a better solution. I ran into a similar problem but …

Member Avatar for k2k
0
182
Member Avatar for nightGoddess

Use the String class's toCharArray method, putting the entire String into a character array. Then you can check each index to make sure the correct thing is at the index. For the indexes that contain numbers, you can use the Character class's isDigit method. There is also a more elegant …

Member Avatar for nightGoddess
0
118
Member Avatar for GiddyupGilbert

No, certainly do not try any software provided by anyone with 5 posts, especially when there is a solution which involves nothing except the OS. In other words use Jbennet's solution.

Member Avatar for francisabey
0
104
Member Avatar for neutralfox

When you have GUI applications, they usually should run on the [URL="http://java.sun.com/docs/books/tutorial/uiswing/concurrency/dispatch.html"]Event Dispatch Thread[/URL]. The EDT is what James is talking about when he says the Swing thread. Since you are waiting for a connection on the EDT, you are blocking the thread, since a Thread can only do one …

Member Avatar for BestJewSinceJC
0
259
Member Avatar for neutralfox

Yes- you do need to use good design to become a good programmer. However, don't let that article discourage you. I think you said you just started programming - a chat application is not something most people who just started programming would have much of a chance at completing successfully. …

Member Avatar for neutralfox
0
97
Member Avatar for vipinsagar

I don't know how insistent you are on using whatever field you're using now, but one example of how you can display a number without the commas: [CODE=Java]import javax.swing.*; public class FormatField { public static void main(String[] args){ JFrame frame = new JFrame(); JPanel panel = new JPanel(); frame.add(panel); JFormattedTextField …

Member Avatar for vipinsagar
0
79
Member Avatar for yingfo

So if they type in $PART2, you WANT it to print error postfix expression? edit: It probably isn't working because you didn't prompt the user for input before the second loop. So it says while(scanner.hasNext()), but you never prompted the user (using a println statement), so it never entered that …

Member Avatar for BestJewSinceJC
0
207
Member Avatar for yingfo

if(letter == "$PART2") You can't test a String's contents by using '=='. It only works for primitive types, String is an Object. Use the String class's equal method

Member Avatar for stephen84s
0
168
Member Avatar for leverin4

Location start = getStart(), current; You should check that that line is doing what you want it to.

Member Avatar for BestJewSinceJC
0
121

The End.