7,116 Posted Topics

Member Avatar for naffan

Why not just create an array of GregorianCalendar instances, exactly like an array of Strings? [CODE]GregorianCalendar[] myCal = new GregorianCalendar[99]; myCal[0] = Calendar.getInstance(); // etc[/CODE] To output a GregorianCalendar instance in any specific text format you can imagine, use SimpleDateFormat, eg like this: [CODE] SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); Calendar …

Member Avatar for naffan
0
213
Member Avatar for stevanity

It's going to be difficult for anyone to answer a question that's quite as wide open as this one. You could look at a 3-layer architecture (GUI/object model/data persistence) - in which case start with the object model and define the classes and their public methods (these just need to …

Member Avatar for stevanity
0
384
Member Avatar for Majestics

Hi Majestics. Judging by the lack of replies, not many people here know the answer. Could you please take a couple of minutes to tell us all how you solved this? Thanks

Member Avatar for Majestics
0
88
Member Avatar for a.oprea

Maybe the problem is at a higher level - the top-level container. Do you add wholeItems to that (not itemsPanel!), do you pack() it afterwards?

Member Avatar for hfx642
0
96
Member Avatar for MoZo1

You can create a new Image object in the worker thread, get its Graphics, and draw your page to it. Then in the paintComponent swing thread you just need to draw that Image to the Swing Graphics. Google "Java off-screen rendering" for examples and discussions

Member Avatar for JamesCherrill
0
206
Member Avatar for stevanity

[QUOTE=NormR1;1602404]What doc are you getting that from?[/QUOTE] The source code for the API is downloadable from [url]http://download.java.net/jdk6/source/[/url]

Member Avatar for stevanity
0
113
Member Avatar for naffan

[CODE]Student.printDetails();[/CODE] printDetails is an instance method that prints the details of a single Student. It only makes sense when you call it for a single Student. You are trying to call it using the class Student, so Java doesn't know which Student you want to print the details of. [QUOTE]I …

Member Avatar for naffan
0
640
Member Avatar for funkyanki

Hi there. Seriously, if you don't have any interest in Java then look for jobs that don't need it. It's no fun working in a job where you use stuff you don't enjoy. C/C++ skills are still in demand if you look towards software companies more than end user organisations.

Member Avatar for funkyanki
0
154
Member Avatar for MagnetoM

The current version of Java is Java 6, confusingly version numbered as 1.6. There's no reason to work with any earlier version unless you are specifically required to do so. (Java 7 / version 1.7 is due out later this year, but doesn't add much over 1.6.) Anything you find …

Member Avatar for sirlink99
0
111
Member Avatar for Xufyan

[QUOTE]what is arg1.x , arg1.y ??[/QUOTE] arg1 is a Point. Look at the API doc for Point - you will see that it has two public variables x and y representing the x and y coordinates of the Point. By changing them you prove that the calling program's variable can …

Member Avatar for Zetlin
0
360
Member Avatar for caierhui

[QUOTE]My supervisor told me it would not reach 100 transaction per day.[/QUOTE] I wish I had a dollar for every time a user told me "x will never happen" and then it did, after I shipped the code. Let's hope, for your code's sake, that your supervisor's business doesn't take …

Member Avatar for javaAddict
0
314
Member Avatar for cozmo87

[QUOTE]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. [/QUOTE] (API doc for StringTokeniser) You should do a lot better by …

Member Avatar for JamesCherrill
0
110
Member Avatar for Xufyan

[QUOTE=pro_learner;1602014](Cat kitty) is a constructor.....[/QUOTE] I believe you meant to say is a [I]parameter[/I].

Member Avatar for JamesCherrill
0
276
Member Avatar for kishanillur

What's stopping you from creating an activity class that extends android.app.Activity or one of its subclasses? [url]http://developer.android.com/reference/android/app/Activity.html[/url]

Member Avatar for JamesCherrill
0
245
Member Avatar for ARaza110

Hint: It's recursive. ps Treat RoseIndia (note correct spelling) with some caution, although there's a lot of useful code there, some of its stuff is out of date and some is just poor quality.

Member Avatar for ARaza110
0
207
Member Avatar for lili.edryana

Use java.util.GregorianCalendar instead of Date. This class does days, weeks, months etc properly, and is the reason why the old methods in the Date class were deprecated. ps: When you look at the javadoc for GregorianCalendar you'll find all the interesting methods are inherited from the abstract class Calendar, so …

Member Avatar for mKorbel
0
114
Member Avatar for Jessurider

