7,116 Posted Topics

Member Avatar for lookuta2011

Just a guess - but do you have a loop with a sleep or wait in it to display the images? If so, read up on the Event Dispatch Thread (EDT) AKA the Swing Thread, and use a javax.swing.Timer instead. If not, ignore this post.

Member Avatar for JamesCherrill
0
103
Member Avatar for ggyyree

Java DB (a version of Apache) is bundled with the JDK from version 6 onwards and is guaranteed compatible, supported by Sun/Oracle, free, and runs on the same platforms as Java itself (apart from some Java ME versions). It's a safe choice and all you need for small-medium apps.

Member Avatar for Ezzaral
0
169
Member Avatar for stupid guy

[url]http://download.oracle.com/javase/tutorial/deployment/applet/security.html[/url]

Member Avatar for mKorbel
0
397
Member Avatar for tracydo

This is a lot easier if you indent the code so you can see which else goes with which if: [CODE]if (x>5) y=1; else if (x<5) { if (x<3) y=2; else y=3; } else y=4;[/CODE]

Member Avatar for JamesCherrill
0
122
Member Avatar for unkn0wnStu

Line 98 is a BIG mistake. If you have a problem reading the scores file you have chosen NOT to be told anything about it! In every catch block of a new program you should request a full print of all the info available on your error. [CODE]catch(Exception e) { …

Member Avatar for JamesCherrill
0
3K
Member Avatar for scarletfire

[QUOTE=scarletfire;1533816]I think 2118789 is the object. as I was suppose to store the player's info such as age,weight,height,games played and goals scored. and using the club class I was suppose to fetch a player's info using his name. the thing is, it only fetches the name and 2118789 instead of …

Member Avatar for scarletfire
0
160
Member Avatar for SMITA6076

I'm gonna vote on the side of never having public instance variables (except static final immutables), even if you do believe your class is safe against some bozo arbitrarily changing its values from some arbitrary concurrent thread.

Member Avatar for VernonDozier
0
332
Member Avatar for kris0r

Yes, I'd expect that a web crawler would benefit from a few concurrent threads. Have a look at Executor and ThreadPool (JDK 1.5 and later) - they do exactly what you describe. Start here: [url]http://download.oracle.com/javase/tutorial/essential/concurrency/executors.html[/url] also [url]http://developer.amd.com/Pages/1121200683_3.aspx[/url]

Member Avatar for kris0r
0
471
Member Avatar for MrVladar

[I@1ea5671 is the result of calling toString() on an array - its the method inherited from Object that just gives the object type and address The Arrays class has a toString method that you can use to get a quick text version of an int array. Details in the API.

Member Avatar for MrVladar
0
359
Member Avatar for kesh1000
Member Avatar for kesh1000
0
184
Member Avatar for djbuclkle

If you know how to work with a char array then a boolean array is just the same except that all the values are true or false. Where exactly are you stuck?

Member Avatar for JamesCherrill
0
173
Member Avatar for cwarn23

No, that's not what masijade was referring to. It's your empty catch blocks like [CODE]} catch (MalformedURLException e) { } catch (IOException e) { }[/CODE] If either of these exceptions is thrown you will never know. If you have a e.printStackTrace(); in the catch block you will know exactly what …

Member Avatar for cwarn23
0
211
Member Avatar for Dannyo329

After a InputMismatchException the Scanner still contains the offending text, so you can catch the exception, then in the catch block use Scan.next() to see exactly what it was that it objected to.

Member Avatar for Dannyo329
0
4K
Member Avatar for chiefpf

@Prem I know you are trying to help, but if you give the OP a complete solution then what have you done? You have helped them cheat, and taught them nothing. It's better to help by pointing him in a good direction, and suggesting relevant topics to read up.

Member Avatar for masijade
0
2K
Member Avatar for JJHT7439

The printStatement method signature looks wrong to me. I would expect it to have no parameters, and just print a statement for the current account ("this"), OR, to take a list of accounts as parameter, in which case it should be a static method (ie belong to the class, not …

Member Avatar for JJHT7439
0
3K
Member Avatar for pooran.c

Sun have saved you the bother - see java.util.GregorianCalendar in the Java API. If you have to do this yourself then a read through the preamble to the doc for java.util.GregorianCalendar will give you a good intro into what you need to achieve.

Member Avatar for mKorbel
0
111
Member Avatar for stephenk291
Member Avatar for JamesCherrill
0
239
Member Avatar for debeloglava

It's enough to have the server listen and the client make a connection to it. Both ends can then open input and output streams over the connection so messages will flow both ways. Both client and server need to have a Thread that loops blocked listening on its input stream …

Member Avatar for JamesCherrill
0
206
Member Avatar for arshi9464

An instance of the Class class represents a class in your program. Using that instance you can find and access all the attributes of that class (variables, methods, annotations etc etc). Its used as part of Java reflection (that's the keyword to Google), which is used to find out the …

Member Avatar for arshi9464
0
97
Member Avatar for stupid guy

The error message should give you the exact line number where it happened. Care to share it with us?

Member Avatar for JamesCherrill
0
166
Member Avatar for Thigina

Your overall approach, with the public getData is good. The problem lies in [CODE]FormA page = new FormA(); // displays a new copy of the form String user = page.getData(); // gets the data immediately - before the user can enter anything![/CODE] Somewhere you should have a button or some …

Member Avatar for Thigina
0
141
Member Avatar for neemo6

You need to declare your variable "buttons" as an array of Buttons, as in JButton[] myArrayOfJButtons; then, and only then, you can assign an new array of buttons to that variable myArrayOfJButtons = new JButton[2];

Member Avatar for JamesCherrill
0
108
Member Avatar for gedas

I've lost count of how many round-trip UML/code tools I've tried, but not one of them was any good for anything more than a simple class diagram. If anyone knows of an exception I would be genuinely grateful for details... Also, if you are unfamiliar with UML you'll have no …

Member Avatar for gedas
0
140
Member Avatar for stupid guy

1. To use Button's getLabel() method you must cast the Object returned by getSource() to a Button 2. You can't compare Strings with ==, use equals(String) instead, if you must. 3. If you want to know which button was pressed, test that directly [CODE]if( (ae.getSource() == ok) ...[/CODE] just remember …

Member Avatar for JamesCherrill
0
143
Member Avatar for Armanious

When / how often is this run? Possibly there is a thread-related problem with your (possibly long-ish running) thread and the user (and you own) updates to the JTextPane on the Swing thread (EDT). Both are updating the document, but there's no synchronisation between them. Maybe the fact that it …

Member Avatar for Armanious
0
395
Member Avatar for cwarn23

Use an AlphaComposite to set the drawing mode and alpha before drawing your image. Here's a simple sample... [CODE]Image myImage = ... float alpha = 0.5; @Override public void paintComponent(Graphics g) { Graphics2D g2D = (Graphics2D) g; AlphaComposite composite = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); g2D.setComposite(composite); // Set current alpha g2D.drawImage(myImage, 0, 0, …

Member Avatar for mKorbel
0
2K
Member Avatar for jason75080

@ztini is right. But if you can't do that for some reason then you can enhance your sort methods to sort both arrays at the same time, eg in sortGradesByNames you swap elements with [CODE]int temp = grades[largest]; grades[largest] = grades[i]; grades[i] = temp;[/CODE] so then, in the same place, …

Member Avatar for jason75080
0
5K
Member Avatar for MrHardRock

It keeps printing every number you enter because the print statement is inside the loop where you enter numbers! Try splitting this into three stages, it's easier to think about things one at a time: 1. Get the 10 numbers from the user, saving them in the array 2. calculate …

Member Avatar for Spamj
0
2K
Member Avatar for Newskin01

Have a look at the Arrays class - it has sort methods for arrays (and binary searches). You just need to implement a compareTo method for your Friends class (you'll find docs and examples in all the usual places).

Member Avatar for jon.kiparsky
0
2K
Member Avatar for zach&kody

.jar files are just .zip files with some conventions about what's in them. A full description is on the Oracle java web site. You can edit them with your favourite zip file utility.

Member Avatar for JamesCherrill
0
980
Member Avatar for newack

The official Sun/Oracle tutorials are excellent. Start here: [url]http://download.oracle.com/javase/tutorial/[/url]

Member Avatar for JamesCherrill
0
75
Member Avatar for Slyvr

A "loading", AKA "splash" screen is always a good idea. Java 6 includes a feature to show one even while your program is loading, so the user sees something as soon as he starts the program. Strongly recommended. [url]http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/splashscreen/[/url] On the other hand, if your program then goes wrong you …

Member Avatar for JamesCherrill
0
103
Member Avatar for yancouto

Second problem sounds like a firewall problem and/or a router problem blocking and/or not forwarding inbound traffic.

Member Avatar for yancouto
0
795
Member Avatar for SMITA6076

leftSide is the contentpane for the window (previous listing line 5) bothSides is also the contentpane for the window (previous listing line 14) so on line 17 you are trying to add the content pane to itself, == error. At a guess, leftSide should be a new container.

Member Avatar for JamesCherrill
0
395
Member Avatar for sirlink99

Once you have your .png read into a Java Image you can use the getScaledInstance method to re-size it to any size you want,any time you want.

Member Avatar for mKorbel
0
201
Member Avatar for HelloMe

[CODE]WT[i] = Integer.parseInt(txtField2[i].getText())-1; WT[i] += Integer.parseInt(txtField2[i].getText())-Integer.parseInt(txtField[i].getText()); ie WT[i] = 2* Integer.parseInt(txtField2[i].getText()) -Integer.parseInt(txtField[i].getText()) -1;[/CODE] That looks odd to me, but anyway, have you printed ALL the values returned by all these parseInts to see if that are what you expect? Also, there's nothing in that part of the code that should …

Member Avatar for HelloMe
0
105
Member Avatar for joseph.roy9
Member Avatar for jitsux
Member Avatar for abhishek20
0
168
Member Avatar for Cassandra Low

You need to makedirs on C:/d1/d2 to set up the directory structure, then write your C:/d1/d2/sample.txt file to the directory.

Member Avatar for mKorbel
0
153
Member Avatar for rampapz

[QUOTE]to keep DaniWeb a student-friendly place to learn, don't expect quick solutions to your homework. 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.[/QUOTE] Nobody here will do your homework for you, or help you get …

Member Avatar for javaAddict
0
227
Member Avatar for ajaybali

The folder/subfolder structure MUST match the package structure - so as long as you keep these two in step (ie create a sub-package and a sub-folder at the same time for the same classes) it's no problem. In Eclise you can right cluck a package to add a sub-package and …

Member Avatar for Ezzaral
0
88
Member Avatar for SMITA6076

In your method you have access to the size of the current CyberPet, and you also have access to the size of the other CyberPet that is passed as a parameter, so you can write a couple of if tests comparing those two things to decide what String to return. …

Member Avatar for SMITA6076
0
599
Member Avatar for sumprit

Hi sumprit. What exactly are you having difficulty with? You need a method that retrieves and displays the right set of results. You need an instance variable (ie not declared within any method) that keeps track of which results to display (clickCount?). You need action listeners for the buttons that …

Member Avatar for JamesCherrill
0
2K
Member Avatar for bharath54321

You can create an array of swing components exactly like an array of any other class, eg [CODE]JButton[] myArrayOfJButtons = new JButton[6]; // creates empty array for 6 JBUttons for (int i = 0; i < myArrayOfJButtons ; i++) { myArrayOfJButtons[i]= new JButton... // put a button into the array[/CODE]

Member Avatar for JamesCherrill
0
97
Member Avatar for Hey11

Line 11 I think you misunderstand the isLetter method. It returns true if a is a letter (as opposed to a number or a punctuation symbol) so you are replacing every letter with 'v'. You should be testing whether the char is equal to 'a'

Member Avatar for jwenting
0
97
Member Avatar for sumprit
Member Avatar for JamesCherrill

Hi y'all. I'm looking for feedback and discussion on the use of annotations to eliminate the boilerplate code for linking buttons and methods. Hopefully this will be especially useful in RAD or rapid prototyping environments. Over the weekend I hacked together a little proof of concept that supports two ways …

Member Avatar for JamesCherrill
0
206
Member Avatar for jansenkzh

If you check the posting dates you'll see that it was @casinoua who disinterred this corpse. @stultuske was just telling him off (quite rightly).

Member Avatar for masijade
0
131
Member Avatar for sumprit

5 on one side 2 on the other says "two JPanels" to me. Having said that, I have yet to find a layout (based on rectangles) that couldn't be done with GridBagLayout. You have total control over every position, size, gap, and inset, which with 7 components to place gives …

Member Avatar for sumprit
0
174
Member Avatar for casinoua

s[] obviously is of size 0, so index 0 is out of bounds. Did you pass in any parameters when you ran this?

Member Avatar for Ezzaral
0
91

The End.