7,116 Posted Topics

Member Avatar for edamay.payay.9

You already have a method to find the largest value. All you need is exactly that same logic, plus keep a count of the position as you loop. Each time you find a larger value, record the position where you found it.

Member Avatar for edamay.payay.9
0
470
Member Avatar for MasterHacker110

[UCanAccess](http://ucanaccess.sourceforge.net/site.html) (sourceforge) may be an answer

Member Avatar for Schol-R-LEA
0
614
Member Avatar for momal

Nice example. You can push the Stream usage a bit further, depending on the overall requirements, along the lines of: Files.lines(Paths.get("studentTest.txt")) .map(line -> line.split(":")) .filter(parse -> parse.length == 2) .map (parse -> new Student(parse[0], parse[1])) .collect(Collectors.toList());

Member Avatar for JamesCherrill
0
5K
Member Avatar for Wei_3
Member Avatar for JamesCherrill
0
676
Member Avatar for devgit2810

JMF is old and never received much love from Sun or Oracle. It never worked properly, and never will because Java 8 includes JavaFX, which is the future of multi-media GUIs in Java. I would recommend you forget JMF and look at JavaFX - there's lots of stuff on the …

Member Avatar for llaspina
0
1K
Member Avatar for directorabbey

DaniWeb Member Rules (which you agreed to when you signed up) include: "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules Post what you have done so far and someone will help you from there.

Member Avatar for llaspina
-1
166
Member Avatar for henryz_box

(This is a copy of my replies to the earlier thead - repeated here for simplicity) That's a common problem with Swing (or any other powerful GUI toolset), and there isn't any good solution. An IDE with code folding helps when you are editing the code. You can certainly put …

Member Avatar for henryz_box
0
332
Member Avatar for Somayeh_1

I'm not surprised you find it confusing. You are jumping in at the deep end with a number of copmplex technologies all at once, without learning the basics first. Einstein would have found that difficult. (Actually he wouldn't because he was too smart to try it!) Stultuske's advice (at the …

Member Avatar for llaspina
0
183
Member Avatar for laguardian

hoursWorked is defined and initialised in HourlyEmployee. In class Janitor's constructor you have super(name, hoursWorked); now the parameters of a method (or constructor) are evaluated before the method is called, so this line tries to evaluate hoursWorked before it can call HourlyEmployee's constructor. Because HourlyEmployee's contructor has not yet been …

Member Avatar for JamesCherrill
0
229
Member Avatar for gua543

The default access is not public, and public/private are not the only alternatives. See http://docs.oracle.com/javase/tutorial/java/javaOO/accesscontrol.html

Member Avatar for gua543
0
438
Member Avatar for mark_jason
Member Avatar for Pravinrasal

1. Post your code in CODE tags so we can read it. 2. frame.getContentPane().add(pane); the getContentPane() hasn't been required since Java 1.5 3. Never override paint(), override paintComponent instead. 4. Because your custom JPanel has no components in it Swing doesn't know how big it is, and probably has its …

Member Avatar for Pramodkumar_1
0
7K
Member Avatar for Slavi

Before you start installing some random datatbase engine, remember that Oracle's JavaDB is already on your system. It's installed as a part of the standard JDK. It works very well indeed with Java (obviously!) and NetBeans knows all about it. You can start with it as a singe-user simple embedded …

Member Avatar for Slavi
0
244
Member Avatar for sGirl123

The parameter for split is a REGEX. In a REGEX the + character is a special character. To use it as a literal + you need to "escape" it with a single \ . To enter a single \ in a Java String you need to code a double \ …

Member Avatar for sGirl123
0
142
Member Avatar for mrabrar09
Member Avatar for stultuske
0
532
Member Avatar for realmattbender
Member Avatar for Anamika15

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
758
Member Avatar for vishalcap

Hi vishalcap For the benefit of anyone else getting this problem in future, and finding this thread, can you please let us know what the problem was, and how you fixed it? thanks

Member Avatar for JamesCherrill
0
278
Member Avatar for ParPau

