7,116 Posted Topics

Member Avatar for pekemp23

First point: never say "gives me an exception". Alwyas say exactly what the exception is and which line its on. Second: on line 43 you check if ts is null, but that's too late. If it's null then you wil get a null pointer exception on line 40

Member Avatar for stultuske
0
421
Member Avatar for Tomi1988
Member Avatar for JamesCherrill
0
172
Member Avatar for phoenix_2000
Member Avatar for dlmagers

Run what program? Where's your main method? To use those methods you need to call them and print the result, eg System.out.println(StringUtils.padRight("Hello", 12));

Member Avatar for JamesCherrill
0
196
Member Avatar for Doogledude123

That's all wrong! `import` just affects the way that names are resolved at compile time. It has absolutely zero effect on what classes get jarred, or on the run time. importing everything is a lot easier than importing just the classes you need, especially if you are not using an …

Member Avatar for jwenting
0
258
Member Avatar for sciprog22

Doogledude has got it - ball A collides with ball B, and ball B colides with ball A.

Member Avatar for sciprog22
0
192
Member Avatar for ZaneDarklace

Literal \ characters in Java Strings need to be "escaped" - ie replaced with a double \ You did that in the findInLine, but not in your useDelimiter

Member Avatar for ZaneDarklace
0
1K
Member Avatar for munchlaxxx

It's your put method. You check to see if that key is already there, and return true, but if it's not there you increment the size but you forgot to add the new key/value Pair to the map.

Member Avatar for JamesCherrill
0
326
Member Avatar for murali2489

It's pixels If you are using a layout manager like you should, then setSize is pretty much useless. With a null layout manager it sets the component size in pixels, and you look really silly when someone runs it on a retina display.

Member Avatar for murali2489
0
5K
Member Avatar for cleve23

Tables are split into two main parts - the visible GUI stuff, and the data for the table. This allows you to chose how to store the data any way you like, without affecting the way the GUI display works (and vice-versa). The part that holds the data is called …

Member Avatar for cleve23
0
244
Member Avatar for obspsalm22

Your question is very vague and general - it sounds like you have missed some essential part of your course regarding GUI basics. There are many excellent Swing GUI tutorials on the web, just Google for them. Or start with this tutorial... http://docs.oracle.com/javase/tutorial/uiswing/components/table.html

Member Avatar for cgeier
0
356
Member Avatar for Violet_82

Start by loooking at which controls line up with which others - aligned controls are usually best on the same panel, unaligned ones may be easier in separate panels.Eg in the center there are CBs and JBs in a clear grid, but the "Print quality" line below doesn't line up …

Member Avatar for Violet_82
0
722
Member Avatar for Doogledude123

> For something as basic as this, where it will only be called once every run, you don't need to have methods for it. Only if it could be called multiple times. I disagree absolutely. Splitting long methods into sub-methods can be a massive boost to readability and clarity. By …

Member Avatar for Doogledude123
0
1K
Member Avatar for CoilFyzx

If you are using Serialization (ie write/readObject) then bean standards are irrelevant, but you must declare every class involved as "implements Serializable" as a way of asserting that your classes don't contain anything the can't be serialized - eg references to live operating system handles. If you are using javabeans …

Member Avatar for CoilFyzx
0
389
Member Avatar for dlmagers

You can do calculations when initialising variables, but only using values that are known at the time, eg int a = 3; int b = a+1;

Member Avatar for JamesCherrill
0
194
Member Avatar for renagadejesus

This is confusing. That code is perfectly valid Java; everything that needs to be declared is declared. Do you mean declaration like ricewtnd said, eg something like // I declare that this is all my own work and I didn't cheat...

Member Avatar for JamesCherrill
0
315
Member Avatar for murali2489

The package A has to be in a place that's in your classpath. If you have C:\Z\A\B\A\Print.class then A.Print is in C:\Z\A\B, so that's what has to be in the classpath. Ps: Having two directories called A, one inside the other is perfectly legal, but pretty much guaranteed to cause …

Member Avatar for murali2489
0
666
Member Avatar for bigredaltoid

When parsing the infix you can parse for parens, operators and numbers like you do now, but also parse for alphabetic tokens ie variable names (looks like you can assume single letter names?). Treat them just like numbers when converting to postfix. In the evaluator, when you get an variable …