The API doc for Printable includes this: [QUOTE]For correct printing behaviour, the following points should be observed: The printing system may request a page index more than once... ... the Printable should expect multiple calls for a page index and that page indexes may be skipped, when page ranges are …

Member Avatar for Jessurider
0
282
Member Avatar for icehiro

If your indentation is right the continue on line 59 is the last statement in the while loop 47-60. If that's the case then it has no effect. What did you expect it to do?

Member Avatar for sirlink99
0
167
Member Avatar for djbhoco

onButtonCalculate method has no code in it. actionPerformed method in btnResetListener has no code in it. You define action listeners, but you do not add them to the buttons. (and maybe more like these?) In brief, it doesn't work because you haven't finished coding it!

Member Avatar for mKorbel
0
240
Member Avatar for moni94

You will create 1000 objects, but the only references to them are in the 1000 local variables myObject. Those variables each go out of scope as soon as the method finishes, leaving the object having no references. That makes it eligible for garbage collection, and the garbage collector will destroy …

Member Avatar for JamesCherrill
0
201
Member Avatar for b1izzard

So, given a category you want to take each of the words in that category and see if they appear in a given text? If so, NormR1's idea is a good way to go.

Member Avatar for JamesCherrill
0
200
Member Avatar for intes77

I doubt that anyone will try to understand those hundreds of lines of incorrectly indented uncommented code, so you'll have to debug this yourself. Just use lots of print statements to confirm the values of all the variables in and around where things are going wrong. And don't forget to …

Member Avatar for intes77
0
806
Member Avatar for jtodd

Line 12. Array sizes and indexes must be int or convertable to int (byte, char). They can't be long. [QUOTE]The type of each dimension expression within a DimExpr must be a type that is convertible (§5.1.8) to an integral type, or a compile-time error occurs. Each expression undergoes unary numeric …

Member Avatar for jtodd
0
367
Member Avatar for teo236

It's no good trying to draw things to the Graphics like that - Swing is in charge of drawing and will ignore/over-paint your drawing. The correct way is to override the paintComponent(Graphics g) method to include your own drawing code. Swing will call this whenever it is necessary - eg …

Member Avatar for teo236
0
246
Member Avatar for newcoder310
Re: OOP

There's nothing wrong with that as an OO design. Well done. The main thing you could improve are the player1/player2/player3 variables. What happens if you want four players? It would be a lot better to have an array of Players (and an array of boolean results) - this will eliminate …

Member Avatar for JamesCherrill
0
109
Member Avatar for harinath_2007

What code are you using to load the images? What [I]exactly [/I]does your image file path look like?

Member Avatar for NormR1
0
123
Member Avatar for gbatemper

[QUOTE=jackmaverick1;1598472]The only thing I would suggest is to use a switch statement. They are much easier to use.[/QUOTE] Yes, dump the nested ifs and go with an enum for Weather values, and a switch. Much clearer and easier to understand and modify.

Member Avatar for JamesCherrill
0
175
Member Avatar for t@sos

I agree with the previous posters. Don't learn the API, learn to use the API JavaDoc and Google to find what you need when you need it. As you build up experience you'll get to know the most common APIs, and you'll be able to copy/paste from things you have …

Member Avatar for gyno
0
2K
Member Avatar for masterofpuppets

Why not use writeObject/readObject via an ObjectOutputSream/ObjectInputStream to send/receive your image in a single call?

Member Avatar for masterofpuppets
0
9K
Member Avatar for skiabox
Member Avatar for skiabox
0
290
Member Avatar for Majestics

Then why didn't you post that in the Oracle forum??? [url]http://www.daniweb.com/web-development/databases/oracle/129[/url]

Member Avatar for debasisdas
0
162
Member Avatar for wizzwig

[QUOTE=wizzwig;1593024]... and end up with an executable.[/QUOTE] [QUOTE=wizzwig;1593024]... With bytecode output that can be executed by the java command? yes thats right [/QUOTE] You realise that these two can't both be right?

Member Avatar for JamesCherrill
0
209
Member Avatar for sabrina_singh

Open a ServerSocket in one process and listen for connection, use a Socket in the other process to connect to it. Open matching input/output streams at both ends, send data across the streams. It's exactly the same as connecting client/server on two different computers. There are lots of examples on …

Member Avatar for JamesCherrill
0
42
Member Avatar for PHIPH

Notepad + command window until you master the basics. JCreator Lite for help without taking over control. Eclipse or NetBeans for professional developers.

Member Avatar for jwenting
0
182
Member Avatar for newbie14

If this is the app we have been discussing elsewhere then you have quite a high transaction volume - in which case maybe you should be using/reusing a PreparedStatement rather than creating and parsing a new Statement for each transaction. [url]http://download.oracle.com/javase/tutorial/jdbc/basics/prepared.html[/url]