OK, cool it down folks. stultuske is well known for saying what he thinks. If anyone doesn't like his posts then just ignore them. Please don't get into a place where I have to infract anyone for violating the "Keep it Pleasant" rule. Now, back to the original subject please. …

Member Avatar for Taywin
0
2K
Member Avatar for henryz_box

Simply placing components on top of each other in an ordinary JFrame doesn't work. There are (at least) two ways to put controls over a background image: 1. Subclass JPanel and override `paintComponent` to draw the background image directly into the JPanel 2. USe a JLayeredPane to place your controls …

Member Avatar for JamesCherrill
0
491
Member Avatar for Utkarsh_1

You just copy/pasted your assignment without even a moment taken to explain what help you need. That's highly disrepestectful to the many people who give their time to help others here. There are lots of people here who will freely give their time to help you become the best Java …

Member Avatar for jwenting
-4
107
Member Avatar for dippy78
Member Avatar for jwenting
0
306
Member Avatar for sankubha

I simply use code like InetSocketAddress addr = new InetSocketAddress("XXX.no-ip.biz", 21); new Socket().connect(addr, 2000); to connect to a host via No-Ip, and it's just like connecting to any other DNS-registered host. No problem. The thing that can be fiddly is getting your server accessible if it's behind a router/NAT, but …

Member Avatar for JamesCherrill
0
364
Member Avatar for Varunkrishna
Member Avatar for Taywin
0
260
Member Avatar for Slavi
Member Avatar for toring

No no no! Only ever draw on a Swing Graphics when you override `paintComponent(Graphics g)` (or, sometimes, `paint(Graphics g)`) Swing has all kinds of internal optimisation, including double-buffering that you don't see. If you start drawing to Swing's internal Graphics at random times then there's a major risk that it …

Member Avatar for JamesCherrill
0
232
Member Avatar for Slavi

> Caused by: java.lang.IllegalStateException: Location is not set. > at javafx.fxml.FXMLLoader.loadImpl(Unknown Source) > at javafx.fxml.FXMLLoader.load(Unknown Source) ... seems to suggest there's something missing in your scenebuilder FXML file? Update: It seems this can be caused by the FXML file not being where you told the loader it is. In turn, …

Member Avatar for Slavi
0
2K
Member Avatar for pwolf

Programming is 90+% thinking and 10-% typing, at best. I'm the world's worst typist, but it doesn't matter because I use NetBeans that does much of the typing for me, and identifies typos as I go. My guess is that, as an experienced developer, using Eclipse or NetBeans improves my …

Member Avatar for jwenting
0
715
Member Avatar for Benny_1

This sounds like a cunning re-phrasing of the classic "Travelling Salesman Problem" with its O(n!) time for a brute force solution. There's a vast amount of info on the TSP, including more algorithms than you could shake a stick at. WikiPedia is yopur friend.

Member Avatar for Benny_1
0
287
Member Avatar for Wandaga1

Why do you think anything is wrong with it? If you have an error, or incorrect results, then share that info with us, don't expect us to guess!

Member Avatar for Taywin
0
246
Member Avatar for Mr.M

1. Multi-threaded server for multiple concurrent clients: see http://docs.oracle.com/javase/tutorial/networking/sockets/clientServer.html (don't miss the bit about multiple clients towards the end) 2. Splitting the message - just use String's `split` method. If that's not good enough then search for delimiters with `indexOf` the use `substring` to pick it apart. 3. Concurrent update …

Member Avatar for JamesCherrill
0
2K
Member Avatar for Dean_Grobler
Member Avatar for pravin.kamate.9
Re: JDBC

Do you really think you have given enough information for anyone to know what you have done wrong?

Member Avatar for henryz_box
-1
103
Member Avatar for strRusty_gal

