7,116 Posted Topics

Member Avatar for deanus

[url]http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html[/url]

Member Avatar for deanus
0
107
Member Avatar for peter20

I can't see where Generics comes into this - you just need a Worker class and a Work interface that work units all implement. ps (Apart from when you create your queues etc, but that's just stuff like Queue<Work> = new Queue<Work>(); what I meant was that I can't see …

Member Avatar for peter20
0
181
Member Avatar for SasseMan
Member Avatar for sasidharnet

@csanuj: 1. This thread is from 2008 2. If that was supposed to be an answer to this long-dead thread, it is completely wrong anyway.

Member Avatar for stultuske
0
507
Member Avatar for Feriscool

It sounds like you are looking for [B]source code management software[/B] Have a look at [url]http://sourceforge.net/apps/trac/sourceforge/wiki/What%20is%20Source%20Code%20Management[/url] CVS, Subversion and Git are very widely used for Java projects, but there are many others and everyone has their own preferences.

Member Avatar for JamesCherrill
0
88
Member Avatar for moonL!ght

It looks like your paint method should loop thru all the shapes in shapeList drawing them, not just the latest one? ps don't override paint(Graphics g), override paintComponent(Graphics g) [url]http://java.sun.com/products/jfc/tsc/articles/painting/[/url]

Member Avatar for moonL!ght
0
397
Member Avatar for moonL!ght

In your valueChanged method ev.getSource() will just be the list box itself, which you probably knew anyway. You can use list.getSelectedValue() to find out which object in the list is currently selected inside your valueChanged method. ps @stultuske: in this particular case both getSource and getSelectedValue return the actual object …

Member Avatar for moonL!ght
0
111
Member Avatar for dennysimon
Member Avatar for NormR1
0
202
Member Avatar for mynamewontfitin
Member Avatar for varun45

This is a common symptom, and the usual cause is that Java is looking for the icon files in the wrong place. new ImageIcon(iconName) will not throw an exception if there is a problem, it just returns null. If you pass null to a JLabel or JButton for the image …

Member Avatar for varun45
0
985
Member Avatar for pushpap7

If your images don't appear this may be relevant... [url]http://www.daniweb.com/software-development/java/threads/403274/1724025#post1724025[/url]

Member Avatar for JamesCherrill
0
4K
Member Avatar for Morley93
Member Avatar for Morley93
0
554
Member Avatar for madhub2v

Using someone else's code for your homework is called "cheating". Nobody here is going to help you cheat. Write your own code and you [B][I]will [/I][/B]get help.

Member Avatar for Ezzaral
0
2K
Member Avatar for creative_m

Maybe those method [B]definitions [/B]belong in the class they apply to, ie in Student there is a [I]delete(Student s)[/I] method, in Course there's [I]delete(Course c[/I]) etc etc. (These should probably be just named [I] delete()[/I] defined as instance methods.) In a typical controller class you will [I]call [/I]those methods, but …

Member Avatar for creative_m
0
119
Member Avatar for Mudzy

When you have a serializable class you're supposed to define a serialVersionUID that ideentifies the version of the serialized form - if you change how it's serialized you're supposed to change the serialVersionUID. It's a complete waste of time and a real annoyance. Either ignore it, or create a private …

Member Avatar for JamesCherrill
0
187
Member Avatar for Hussam Alahmadi

What are you doing? This is a duplicate of your post 2 days ago, with exactly the same code mistakes, and completely ignoring the input you got from your previous post.

Member Avatar for stultuske
-1
169
Member Avatar for R32@

(u == user) As gets posted here about once a week on average... don't try to compare Strings with ==, use .equals instead. Google for details.

Member Avatar for R32@
0
112
Member Avatar for programing

[QUOTE=predator5047;1722115]I do not understand what you wanted to do with this: [CODE]for ( int i=0;i<=size;i++){ if(array[i]==array[i].length-1) ... }[/CODE] You are just comparing the number stored in array[i] with the length of the array minus one.[/QUOTE] Not even that really. It's just some invalid uncompilable code that doesn't actually do anything. …

Member Avatar for .:n'tQ-boy:.
0
202
Member Avatar for vijaykavin10

total and total1 are local variables in methods sample and sample1 respectively. They do not exist outside those methods, and cannot be accessed from outside those methods.

Member Avatar for vijaykavin10
0
295
Member Avatar for lethal.b

