7,116 Posted Topics

Member Avatar for TinyBelly

Just reading the not-commented stuff I see around line 165 you create a JPanel, create a JScrollPane using that panel, add the JScrollPane to you (main?) frame. Problem is, I don't see you adding anything to the panel inside the scrollpane. If you want a window with everything in it …

Member Avatar for mKorbel
0
208
Member Avatar for ashishnandwani

Google "Event Dispatch Thread" (EDT or "Swing" thread). All GUI updates are single threaded on the EDT, as are all GUI-initiated user interactions. So your jButton2ActionPerformed executes on the EDT. While it's executing all other GUI-related activities are queued (including your progress bar re-paints). There are a number of ways …

Member Avatar for ashishnandwani
0
199
Member Avatar for MeandJava

Timer is an option. Timers can be one-shot OR repeating. You need a timer with a 60 second initial delay and no repeats.

Member Avatar for MeandJava
0
163
Member Avatar for Sadun89

ME is the Micro Edition - specialised version for smartphones etc SE is the Standard Edition. It's all you need for ordinary desktop apps and applets and is (roughly) a superset of ME. EE is the Enterprise Edition - for large-scale corporate client/server/database apps - it's a superset of SE …

Member Avatar for Sadun89
0
133
Member Avatar for coding101

If you look at the "All Known Implementing Classes:" for Interface Collection<E> you'll find a number of priority queue implementations. Which one you chose depends on your exact requirements. If you have to build it yourself, have a look at TreeSet using a Comparator that sorts the items in priority …

Member Avatar for Lamthuy
0
142
Member Avatar for Lamthuy

If memory usage is a big issue in your app you should use an array of double primitives, not a Vector of Double Objects. doubles in an array occupy 64 bits each.

Member Avatar for Lamthuy
0
162
Member Avatar for TheQuad

[QUOTE]Am thinking I need some booleans in there or my comparing of array technique is a massive fail.[/QUOTE] Definitely not a massive fail - just call it a Beta version! I think you're right about needing some booleans. Once you have "used" a number in Random for a match you …

Member Avatar for peter_budo
0
1K
Member Avatar for guru_iyer

Probably because you override paint rather than paintComponent. paint also handles painting of children (eg lables ina child panel!), borders etc, and should not normally be overridden. paintComponent just handles the painting of the content area, and is the one you normally override.

Member Avatar for guru_iyer
0
1K
Member Avatar for harinath_2007

Did you try [CODE]DefaultCaret caret = (DefaultCaret)textArea.getCaret(); caret.setUpdatePolicy(DefaultCaret.ALWAYS_UPDATE);[/CODE] ?

Member Avatar for JamesCherrill
0
105
Member Avatar for guru_iyer

javax.swing.Timer is what you need - documentation & samples in the usual places. Define a timer task (a "run()" method) that you want to run repeatedly. On click of the start button start a Timer that will run that task every 3000 msec. On click of the stop button stop …

Member Avatar for guru_iyer
0
1K
Member Avatar for shyla

I'm confused. Do you need help getting the counts, or displaying them in a label, or adding a label to the bottom of your window, or creating a superclass???

Member Avatar for JamesCherrill
0
274
Member Avatar for tracydo
Member Avatar for MSoft

Start by studying this section of the Java tutorials and the following few pages: [url]http://download.oracle.com/javase/tutorial/uiswing/painting/index.html[/url]

Member Avatar for cretaros
0
98
Member Avatar for rithish

Have a look at the getText() and setText(String text) methods that JTextField inherits from JTextComponent. ps Watch out for your capitalisation - java is case-sensitive

Member Avatar for JamesCherrill
0
161
Member Avatar for lynnajoe

As a general rule you don't want to put code of that kind of complexity and context directly into an ActionListener. Best practice is to put it into a method in the appropriate class, then just call that method from a one-line ActionListener

Member Avatar for JamesCherrill
0
97
Member Avatar for akki_k
Re: I/O

The file name that you type in the command line argument is available to you as a parameter in your main(....) method. Now you have the file name in a String, so you can use what you learned from mKorbel's links to create the file.

Member Avatar for JamesCherrill
0
114
Member Avatar for gedas