Member Avatar for newbie14
0
285
Member Avatar for matthewkeating

public static void sortNumbers( int oddNumbers[], int evenNumbers[] ) sortNumbers( randomNumbers ); So here we have a method declaration that requires two int arrays as parameters And we have a method call that passes only one int array as parameter. That's not legal Java.

Member Avatar for matthewkeating
0
427
Member Avatar for Majestics

This sounds to me like you want to disable all the cells in cols B and C until the user selects a cell in col A. At that point you want to enable just those cells in col B that are valid for the chosen value in Col A (ditto …

Member Avatar for Majestics
0
234
Member Avatar for new_developer

There are ints and there are Integers (there is no Java data type called integer). One is a primitive value, the other is an Object. int variables cannot be null, but Integer variables can be. What you get when the user presses Enter depends on what method you are using. …

Member Avatar for JamesCherrill
0
48K
Member Avatar for AurosGamma

For OO design there were many attempts at a standard, but eventually they all converged into one called "Unified Modelling Language" or UML. That's the only game in town now. Despite its name it's all about diagrams, not text. [url]http://en.wikipedia.org/wiki/Unified_Modeling_Language[/url] Google for more info

Member Avatar for stultuske
0
140
Member Avatar for tipster3000

If you have question create new thread don't try to hijack one from 2007. Read the notice at the top of the Java forum main page "We'll help you get started and exchange algorithm ideas, but only if you show that you're willing to put in effort as well." So …

Member Avatar for JamesCherrill
0
702
Member Avatar for eagl09

You have all kinds of { and } that are wrong, and some that are missing. The best way to see them is to go through your code indenting it properly so you can match up { with }. Posting your code with valid code tags will also help (select …

Member Avatar for rubberman
0
334
Member Avatar for ceyesuma

Here is a good introduction to enums [url]http://download.oracle.com/javase/tutorial/java/javaOO/enum.html[/url]

Member Avatar for ceyesuma
0
124
Member Avatar for cemali_ys

You can use the new (since Java SE 5) Proxy class to define a proxy to use when making a connection to a URL. So you could try using each of your proxies to access (say) google.com [url]http://download.oracle.com/javase/6/docs/technotes/guides/net/proxies.html[/url] (topic 3 "proxy class) about 1/2 way down) Once you have a …

Member Avatar for JamesCherrill
0
152
Member Avatar for Chicken80

@IIM Please be aware that we do not do people's homework for them. By supplying the OP with a "corrected and optimised" solution you are simply inviting him to copy/paste the whole thing and learn nothing (except maybe that cheating is easier than learning). On the other hand, this is …

Member Avatar for jon.kiparsky
0
353
Member Avatar for lynnajoe

Let me check: you have multiple products each with multiple attributes. You want to display one line per product, with the attributes in aligned columns. Is that right? If so, use a JTable.

Member Avatar for JamesCherrill
0
159
Member Avatar for newbie14

If you have 1.6 then you should have everything you need, regardless of OS platform. Have a look at [url]http://www.javaworld.com/javaworld/jw-06-1999/jw-06-javamail.html[/url] then look at the javamail documentation on Oracle's Java web site.

Member Avatar for newbie14
0
557
Member Avatar for nered

Transparent windows are an AWTUtilities/Java7 thing. I don't believe this is possible without them. Why are you avoiding them?

Member Avatar for JamesCherrill
0
107
Member Avatar for bangor_boy

[QUOTE]and I think you can't make an object of type abstract [/QUOTE] Correct. You cannot create an instance of an abstract class. You could add: A class that extends an abstract class but does not provide an implementation for all the abstract methods must also be declared abstract.

Member Avatar for stevanity
0
249
Member Avatar for Vern247

[QUOTE]at CandleLineApplet.itemStateChanged(CandleLineApplet.java:67)[/QUOTE] Line 67 is part of [I]public double getOrderAmount()[/I] in your code, so the code you posted doesn't match the error message. This is not helpful! Null pointer means uninitialised variable OR a method returned null and you tried to use the returned value. Check the actual line in …

Member Avatar for Vern247
0
168
Member Avatar for winecoding

[QUOTE=winecoding;1587982]Can I assume that .equals() should be an robust approach to avoid these uncertainties? Thanks.[/QUOTE] Have a look at the documentation for Integer. It says [QUOTE]public boolean equals(Object obj) Compares this object to the specified object. The result is true if and only if the argument is not null and …

Member Avatar for JamesCherrill
0
177

The End.