Forum: Java 9 Days Ago |
| Replies: 3 Views: 179 if you do things like removeAll() on a JFrame or JPanel, then after adding new panels, you might need to call revalidate() or validate(). I've told people that before and they've reported back... |
Forum: Java 11 Days Ago |
| Replies: 5 Views: 286 If you declare a method as taking an int as a parameter, then you need to pass that int. i.e. in your setX and setY methods, you cannot call setX(), you have to call setX(PUTANINTHERE!!!)
hope... |
Forum: Java 15 Days Ago |
| Replies: 2 Views: 153 This is definitely interesting. Before I get into my crazy idea of how to do this (that involves bit stuffing and using a special character to denote the start and end of images) let me make sure I... |
Forum: Java 15 Days Ago |
| Replies: 6 Views: 320 Why is there so much code in your remove method? All you need to do is search linearly through your array looking for an item with the name that matches the String you're searching for. That should... |
Forum: Java 17 Days Ago |
| Replies: 2 Views: 148 Your error indicates that you attempted to parse an integer at line 128 of your program (which is correct: it says Integer.parseInt(input)). However, the program was unable to parse an int, because... |
Forum: Java 17 Days Ago |
| Replies: 5 Views: 381 For specific components see here: http://java.sun.com/docs/books/tutorial/uiswing/components/index.html
(for example, if you want to use a button in your app, look there to see how, or if you want... |
Forum: Java 18 Days Ago |
| Replies: 2 Views: 315 Did you even look at his code? The problem is obviously with the way he is reading in the text file.
@OP:
Scanner's next() method reads in input between the delimiter pattern, which by default... |
Forum: Java 23 Days Ago |
| Replies: 6 Views: 345 SWT was created for faster native widgets - it is faster because it uses the OS's native tools to draw the widgets, essentially. However, Swing should be plenty fast for most any purposes, and I... |
Forum: Java Nov 12th, 2009 |
| Replies: 7 Views: 601 If you use Java's built in Stack class and Queue class, you can simply call the appropriate methods to add the items on and take them off. For both of them, to add an item on, you probably just use... |
Forum: Java Nov 12th, 2009 |
| Replies: 7 Views: 601 abccba
if you add each letter in order to the stack and the queue, here is the final stack and queue (in the order they would be popped off)
1. abccba
2. abccba
But looking at something... |
Forum: Java Nov 9th, 2009 |
| Replies: 2 Views: 309 Check is extremely simple actually. If any piece can currently move to the king's position, then the king is in check. Since you already have to implement the ability to allow players to move any... |
Forum: Java Nov 5th, 2009 |
| Replies: 8 Views: 380 Like the docs say, split does not return the character that was split around. My point in my previous post was that you can easily figure out where the characters were anyway by using a little... |
Forum: Java Nov 4th, 2009 |
| Replies: 3 Views: 154 import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class ComboBoxFrame extends JFrame {
/***/ private static final long serialVersionUID = 1L;
private JComboBox b;... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 523 My example was pretty long, but try to grasp the concept and I think you'll be able to complete your program. Again, the basic idea I'm proposing is that you multi-thread your application so that the... |
Forum: Java Nov 4th, 2009 |
| Replies: 18 Views: 523 Sorry, took too long and couldn't edit my last post. Update:
Ok, so this seems to be the issue: since read() blocks while it waits for input, when the client's receive() method is executed, all... |
Forum: Java Nov 3rd, 2009 |
| Replies: 18 Views: 523 I looked through your code, and I don't see a reason why you should be continuously adding and removing the mouse listener. If there is no reason to do so, don't do it. (I.e. it adds nothing to your... |
Forum: Java Oct 29th, 2009 |
| Replies: 21 Views: 701 http://java.sun.com/j2se/1.5.0/docs/api/java/util/Scanner.html
Using next() is the easiest way to go and will work for what you are describing. And I'm linking to the documentation because if you... |
Forum: Java Oct 28th, 2009 |
| Replies: 5 Views: 337 Just use the drawString method to draw your words. g.drawString(parameters go here) http://java.sun.com/j2se/1.4.2/docs/api/java/awt/Graphics.html
You can set the Graphics contexts' font and color... |
Forum: Java Oct 27th, 2009 |
| Replies: 11 Views: 323 Put "Website Major" in your resume, and I bet you never get a job. But seriously, the lack of social skills and self motivation is probably a good cue for where your future is going.
Why do you... |
Forum: Java Oct 22nd, 2009 |
| Replies: 2 Views: 315 Re-read your project assignment. Pay particular attention to the part that I bolded. |
Forum: Java Oct 21st, 2009 |
| Replies: 3 Views: 488 Character ch = new Character('\u00C3');
char prim = ch.charValue();
System.out.println(prim);
Something I just learned how to do after a quick look up in the Character class documentation. I'm... |
Forum: Java Oct 21st, 2009 |
| Replies: 7 Views: 729 The reason it gives you trouble is because when the user enters an integer then hits enter, two things have just been entered - the integer and a "newline" which is \n. The method you are calling,... |
Forum: Java Oct 20th, 2009 |
| Replies: 2 Views: 209 I'll give you some hints and leave the rest of the work (such as using the definition of theta to come up with the values that prove it's big theta) up to you. But these are just my thoughts, no... |
Forum: Java Oct 15th, 2009 |
| Replies: 5 Views: 404 Not that the OP is interested, but in case anyone is, finding the minimum and then finding the maximum takes (n-1) comparisons each for a total of 2n-1 comparisons. The same can be done in about... |
Forum: Java Oct 14th, 2009 |
| Replies: 3 Views: 250 edit - sorry, posted this at the same time as James
int N1, N2, product, PoNoN1, PoNoN2;
PoNoN1=N1+"(POSITIVE)";
You can't store Strings into integers. So declare PoNoN2 as a String, not as an... |
Forum: Java Oct 13th, 2009 |
| Replies: 3 Views: 229 The point is, the existeValor method takes three arguments, but you were only passing in one argument. That will only result in a compiler error - the two are treated as completely different methods.... |
Forum: Java Oct 12th, 2009 |
| Replies: 1 Views: 248 You can find all kinds of information on these on google. Top down is typically thought of as breaking your problem into subproblems, then breaking these subproblems into further subproblems until... |
Forum: Java Oct 9th, 2009 |
| Replies: 2 Views: 287 Incorrect. Anything in that first argument has to amount to a String, just like the javadoc says for the drawString method. So you could put "I'm a String!" + object.toString() in that slot if you... |
Forum: Java Oct 8th, 2009 |
| Replies: 8 Views: 399 It seems like you already figured out how to get the Characters from the ArrayList and compare them to see if they are the same. Now all you need to do is write a for loop that prints from 1 . . n... |
Forum: Java Oct 8th, 2009 |
| Replies: 7 Views: 312 Other things you should be aware of:
1. The two statements inside of your constructor do not do anything. You assigned inputMile equal to itself and then you assigned outputKm equal to itself. I... |
Forum: Java Oct 8th, 2009 |
| Replies: 7 Views: 312 You created an inner class that implements ActionListener, and you defined the actionPerformed method for that inner class. But when you make the following statements:
Chapter165 listener = new... |
Forum: Java Oct 8th, 2009 |
| Replies: 2 Views: 480 We don't do people's work for them. If you read the stickies, you'll notice that we're here to help people learn how to do things themselves. Also, since AVL trees are a data structure, I'm sure... |
Forum: Java Oct 5th, 2009 |
| Replies: 2 Views: 453 What you want to do is draw two rectangles onto a window. What you're doing is creating two JPanels (which is essentially two different windows, not one), both of which have rectangles drawn inside... |
Forum: Java Aug 19th, 2009 |
| Replies: 9 Views: 250 James is right - you can create the JLabels in the class definition, but nothing further. In the future, you should use an array if you have any type of collection of Objects like you do above. For... |
Forum: Java Aug 16th, 2009 |
| Replies: 6 Views: 258 This isn't a website for hand holding. The information is readily available. Look it up. Figure it out. |
Forum: Java Aug 13th, 2009 |
| Replies: 19 Views: 559 WorkThread should not be running on the EDT. This indicates that WorkThread is not running in a separate thread - so the new Thread was not set up properly. Look up how to create a separate Thread on... |
Forum: Java Aug 4th, 2009 |
| Replies: 5 Views: 365 I'm not knocking adatapost's suggestion - he gives great suggestions - but his suggestion might be a little too advanced for what you're doing right now. Either way, you might want to explain exactly... |
Forum: Java Jul 30th, 2009 |
| Replies: 3 Views: 189 you didn't use code tags. read the stickies. all of them. completely. |
Forum: Java Jul 27th, 2009 |
| Replies: 29 Views: 1,576 JButton Reset = new JButton("Reset");
centerpanel2.add(new JButton("Reset"));
Should be:
JButton Reset = new JButton("Reset");
centerpanel2.add(Reset);
Again, follow coding... |
Forum: Java Jul 6th, 2009 |
| Replies: 22 Views: 1,313 Correct me if I'm wrong: What you are trying to do is compare the first column of file 1 to the first column of file 2. So let's say you put all of the Strings from column 1 of file 1 into an... |