7,116 Posted Topics

Member Avatar for astrid.deliz

> This is what i have so far. Please don't think we are fools. We know where you copied that from, and so will your teacher after 15 seconds with Google. Copying someone else's answers is likely to get you an automatic fail of your course, and possibly being thrown …

Member Avatar for JamesCherrill
0
1K
Member Avatar for jones13

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 helping you cheat or doing your homework for you. DaniWeb Member Rules (which you agreed to when you signed up) …

Member Avatar for JamesCherrill
0
406
Member Avatar for moaz.amin.37

PrintWriter and PrintStream both implement a println method. Read their API doc for details. ps: Your last three posts are still not "Solved". What's the problem?

Member Avatar for moaz.amin.37
0
197
Member Avatar for reuben_1

It can't read the image file. Possibly because the file is invalid, but much more likely it's looking for it in the wrong place. Java's default folders are often a source of confusion. To see where Java is looking for a file (eg "images/image1.jpg") you can use something like this …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Violet_82

JTextField will fit to the text in it when you pack() its container (more precisely: it updates its preferred size to fit the text, and the layout manager uses that).

Member Avatar for Violet_82
0
428
Member Avatar for moaz.amin.37

The message is not showing because you have not written any code to show it. In your catch block, instead of printing "wrong" you should print the exception.

Member Avatar for Akansha Jain
0
2K
Member Avatar for Doogledude123

You don't seem to put anything in your scroll pane? `setLocationRelativeTo(null);` works OK. If it's centering the TL corner then it sounds like swing thinks your JFrame is empty when you execute that. Why do you want to set sizes explicitly in pixels? YOur app is going to look pretty …

Member Avatar for Doogledude123
0
354
Member Avatar for adarshcu

Holding a ref to an object that's in a list won't affect the list's reference count because the object does not have a reference to the list. Either you have a reference to the list itreslf that's still active, or maybe GC just hasn't got round to deleting it yet.

Member Avatar for JamesCherrill
0
155
Member Avatar for brittney_2

I'm no regex expert, but my guess is that you can't, or, if you can, it's ludicrously complex. The real question is: why? Why not just run two simple replace commands with two simple regexs?

Member Avatar for ~s.o.s~
0
751
Member Avatar for Mike Askew

If you have an em-dash then the file is not ASCII encoded! ASCII is a 7-bit code that includes only the english alphbet, numbers and a handfull of puctuation (not em-dashes), so any other characters will be unreadable when you specify ASCII as the character set. Simply leaving out the …

Member Avatar for JamesCherrill
0
177
Member Avatar for IndieDeV2002

Java support for media has beena shambles inthe past - JMF never worked properly. The good news is that JavaFX is now a standard component in all the current versions of JavaSE. JavaFX has excellent support for media. See this recent thread - especially the last two posts http://www.daniweb.com/software-development/java/threads/475808/how-to-play-mp3-files-in-java-using-eclipse

Member Avatar for bCubed
0
935
Member Avatar for Slavi

How about thy multi-user chat/picture sharing thing? (Client/server, threads etc.) You can build that into something quite large & complex if you keep adding features. Start by designing a generic framework, then implement the specific app by building on that - that's like a lot of well-designed projects.

Member Avatar for JamesCherrill
0
500
Member Avatar for 2384443

What do you mean by "can't run it"? - YOu don't know how to, you try to run it but nothing happens, you run it and you get an error message (if so- -s aying what?)... ?

Member Avatar for 2384443
0
247
Member Avatar for Violet_82