Is this what you mean? class A { public A(int i) { ... // constructor ... } class B extends A { public B(int i) { super(i); // calls superclass's constructor } ... }

Member Avatar for strRusty_gal
0
238
Member Avatar for DkgMarine

> Could someone explain this could with deep detail? line by line? I doubt anyone has the time or motivation to do that. Look at some beginner's tutorials, and come back here with any specific questions that may remain. [This](http://docs.oracle.com/javase/tutorial/java/javaOO/classes.html) is a really good place to start

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

Read the Oracle tutorial http://docs.oracle.com/javase/tutorial/uiswing/layout/gridbag.html in particular, see the comment under `weightx, weighty` about half way down.

Member Avatar for JamesCherrill
0
378
Member Avatar for Desmond_1

There are lots of ways to do this, here's one that is easy to read... have an `isNumeric` boolean. Start with it true, then set it false in the catch clause if you get a NumberFormatException. Put the messages (lines 15 - 23) inside an `if (isNumeric) ...`

Member Avatar for mKorbel
0
668
Member Avatar for moaz.amin.37
Member Avatar for mKorbel
0
168
Member Avatar for hwoarang69

So `GameKeys.mouse[0]` is null, meaning you ctreated the array but you didn't initialise its elements. Maybe you just forgot to do that, or maybe one of your events is being called early in the startup, before you have finished initialising that array?

Member Avatar for JamesCherrill
0
329
Member Avatar for Doogledude123

I didn't see why that would fail, but have you tried printing `ability` at each of those stages to see where the null creeps in?

Member Avatar for Doogledude123
0
294
Member Avatar for screenedcreamy

Time consuming to program? Yes, very. You'll probably end up with a complete java source code parser plus a raft of individual rule checks - all of which is perfectly do-able in Java, but it's going to be a *lot* of tedious code. I know there are compiler-compilers and generalised …

Member Avatar for stultuske
0
256
Member Avatar for Lee_8

Yes, people here will help - but do read the DaniWeb rules first, especially "Do provide evidence of having done some work yourself if posting questions from school or work assignments" http://www.daniweb.com/community/rules

Member Avatar for JamesCherrill
0
816
Member Avatar for Desmond_1
Member Avatar for Desmond_1
0
257
Member Avatar for Bradoz

Let me just add the usual health warning to the previous post. anand.khatik is a first-time poster; we have no information, good or bad, about his skills or credibility. Nobody has checked the email address he gives. Anyone copying someone else's code and submitting it as their own homework deserves …

Member Avatar for JamesCherrill
0
3K
Member Avatar for Slavi

You don't need an IDE, but if you are going to use one NetBeans seems to have integrated it better. JavaFX comes with a drag'n'drop GUI builder called SceneBuilder that you can use stand-alone or in your IDE. Yes, you can (probably should!) add the GUI to the logic layer …

Member Avatar for Doogledude123
0
290
Member Avatar for asaidi

Your classpath needs to contain an entry that refers to the jar or folder that contains the missing class (in a folder structure that matches the package names)

Member Avatar for Taywin
0
236
Member Avatar for SpottyBlue

Your subclass overrides the superclass's toString() so that doesn't get executed. You could do something like public String toString() { return super.toString() + "\n Country name: " + countryName + "\n" + "Population: " + population; } ps: I guess you realise that a Country is NOT a subclass of …

Member Avatar for JamesCherrill
0
163
Member Avatar for SpottyBlue

The question to ask is "which variables MUST be set for the instance to be in a valid state?" Eg Maybe every Emplyee MUST have a name, but maybe a title is optional. Maybe every Worker MUST have an hourly rate, but maybe it's OK to default the hours to …

Member Avatar for JamesCherrill
0
152
Member Avatar for nancy10001

C++ is a language with a standard librray that covers a decent range of common requirements. You are expected to use it with the native facilities of your OS and whatever other third-party libraries you need to build your application. Java is a language plus a vast API of over …

Member Avatar for ~s.o.s~
-1
385
Member Avatar for salesforce

Start by defining a Student class that has instance variables for name. marks etc. Input the raw data, create the instances of Student and add them to a List like JeffGrigg said. Java has methods to sort a List: http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html#sort%28java.util.List,%20java.util.Comparator%29 you need to create one or more Comparators ( http://docs.oracle.com/javase/7/docs/api/java/util/Comparator.html …

Member Avatar for JamesCherrill
0
303

The End.