Black box testing tests the system as a whole, based on its external specification, without any particular reference to how it is built internally - it treats the system as a "black box" with unknown contents White-box testing (better known as clear box or glass box testing) is based on …

Member Avatar for gedas
0
96
Member Avatar for zslgreen

[QUOTE]We'll help you get started ... but only if you show that you're willing to put in effort as well.[/QUOTE] How far have you got researching this yourself? What sources of info have you used?

Member Avatar for majestic0110
0
93
Member Avatar for Tellalca

Add some instance variables to your class (eg a list of shapes, colours, positions ...). Add some public methods to set those variables. Use the variables in paintComponent method to control what/where/how you paint

Member Avatar for mKorbel
0
178
Member Avatar for pooran.c

From the info you have given the method could be defined in either place. If you define it in a different class then how you call it depends on whether it's static or not: If static, call it using the class name, no instance required If not static, you need …

Member Avatar for JamesCherrill
0
158
Member Avatar for tracydo

1st error: you declare inFile in main, then you try to use it in a different method. variables declared in a method only exist within that method. If you want to share variables between methods you must declare them in the class, but outside any one method. Fix this, and …

Member Avatar for tracydo
0
863
Member Avatar for ChrisHunter

How is that delimited? Is there anything between the sH or the r2? Suppose the name is HamishMacDonald64 or Jean-ClaudeVanDamme75 ?

Member Avatar for peter_budo
0
219
Member Avatar for eikal

Class structure looks dumb to me. 2Dice is not a "kind of " Die. It would make more sense to have a (non-subclassed) class called "HandfullOfDice" that took an int numberOfDie as a param on the constructor, had a list of Die objects as an instance variable, and had public …

Member Avatar for JamesCherrill
0
156
Member Avatar for CorruptionInc

if (a) ... else if (b) ... else if (a && b) ... never executed because the else if won't be executed if (a==true) (see line 1) and (a && b) fails if (a==false)

Member Avatar for CorruptionInc
0
5K
Member Avatar for I<LateNupurGuha
Member Avatar for pooran.c

[QUOTE]everytime the controls enter into for loop the output is printed on the next line.[/QUOTE] You print using println(...), which always adds a newLine char at the end of whatever you print. If you use print(...) instead then the next printout will continue on the same line.

Member Avatar for JamesCherrill
0
1K
Member Avatar for burntout