Sorry, but yes, the answer *is* in the API doc! Just look for the addXxxListener methods (being alphbetical, they're conveniently near the beginnning of the summary list). Dopn't forget to look at the methods inherited from superclasse as well. Here's a great tutorial http://docs.oracle.com/javase/tutorial/uiswing/events/ and this page includes a table …

Member Avatar for Violet_82
0
310
Member Avatar for anand01

You can use the `java.beans.Introspector` class to get the `BeanInfo` for your bean. Then use the `BeanInfo` to get the `PropertyDescriptors`. That gives you an array of all the properties, from which you can call `getReadMethod()` to get each of the bean's get methods. You can `invoke` those methods to …

Member Avatar for JamesCherrill
0
291
Member Avatar for Richa_2

Congratulations on a really interesting question! I think the answer is that the load() method (line 9) satisfies both the requirements of the interface and the abstract superclass, so that's OK.

Member Avatar for stultuske
0
333
Member Avatar for chdboy

Did you really mean to add the same JPanel both to another JPanel and an JFrame? You seem to have a BorderLayout on your frame (see 82) yet I found three places where you add a component to that frame without specifying a location (80, 81, 89 - duplicate). Sticking …

Member Avatar for chdboy
0
483
Member Avatar for chdboy
Member Avatar for johnson_2

The loop at line 26 keeps calling selectJLabel. selectJLabel creates a new instance of the LabelListener class each time it's called. So you keep creating new instances until you run out of memory. There isn't enough info here to say how the program should be re-structured, but the while loop …

Member Avatar for johnson_2
0
286
Member Avatar for moaz.amin.37

What exectly do you mean by " how two exception handle"? As soon as your code throws an exception, the rest of the block stops executing, so you cannot throw two exceptions at the same time. ps. Your example code is perfectly legal, but also misleading. It's very odd to …

Member Avatar for JamesCherrill
0
256
Member Avatar for moaz.amin.37

ArrayStoreException extends RuntimeException, so it's unchecked IllegalArgumentException extends RuntimeException, so it's unchecked Simply.... if it extends RuntimeException or Error it's unchecked, otherwize it's checked. > The unchecked exception classes are the run-time exception classes and the error classes.The checked exception classes are all exception classes other than the unchecked exception …

Member Avatar for JamesCherrill
0
291
Member Avatar for moaz.amin.37

There's no such thing as a "compile time exception" in Java. There is no instance of that term anywhere in the Java language Specification. The compiler will check that your code handles "checked" exceptions, but all Exceptions are thrown at run time. Maybe you are reading something written by someone …

Member Avatar for moaz.amin.37
-1
332
Member Avatar for chdboy

No, they are package access by default, justlike ordinary methods. The error message refers to a constructor with a `long` parameter, but the only constructor takes an `int`. Creation or modification of Swing components should normally be done on the Swing thread. Sleeping during a constructor while changing a swing …

Member Avatar for JamesCherrill
0
306
Member Avatar for moaz.amin.37

The actual parameter that is passed to your paint method will be an instance of `Graphics2D` - which is a concrete subclass of `Graphics`. ps: If you previous posts have been answered then please mark them "solved"

Member Avatar for JamesCherrill
0
384
Member Avatar for samuel.tenderfeet

Your getters & setters seem OK. Was he referring to lines 86, 90, 94? Those are hard-coded values where presumably you are expected to prompt the user to input a value? Have you covered the use of Scanners in your class yet?

Member Avatar for stultuske
0
149
Member Avatar for abeer araji

OK. Nobody here thinks you are a cheater, so don't worry. People suggested that the "complete solution" that someone else posted could be an encouragement to cheat, but nobody suggested that you copied it. You're here to learn, so are we all. Let's just keep helping each other. JC

Member Avatar for JeffGrigg
0
136
Member Avatar for Violet_82

This is a case where your first solution is good, and anonymous inner classes don't help. You could attach the color as an attribute of each radio button With Java 8 you just create a method rather than a class eg void changeColor(ItemEvent e, Color c) {... then use lambdas …

Member Avatar for JamesCherrill
0
298
Member Avatar for rowen_1

Everything to do with Swing (eg painting the screen, running actionPerformed methods) happens on a single thread - the "Event Dispatch Thread", or "EDT", or "Swing thread". That means that once your actionPerformed method starts NOTHING else will happen in Swing, including no screen updates, until your method finishes. You …

Member Avatar for JamesCherrill
0
186
Member Avatar for Steven_9

The problem is in the sequence of events... You check the inputs and set the boolean when the user clicks the button, but you check the value as part of your initialisation (line 27), which is before the user could possibly have entered anything or clicked the button. You will …

Member Avatar for Steven_9
0
2K
Member Avatar for moaz.amin.37

When the compiler is compiling the Component class, its source code will have an `import java.awt.Color;` or somesuch as part of its definition. That tells the compiler that Component class needs to use the Color class, and the compiler generates all the necessary code.

Member Avatar for stultuske
0
218
Member Avatar for quontra123

Access to a computer and the internet. Reasonable logical intelligence. Willingness to work. Time.

Member Avatar for happygeek
-2
117
Member Avatar for justinelinz.sonenclar

> constructs a Rectangle object Read the API documentation for the Rectangle class - especially its constructors > calls to translate and grow should ... these two methods are also documented in the API documentation http://docs.oracle.com/javase/8/docs/api/java/awt/Rectangle.html

Member Avatar for iamthwee
0
320
Member Avatar for moaz.amin.37

Remember also that your class extends JApplet, and you inherit all JApplet's methods and can call them directly.

Member Avatar for JamesCherrill
0
261
Member Avatar for mikewyatt

Hi Mike, welcome back! Hope you're fully better now. Did you see the Oracle tutorial on client/serve sockets? It's definitive... http://docs.oracle.com/javase/tutorial/networking/sockets/index.html JC

Member Avatar for JamesCherrill
0
193
Member Avatar for asaidi

What exactly is your question? ps: You do not want to open a new database connection every time the user presses "next/suivant". Just do it once, as part of the initialisation.

Member Avatar for JamesCherrill
0
227
Member Avatar for laguardian

I know nothing of Opportunity, but for 10% chance you use Math.random() to get a random double >= 0.0 and < 1.0 Something like if (Math.random() < .10) // draw 2 cards else // draw one card

Member Avatar for JamesCherrill
0
70
Member Avatar for brittney_2

You declare the parameter(s) of a constructor just like an ordinary method eg public CheckDate(String mmddyyyyString) { ... then call them passing parameters also like an ordinary method, eg CheckDate cd = new CheckDate(input.nextLine));

Member Avatar for brittney_2
0
265
Member Avatar for moaz.amin.37

It's available from amazon.com at about half price (USD20). Personally I would avoid books, which are always out of date, and go with online materials. Oracle's "official" Java tutorials are excellent - not easy, but comprehensive and authoritative, and free. http://docs.oracle.com/javase/tutorial/uiswing/index.html

Member Avatar for stultuske
0
352
Member Avatar for kishor.m.n

Yet another good example of why not to use a null layout manager! Swing doesn't know how big the panel is because there's no layout manager to set it. If you use `setPreferredSize` to give the panel a size bigger than the scroll pane's viewport, the scroll buttons will appear.

Member Avatar for mKorbel
0
10K
Member Avatar for holo12

1. You can use `b.remove(i)` to remove entries. Loop down from the end of the list to the beginning to avoid confusing your loop's indexing when you delete an entry 2. You can't use any ordinary iterator because they don't allow you to change the List while iterating. But... a …

Member Avatar for holo12
0
120
Member Avatar for TERRIOUS

Yes, people here will help you. Explain what you have done so far and exactly what help you need. Remeber that nobody here will do the work for you, but they will help you to learn whatever you need to do it yourself. The more effort you put in, the …

Member Avatar for iConqueror
-2
358
Member Avatar for iConqueror

I can't see anything in the bytecode that would explain a speed difference, and caching at the RAM level isn't going to be relevant, so maybe this is a low-level hardware thing - pipelining and branch prediction at the CPU level maybe??? If you refactor that into a runnable program …

Member Avatar for ~s.o.s~
1
371
Member Avatar for Enise

That's far too vague. We need more information about what you have tried and exactly what problem(s) do you have.

Member Avatar for JamesCherrill
0
70
Member Avatar for Th35h4d0wF0x

This depends on whether the value is a primitive (int etc) or an object. If it's an object then all your variables are pointers (references) anyway.

Member Avatar for JamesCherrill
0
88
Member Avatar for Mr.M

This is a very specialist subject - it's possible nobodyhere has any experionce with jpos. The jpos web site links to a user group and a developer's forum - you'll probably have more luck there.

Member Avatar for Mr.M
0
152
Member Avatar for soujanya.bhat.184

9: ... textField.toString() ... If textField is a JTextField or similar then this is a mistake. The toString() method gives you a String description of the text field object and all it's parameters. Use getText() to get the text that's displayed in the text field.

Member Avatar for mKorbel
0
138
Member Avatar for blackmiau

The first computer I ever used was am IBM360/30 with 64k ram and a 3.6 meg hard disk. Programmed exclusively with punched cards. I was lucky, the people who went through IBM new employees training one month before me started with some machine that was programmed by moving plugs and …

Member Avatar for almostbob
4
1K
Member Avatar for asaidi

Exactly what code do you execute in the actionPerformed for your "next" button?

Member Avatar for JamesCherrill
0
140
Member Avatar for Ealiom
Member Avatar for guideseeq

In the first case all you are asserting about linksSet is that it is a Set. Anyone using linksSet will only be able to use Set's methods. Maybe later you will want to change the implemention eg to a TreeSet for some reason. By defining things that way you can …

Member Avatar for guideseeq
1
243

The End.