7,116 Posted Topics

Member Avatar for fuzzyrose

There's nothing Windows-specific in there, so it should just compile and run under Linux as-is. Have you tried it?

Member Avatar for kvprajapati
0
238
Member Avatar for redZERO

Don't know why that didn't work, but why not just use [icode]getSubimage(int x, int y, int w, int h)[/icode] to create your array of sub-images directly?

Member Avatar for JamesCherrill
0
459
Member Avatar for KimJack

[url]http://www.java-tips.org/java-se-tips/java.io/how-to-use-random-access-file.html[/url]

Member Avatar for kvprajapati
0
268
Member Avatar for tformed

Your Customer constructor requires a Name and an Address, but you have just provided the raw information (last ... zip). You have to create a Name and Address from the raw data and pass that to Customer [CODE=java]Name n = new Name(last, first); Address a = new Address(street, city, state, …

Member Avatar for tformed
0
239
Member Avatar for jayless

^ like Vernon says, or maybe you will see the title as a parameter to the frame's constructor.

Member Avatar for JamesCherrill
0
351
Member Avatar for caps_lock

ArrayList, from the info you have given, is a very good choice. Wen you declare and create it, specify the type of object it's supposed to contain - this will allow the compiler to check your code better and will simplify subsequent processing of its contents. [icode]ArrayList<File> arrayList = new …

Member Avatar for caps_lock
0
225
Member Avatar for lardshow

Your TutorGroup class has a SortedMap that appears to contain student names as keys and Student objects as values. You can use this map to look up the Student object for any given name. The map is private, so you can't just access it from anywhere else (quite rightly!), so …

Member Avatar for lardshow
0
92
Member Avatar for neutralfox

If you use a port in the non-restricted range you would be unlucky to hit one that was in use. Maybe all you need to do if you [B]do [/B]get a BindException is to just try the next one (etc) until its OK.

Member Avatar for JamesCherrill
0
151
Member Avatar for cwarn23

Since nobody else has the answer I had a quick Google, and found this: " How do I use JSAPI in an applet? It is possible to use JSAPI in an applet. In order to do this, users will need the Java Plug-in (see [url]http://java.sun.com/products/plugin)[/url]. The reason for this is …

Member Avatar for cwarn23
0
191
Member Avatar for edwardtong694

Are you certain that the Pic01.JPG file really is there, and its name is correctly capitalised? (just checking). May be worth just seeing if the new ImageIcon isn't null.

Member Avatar for JamesCherrill
0
101
Member Avatar for djdanjo82

The normal strategy for this is to add public methods to your Gui class that Gui2 can call to achieve whatever it is you want achieved. You may well already have a public constructor for Gui, so that may cover the "display" part.

Member Avatar for djdanjo82
0
140
Member Avatar for k1lguy
Member Avatar for farooq82

You should probably be using a pair of wait/notify to signal between the two console outputs. That's a standard Java way to ensure that the two writes alternate properly. Here's a reasonable intro to the subject: [url]http://www.java-samples.com/showtutorial.php?tutorialid=306[/url]

Member Avatar for verruckt24
0
159
Member Avatar for kvprajapati

Two is not static, so it needs an instance of One to be created in. ie [icode]One.Two p=new One() . new Two();[/icode] Alternatively, declare Two as static

Member Avatar for JamesCherrill
0
168
Member Avatar for PhoenixInsilico
Member Avatar for JamesKox

InputStream, as the Java API doc makes very clear, is an abstract class; it's definition is incomplete and you cannot instantiate it with new. It's purpose in life is to define a standard set of operations that any byte-oriented input stream should implement. As also explained in the API doc, …

Member Avatar for kvprajapati
0
2K
Member Avatar for custurd12

You don't seem to call setMonths() anywhere, so that's why it's not doing anything. Perhaps you should call it at the end of your constructor? I don't know the math for std dev, but your method: a) sets it to sqrt(n), when n=0. Seems pointless b) then sets n to …

Member Avatar for JamesCherrill
0
2K
Member Avatar for KirkPatrick