Do you mean redirect System.out.print... to a file? If so: [CODE]PrintStream printStream = new PrintStream(new FileOutputStream(fileName, true, true); // true for append and autoflush) System.setOut(printStream); System.setErr(printStream);[/CODE]

Member Avatar for JamesCherrill
0
100
Member Avatar for ayanbizz

10001010 1100111 isn't 8 bytes, no matter how you count them. I don't have time now to study your code with all those String manipulations, but the normal way to do bit-wize manipulations of the contents of an int is via boolean operations, eg [CODE]// get the first (high-order) byte …

Member Avatar for JamesCherrill
0
186
Member Avatar for sirlink99

You have been on DaniWeb long enough to know that "It doesn't seem to work" isn't good enough. If you want someone to help, please give a proper description of your problem and the things you have already done to try to solve it.

Member Avatar for mKorbel
0
146
Member Avatar for tracydo

No. x=x*j; will be executed 2 times 1st pass x = 1 * 0 2nd pass x = 0 * 1 Answer is still 0 You don't need {} for the contents of a for loop if there is only 1 statement. If you have any doubt try executing this: …

Member Avatar for jokers6
0
122
Member Avatar for hany-h

There seems to be no attempt to add any JLabel to anything - which is probably why it doesn't work. Don't confuse things by trying to add the JLabel to your special panel, just add it to the JFrame directly below the panel. However, cale is right in saying that …

Member Avatar for JamesCherrill
0
153
Member Avatar for tracydo

25 posts and you still don't know about posting your code properly indented and in code tags. Your compiler error messages have the line numbers, but do you expect people to count the lines in your code to see which they are? We're willing to help, but we are not …

Member Avatar for tracydo
0
3K
Member Avatar for thes0mething

1. You are expected to use the Graphics object passed to you as a parameter 2. aBoolean == true is just like anInt + 0, ie horribly redundant 3. Override paintComponent, not paint 4. panel.paint(gr); never call paint directly. call repaint() and let Swing do the rest [CODE]public void paintComponent(Graphics …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Omargeek

1. Program listing and Exception messages do not match (line 48 is not in Vec.add) 2. Please stop creating new threads for the same problem

Member Avatar for hanvyj
0
367
Member Avatar for sharathg.satya

It looks like you have installed the Java Runtime Environment (JRE) which allows you the run Java programs, but not the Java Development Kit (JDK) that allows you to create them. If you haven't already done so, download and install the latest JDK. ps java.exe runs java programs in a …

Member Avatar for jwenting
0
126
Member Avatar for recees_mum

Your code would be easier to read if you removed all the redundant comments. You can assume that anyone reading your code understands Java, so there's no point having a comment that just explains what the previous statement means - eg [CODE]System.out.println("Welcome to the Payroll Program"); //output Welcome to the …

Member Avatar for JamesCherrill
0
135
Member Avatar for AhmedGhazey
Member Avatar for JamesCherrill
0
61
Member Avatar for ksj

Have a look at [url]http://download.oracle.com/javase/tutorial/uiswing/components/table.html#renderer[/url] in particular the section "Using Other Editors" that starts quite near the bottom...

Member Avatar for mKorbel
0
1K
Member Avatar for jonpadre

Looking at the output one line at a time, starting from the top (ie as you would print it) the pattern we see is some node's left sub-tree (if any) the node itself the nodes right sub-tree (if any) then the sub-trees are the same (recursively), and each time you …

Member Avatar for jonpadre
0
200
Member Avatar for sj5536

This sounds like drop-down combo box, but I suspect it's not going to work too well with a JComboBox when you need to change the list contents with every character typed (problems getting responses, re-paint flickering, changes of focus...). So I would have a JTextField with a JList positioned underneath …

Member Avatar for mKorbel
0
91
Member Avatar for Desi Boy

[url]http://download.oracle.com/javase/tutorial/java/javaOO/methods.html[/url] [url]http://download.oracle.com/javase/tutorial/java/javaOO/arguments.html[/url] wonderful thing, Google.

Member Avatar for JamesCherrill
0
71
Member Avatar for sj5536

Of all the layout managers GridBagLayout is by far the most capable. There's a bit of a learning curve because there are so many options, but IMHO it's worth it. You can play with the easier ones for little homework apps, but if you are going to use Java seriously …

Member Avatar for sj5536
0
108
Member Avatar for vishalbhavsar

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

Member Avatar for JamesCherrill
0
118
Member Avatar for TinyBelly

[QUOTE]i dont know what the problem..[/QUOTE] If you want someone to help fix this problem [B]you have to tell us what it is[/B]! EXACTLY what is wrong. Details please.

Member Avatar for JamesCherrill
0
132
Member Avatar for Chitru

IMHO you can't beat the official Sun/Oracle Java learning tutorials [url]http://download.oracle.com/javase/tutorial/uiswing/[/url] Don't worry about learning AWT as such; if you learn Swing then that will include those aspects of AWT that still apply, but you will avoid getting side-tracked by those aspects of AWT that have been superseded in Swing.

Member Avatar for JamesCherrill
0
316
Member Avatar for Dean_Grobler

What Applets Can and Cannot Do: [url]http://download.oracle.com/javase/tutorial/deployment/applet/security.html[/url]

Member Avatar for masijade
0
370
Member Avatar for Mestika

Have a look at HashMap to map words to lists of line numbers, and ArrayList to hold a list of line numbers. All the info is in the usual Java API docs.

Member Avatar for JamesCherrill
0
455
Member Avatar for cretaros

Any particular reason for doing this? - it's not easy, in fact I would rate it as a fairly advanced GUI exercise. ps I did this for an app about 8 years ago, and just dug out the code. It's under 200 lines, but I seem to remember having a …

Member Avatar for cretaros
0
2K
Member Avatar for neemo6
Member Avatar for Tellalca

All java parameters are call-by-value. (Remember that all variables that are not primitives are references to Objects, so it's the reference that's passed by value) So in your example on line 3 parameter is a reference variable that contains a copy of the reference that was used in calling the …

Member Avatar for Tellalca
0
383

The End.