Remember Java chars are numeric - ordinary characters correspond to integer values under 128. If you have an array of 127 ints you can use a char as the index to access an element of the array and increment it...

Member Avatar for lethal.b
0
191
Member Avatar for Hussam Alahmadi

[CODE]if(num<=min){ num=min; count=0; }[/CODE] You start with min=0, so how often will num be less that that? [CODE]for(;;){ if(num==0) break; ... [/CODE] I see what you intended here, but the more usual way to code that is [CODE]while(num != 0) { ...[/CODE] And finally, indenting your code will make it …

Member Avatar for nHulk
0
208
Member Avatar for hszforu

You are confusing Objects with variables. A variable is reference (pointer) to an Object. You can't assign null to an Object - that doesn't even make sense. You [I]can [/I]assign null to a variable - it means that the variable stops referring to an Object and now refers to nothing. …

Member Avatar for hszforu
0
126
Member Avatar for jackmaverick1

[CODE]while (true) {// Game Loop c.repaint(); }[/CODE] This is really not a good idea. You tie up a thread running as fast as it possibly can, triggering repaints at an arbitrary but very high rate. It's going to burn all the CPU it can, and will run at completely different …

Member Avatar for JamesCherrill
0
125
Member Avatar for 03hasnam

[CODE]Login required = new Login(); int pass = Login.accessGrant;[/CODE] Here you create a Login() then immediately query the value of its accessGrant variable. That query happens before Swing gets to display the dialog, and certainly long before the user could enter anything.

Member Avatar for NormR1
0
147
Member Avatar for 03hasnam

... but even better: create class as above. Add a variable for amount, that can be set by a parameter in the constructor. When adding instances of this class to each button pass the appropriate value into the constructor. Now there's no need for getSource or a switch or any …

Member Avatar for 03hasnam
0
3K
Member Avatar for 65piano

You could use an inner class for the listener that has the x,y coordinates as instance variables, that can be set by parameters in the constructor. When adding instances of this class to each button pass the appropriate values into the constructor. Now there's no need for getSource or any …

Member Avatar for JamesCherrill
0
201
Member Avatar for joankim

Glad that' solved, so here are a few comments for next time... That's Java code and Java syntax problems, so this is the right forum to post in. [ICODE]while(grade.equals("A" + "B" + "C" + "D" + "F"))[/ICODE] I think I can guess what that was intended to do, but it …

Member Avatar for zeroliken
0
144
Member Avatar for Dregron

1. For GUI -related timing you should use a java.swing.Timer rather than a java.util.Timer because it integrates with the whole swing event queue/ thread environment. [url]http://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html[/url] 2. If you are updating some thing that affects the GUI you need to call repaint() or one of those methods to let the …

Member Avatar for Dregron
0
228
Member Avatar for 03hasnam

[CODE]ImageIcon tenP = new ImageIcon("10p.jpeg"); tenP = new JButton("", tenP); (etc)[/CODE] You declare tenP to be an ImageIcon, OK, but then you try to assign a JLabel to that variable, not OK. You need to create a different variable for the JLabel itself.

Member Avatar for JamesCherrill
0
1K
Member Avatar for jerrohnny

Just start with the server. Write your code in small steps and test/debug each step by hard-coding some data and print statements. Maybe the first few steps could be: Write the Book class. Test it by creating and printing a couple of instances. Start the Server class - read the …

Member Avatar for JamesCherrill
0
117
Member Avatar for Artmann

DaniWeb Member Rules include: "Do not hijack old threads by posting a new question as a reply to an old one" [url]http://www.daniweb.com/forums/faq.php?faq=daniweb_policies[/url]

Member Avatar for Ezzaral
0
155
Member Avatar for thejoker011

IMHO Java itself is more solid than the OS it runs on, [I]but [/I]Java's support for serial comms is very old, and was never very solid in the first place. I did a project years ago to interface with a serial hardware control device (multiple digital I/O lines) and found …

Member Avatar for thejoker011
0
406
Member Avatar for gourav1

There are many formats for sounds to play, and many possible sources to play them from. There are classes to play various formats from various sources, all different classes. But they all implement the same interface, so they all support the same calls to their play methods. This means that …

Member Avatar for thines01
0
268
Member Avatar for crazymidget01

[CODE]p2.setLayout(null); p2.add(label, BorderLayout.CENTER);[/CODE] Why set a null layout then try to use a BorderLayout option? If you want a null layout manager then hypou have to supply complete bounds for p2. [CODE]ImageIcon img = new ImageIcon(x);[/CODE] There's a gotcha with new ImageIcon - if it fails for any reason whatsoever …

Member Avatar for mKorbel
0
1K
Member Avatar for bibiki

You can populate a JComboBox with any kind of Objects, and it will use the objects' toString() method to display the object, but when you query the selected item you will get the original object. If you don't want to have your toString() method just returning the name, then use …

Member Avatar for JamesCherrill
0
115
Member Avatar for moonL!ght

[CODE]Scanner scan= new Scanner(inputFile); String N= scan.println(N):[/CODE] I don't know how you can read anything with this code - it won't compile - there is no println method in Scanner (not to mention the missing catch)

Member Avatar for JamesCherrill
0
129
Member Avatar for 03hasnam

[QUOTE=hfx642;1718333]Sounds like you want to do ObjectInputStream and ObjectOutputStream to read and write binary files.[/QUOTE] I think this is a slip of the keyboard - should be DataInputStream and DataOutputStream ;)

Member Avatar for JamesCherrill
0
463
Member Avatar for 03hasnam

Duplicate thread [url]http://www.daniweb.com/software-development/java/threads/401345[/url] 03hasnam: Simply re-posting it is an insult to hfx642, NormR1, and stultuske who have already taken time to answer this the first time you posted it. DaniWeb Member Rules include: "Do not post the same question multiple times"

Member Avatar for 03hasnam
0
176
Member Avatar for DoubleGee

Lines 17,18 are executed regardless of whether you have found the account to delete or not - they are outside the if test.

Member Avatar for JamesCherrill
0
199
Member Avatar for Steven7
Member Avatar for ali11

Like it said: [I]Recompile with -Xlint:deprecation for details.[/I] then post the resulting details back here if you don't understand them.

Member Avatar for JamesCherrill
0
153
Member Avatar for irock_4you

There are lots of people here who will freely give their time to help you become the best Java programmer you can be. There's nobody here who is interested in doing your homework for you. DaniWeb Member Rules include: "Do provide evidence of having done some work yourself if posting …

Member Avatar for v3ga
0
121
Member Avatar for Albion1

Draw 14 rectangles in the right positions! Post the code you have written so far.

Member Avatar for Albion1
0
114
Member Avatar for gourav1

If line 14 throws an exception then you will get to line42 with f1 not initialised. Similarly for f2 ps NEVER do this: [CODE]catch(Exception e) { }[/CODE] when you get any error of any kind in the try block you will see no error message of any kind, and will …

Member Avatar for gourav1
0
153
Member Avatar for gourav1

1. Surprisingly, it seems that output to System.out doesn't get sent to the console until the line is terminated - I reproduced this behaviour in Eclipse as well, but I'm sure that's not always so. 2. Please see my latest post re wait/notify. If you have a quick look at …

Member Avatar for JamesCherrill
0
99
Member Avatar for gourav1

Change the code in your previous post/question to make B b static. Now you have 2 threads each calling the sum method on the same object (static b). If sum is synchronised then the second thread will be held up and won't be able to start executing sum until the …

Member Avatar for NormR1
0
161
Member Avatar for hszforu

I certainly have done my share of multithreading and scraping in my time, but not a lot with proxies. But I'm with Peter here: "bots for multiple account creations" sounds very suspicious indeed, and I won't have anything to do with it unless I see a genuine justification.

Member Avatar for hszforu
0
164
Member Avatar for DavidKroukamp

Three personal opinions: 1. An IDE is a very useful tool for someone who knows what they are doing, but for a beginner (like most posters here) it leaves most of Swing, eg layout managers, listener classes etc as a mysterious black box. Most experienced users here recommend that beginners …

Member Avatar for stultuske
0
118
Member Avatar for Joey_Brown

Here's an overview of a typical way to do this: Create the spheres as instances of a Sphere class- each Sphere with its own size, position, velocity. Maintain a list of all the spheres you have created. In your main method start a javax.swing.Timer to call an update method on …

Member Avatar for JamesCherrill
0
111
Member Avatar for rotten69

Unless the applications are math-based you need very little math to work in Java. Basically just arithmetic and logic. Very little algebra, no geometry, no calculus.

Member Avatar for bibiki
0
215

The End.