Member Avatar for iamthwee
0
931
Member Avatar for murali2489
Member Avatar for narlapavan

vecA is a Vector of A objects, so there's no way it can contain a String. contains(...) just searches the Vector's elements for an equals() match, it does not search inside any "inner" Vectors that are in the "outer" Vector. For that you would need to do some kind of …

Member Avatar for milil
0
217
Member Avatar for stresstedout

This is just http://www.daniweb.com/software-development/java/threads/472200/java-retrieve-images again. I think we're wasting our time.

Member Avatar for JamesCherrill
0
216
Member Avatar for 2384443

The3 Java Language Spec documents all this stuff definitively. For throw it says > 14.18 The throw Statement > ... > A throw statement causes an exception (§11) to be thrown > ... > *ThrowStatement: throw Expression ;* > The Expression in a throw statement must denote either 1) a …

Member Avatar for milil
0
245
Member Avatar for Royal_1

No problem, they are initialised in both constructors. (edit) ... but anyway the language guarantees that instance variables are initialised (to 0, 0.0, false, or null as appropriate) anyway. See Java Language Spec: > 4.12.5 Initial Values of Variables > ... > • Each class variable, instance variable, or array …

Member Avatar for Slavi
0
742
Member Avatar for isaacss

Try compiling using javac at the command prompt - that will give you proper error messages

Member Avatar for Taywin
0
86
Member Avatar for HI.LAZYGUY

It's admirable that you have taken the time to create this tutorial to try to help others. But it's really not something I could recommend for a number of reasons... Most seriously, the method used is completely wrong for reading text files. Converting byte to int to char by casting …

Member Avatar for JamesCherrill
0
194
Member Avatar for Doogledude123

> But how does Java interpret the equation? Does it do proper BEDMAS Yes Java Language Spec: > 15.7.3 Evaluation Respects Parentheses and Precedence > The Java programming language respects the order of evaluation indicated > explicitly by parentheses and implicitly by operator precedence.

Member Avatar for JamesCherrill
0
269
Member Avatar for stresstedout

The code that puts the image into a label (lines 20-24) can go inside the while loop so you create one label for each image in the result set. If you set a GridLayout layoput manager for your window then the labels that you add will be placed ina grid …

Member Avatar for stultuske
0
363
Member Avatar for Doogledude123

> Each item needs to either be selectable, or non selectable That's the next thing in your requirements, so do that next. What kind of variable would you use for selectable / not selectable? How many of those do you need? What would be a good way to store them …

Member Avatar for Doogledude123
0
1K
Member Avatar for ZaneDarklace

On line 15 you test for a sign of "+" and if you find it, you add the next number using += on line 17. Testing for "-" and subtracting is exactly the same, except that it has "-" instead of "+" and -= instead of +=

Member Avatar for milil
0
327
Member Avatar for root404

> I research, learn, try, and ask for help. That's what helped me increase my ability to code in Java. Yes, absolutely right. But how does this fit with your posting a complete undocumented uncommented solution that the OP can just copy/paste without any understanding? I hope in your future …

Member Avatar for JamesCherrill
-1
1K
Member Avatar for jalpesh_007

Chetan: Welcome to DaniWeb Our Site Rules (which you agreed to when you signed up) include: "Do not hijack old threads by posting a new question as a reply to an old one" http://www.daniweb.com/community/rules Please start your own new thread for your question

Member Avatar for JamesCherrill
0
3K
Member Avatar for Stefce

(Ignore previous version of this post - it doesn't work) Sites may or may not respond to pings, so the only reliable way is to check a public service that definitely works. Eg try to make an connection to google.com on port 80 (google's search web site). eg InetAddress a …

Member Avatar for JamesCherrill
0
292
Member Avatar for patelsagar.nandlal

Is this sample code for our enlightenment, or is there a question you wanted to ask about it?

Member Avatar for JamesCherrill
0
677
Member Avatar for krnaveen14

That Student class is a very standard kind of code, you'll find millions like it in real life. Tools like NetBeans give you ways to write it faster, but the final code is the same. The only tiny question is whether you need all the set nethods - eg do …

Member Avatar for nebspace0x297
0
244
Member Avatar for Robert_12

> The serializable class LogoPanel does not declare a static final serialVersionUID field of type long (etc) This is basically a stupid warning message that you can completely ignore. If it bothers you, just add this line inside each class it complains about: `static final long serialVersionUID =0;` > Cannot …