If your code is an ActionL:istener, you're probably listening for the wrong event to see if the selection has changed. You probably need an ItemListener.

Member Avatar for JamesCherrill
0
2K
Member Avatar for DeathWalker101

I don't understand the question... but is this what you were looking for? [code=java]for (int i = 0; i<var1; i++) { for (int j = 0; j<var1; j++) { System.out.print(var1); } System.out.print("\n"); }[/code] giving: 333 333 333 or, for var1 = 2, 22 22

Member Avatar for tux4life
0
84
Member Avatar for airey1988

If the list has already been created, all you need in the new method is [CODE]public List<Customer2> getCustomers() { return list; }[/CODE] and the easiest and safest way to loop thru a list is [CODE]for (Customer2 cust : getCustomers()) { System.out.prinltln(cust.getName()); // or whatever }[/CODE]

Member Avatar for giri.pankaj
0
81
Member Avatar for suretd
Member Avatar for blur0224

If the last block you read is <1024 bytes, you still write 1024 bytes to the output stream.

Member Avatar for blur0224
0
215
Member Avatar for alias120

Doesn't readData have default (package) scope, and is therefore accessible from the main class? If it wasn't, you would get a compile error. Maybe the output file needs to be closed before the contents are read?

Member Avatar for alias120
0
80
Member Avatar for llemes4011

THis capability was added to Java in the latest version (1.6, aka Java 6). [url]http://blogs.sun.com/CoreJavaTechTips/entry/getting_to_know_system_tray[/url]

Member Avatar for JamesCherrill
0
94
Member Avatar for add4

Normally you would have a separate thread waiting on a read from the input stream. When the server sends something, the read completes. The read is in a loop, so after receiving an object it just goes back to waiting for the next one. However, if you want to poll …

Member Avatar for JamesCherrill
0
103
Member Avatar for JustmeVSI

Adobe have a free JavaBean to display pdf in a Swing app. See: [url]http://www.informit.com/guides/content.aspx?g=java&seqNum=377[/url]

Member Avatar for hardik.rajani
1
249
Member Avatar for hemanthjava

I think you will find this [B]very[/B] interesting [url]http://www.apl.jhu.edu/~hall/java/Swing-Tutorial/Swing-Tutorial-JEditorPane.html[/url] just scroll down to section 2.

Member Avatar for hardik.rajani
0
2K
Member Avatar for Magda

I'd go for a simple solution - create int variables in the Thread class to hold the number of threads currently using the track in each direction. Increment the appropriate variable in useTrack and decrement it in exitTrack. Now you have the info necessary to perform the tests specified in …

Member Avatar for JamesCherrill
0
146
Member Avatar for MrDiaz

Either way, you could (should?) make the storage mechanism "pluggable" by defining an abstract class that handles all the store/retrieve operations and then implement flat file and/or SQL versions as required.

Member Avatar for JamesCherrill
0
192
Member Avatar for bokz06

is this what you want to achieve? [CODE=java]String change1 = ""; while (!change1.equalsIgnoreCase("y") && !change1.equalsIgnoreCase("n") change1 = JOptionPane.showInputDialog("Change Silo 1 dimensions? (y/n)"); }[/CODE]

Member Avatar for bokz06
0
109
Member Avatar for zyaday

The Java API reference for Graphics includes [icode]drawImage(Image img, int x, int y, int width, int height, ImageObserver observer) [/icode] did you have a look at his?

Member Avatar for JamesCherrill
0
120
Member Avatar for Darkmeerkat

Maybe you have an out-of-date .class file for Temperature, or that file isn't in the classpath when you execute your other class?

Member Avatar for JamesCherrill
0
141
Member Avatar for bokz06

Start with something like: [CODE=java]public void actionPerformed (ActionEvent event){ int[] selectedRows= table.getSelectedRows() for (int i : selectedRows) System.out.println(i); }[/CODE]

Member Avatar for JamesCherrill
0
2K
Member Avatar for squinx22

fSize isn't defined (as far as I can see). The problem's probably in the way the loops are constructed, but because you posted your code without [code=java] tags and proper indentation it's too hard to see.

Member Avatar for JamesCherrill
0
89
Member Avatar for lkw8888

Java Threads are fundamental to the whole Java API. They really do work, properly. What's the problem with your code? You say "don't work properly" but that tells us nothing - what exactly your program do/not do that you didn't expect?

Member Avatar for JamesCherrill
0
94
Member Avatar for llemes4011

Bean is short for JavaBean. The Wikipedia entry is a good place to start. Its a java class that conforms to some simple conventions (especially: uses standard get/set methods for its variables, and can be serialised) that enable it to be used in a plug-n-play kind of way to build …

Member Avatar for JamesCherrill
0
42
Member Avatar for Der_Kaiser

If you know how to get data from a client to a server and you also know how to get data from a server to an(other) client, then you already know how to send data from one client to another via a server!

Member Avatar for BestJewSinceJC
0
168
Member Avatar for bokz06

You split the line into the String array rowFields, but then you do nothing with it. Perhaps you should loop thru the members of that array printing them, or storing them somewhere.

Member Avatar for bokz06
0
5K
Member Avatar for DotA

[icode]Student students[] = new Student[MAX];[/icode] in the constructor incorrectly declares a new array called students[] whose scope is limited to the constructor and which is garbage collected when the constructor exits. This does not do what you intended, which is to initialise the students[] array that you declared in the …

Member Avatar for DotA
0
125
Member Avatar for Q8iEnG

getInput() returns an instance of the Wire class, so that cannot be directly compared to a boolean value. You probably want to use the boolean value that the isValue() method returns for that instance of Wire. ie getInput().getValue() (as previously explained by Vernon). You don't need to compare a boolean …

Member Avatar for BestJewSinceJC
0
162
Member Avatar for AirmanTheGreat

1. 22/7 is a calculation using 2 integers, so it's performed in int arithmetic, giving the int result 3, which is then assigned to the long variable. Just making one of the values a floating poit number will force the calc into floating point, eg 22.0/7 2. When you calc …

Member Avatar for AirmanTheGreat
0
122
Member Avatar for Zibo

A fewof quick comments: I wouldn't worry about creating a new thread for each click - what's the problem? You shouldn't need to run the text update on the EDT, setText is one of the very few swing methods that is thread safe. Rather than sleeping your thread, just call …

Member Avatar for Zibo
0
131
Member Avatar for kingarabian

Depending on the value of i_0_ it constructs an array of RSStrings (no definition provided) and passes it to one on a number of similarly-named methods (no code or definitions provided), and returns whatever value that that method returns. Also, at the beginning it updates a couple of couple of …

Member Avatar for kingarabian
0
127
Member Avatar for jade387
Member Avatar for KirkPatrick
Member Avatar for grisha83

... and a few more examples: Open a window with a given title, text, and buttons. Open a TCP/IP server on a given port. Open a file, given the file name. Start a randon number generator with a given seed. ... in each case the things that are "given" are …

Member Avatar for BestJewSinceJC
0
103
Member Avatar for sammo5889

The stop(); method for Thead is deprecated because it has problems. Here's what the API doc has to say: . This method is inherently unsafe. Stopping a thread with Thread.stop causes it to unlock all of the monitors that it has locked (as a natural consequence of the unchecked ThreadDeath …

Member Avatar for JamesCherrill
0
125
Member Avatar for peedi

winningNum is an array. You need to put the first number into winningNum[0], the next into winningNum[1], etc

Member Avatar for BestJewSinceJC
0
5K
Member Avatar for grisha83

One class can only have one constructor with any given list of parameters (although it can have any number of constructors that take different parameters). So it makes no sense to copy a constructor in the same class. If you create a subclass, the superclasses' constructors are NOT inherited, so …

Member Avatar for grisha83
0
111
Member Avatar for JamesCherrill

OK, I'm obviously going bonkers here, but has something happened to the java code tags? Why doesn't this work in preview mode? [CODE=java] i++; [/CODE]

Member Avatar for JamesCherrill
0
157

The End.