Member Avatar for cgeier
0
990
Member Avatar for CoilFyzx

The "How to use JTables" Oracle tutorial shows how yto set a different renderer for any cell of the table (briefly: subclass JTable and override public `getCellRenderer(int row, int column)`. http://docs.oracle.com/javase/tutorial/uiswing/components/table.html#renderer Now each cell has its own renderer and each renderer can have its own underlying data. Updating the data …

Member Avatar for mKorbel
0
1K
Member Avatar for dwild

I don't know why this is in the Java section, but... TextPad 5 is commercial software so either: a) You have purchased a licence, in which case you should upgrade to the current version (7.1), then, if the problem is still there, get on to their tech support to fix …

Member Avatar for dwild
0
179
Member Avatar for khadija.cheeko

I'm no expert on this, but because nobody else seems to be around right now, I'll have a try... It coulld be that a) the 8 bit AL32UTF8 data isn't being converted to Unicode properly or b) the internal representation of the data is OK, but the character set you …

Member Avatar for JamesCherrill
0
1K
Member Avatar for Doogledude123

You have a break; as the last statement in your loop, so it will always exit the loop at the end of its first pass. Maybe you intended that to be inside the else block? Also: the if test on line 28 is redundant.

Member Avatar for Doogledude123
0
410
Member Avatar for krnaveen14

What do you mean by "compare"? Are you looking for duplicates, trying to sort the rows, or what?

Member Avatar for JamesCherrill
0
291
Member Avatar for অসীম

IMHO those GUI libraries are way too advanced for this requirement. There's nothing there that requires anything more that just an ordinary Swing GUI. The Oracle tutorials are unbeatable for accuracy, currency, and completness, but you may want to Google for some simpler tutorials if the Oracke ones are too …

Member Avatar for JamesCherrill
0
1K
Member Avatar for CoilFyzx

Use java.beans.XMLEncoder and pass it the ArrayList. It will encode the entire ArrayList and it's constituent classes and their ArrayLists of other classes and primitives all the way down. Your custom classes just need to comply with JavaBeans standards (get/set/add methods, a no-args constructor). It encodes to a Stream so …

Member Avatar for JamesCherrill
0
568
Member Avatar for sana.f.qureshi_1

Could it be that the action command is "Save" (defaults to the same as the button text), but you are testing for equals("save") ?

Member Avatar for JamesCherrill
0
221
Member Avatar for Start4me

You're missing a set of brackets round the whole condiiton, but otherwize that's good. ps It's usually quicker to try something simple like that yourself than to wait for someone to reply to you.

Member Avatar for JamesCherrill
0
315
Member Avatar for pspwxp fan

> There are 5040 combinations, and perhaps 20 words in the row of the dictionary. Should it really be takin 10 minutes? Or you think there is maybe another problem in the design/implementation? Running 5K iterations against 20 data items should so so fast you can't measure it. I have …

Member Avatar for iamthwee
0
595
Member Avatar for CoilFyzx

Your analysis of the problem seems reasonable. Why not just check the selection in JList ListSelectionListener and ignore the event if the selection is null?

Member Avatar for CoilFyzx
0
759
Member Avatar for murali2489

TreeMaps are always sorted by their keys. subMap returns a view of a contiguous range of keys of the TreeMap, including only those keys within the specified range. Because it's a view, updates to it just update the origional (backing) TreeMap. Similarly updates to the origional TreeMap arre immediate visible …

Member Avatar for murali2489
0
238
Member Avatar for sk8ergirl

My extra-sensory-perception allows me to study your code, even if you haven't posted it, but unfortunately it doesn't work if there is an "a" in the month, so you're just going to have to post the relevant code in the old-fashioned way. :)

Member Avatar for JamesCherrill
0
131
Member Avatar for sonam281

toolkit.getImage does not throw any exception if it fails (other than for a security manager problem), so maybe the Image is not valid - createCustomCursor doc says : "If the image to display is invalid, the cursor will be hidden (made completely transparent)". This also doesn't throw an exception, and …

Member Avatar for JamesCherrill
0
282
Member Avatar for murali2489

ArrayList implements List, so every ArrayList is also a List. Can you post the exact syntax you used for the error version?

Member Avatar for murali2489
0
238

The End.