138 Posted Topics

Member Avatar for tania123123123

Try, in a non abstract class then... [code]return result.toString(); [/code] Just to test I would have tried: [code] public void display() { toString(); System.out.println(result); } [/code] Hope this helps...

Member Avatar for JamesCherrill
0
186
Member Avatar for sike.mausa

On line 36, you have not identified the actual file name, eg [code]file = new File(file.txt);[/code] To check that the destination is correct you can use the below methods: isReadable(Path), isWritable(Path), and isExecutable(Path). As shown on the Java tutorial ([URL="http://download.oracle.com/javase/tutorial/essential/io/check.html"][/URL]) "The following code snippet verifies that a particular file exists …

Member Avatar for NormR1
0
144
Member Avatar for tygergyrl

Line 71 is not needed and you could do the same for line 11 in the second FileRead class. Also on line 102, filename is within speechmarks. The coding looks okay, do you have an error message?

Member Avatar for StephNicolaou
0
161
Member Avatar for eddieteddie

Yes that was a bit too mean. Okay for the first question, I think the question would be, a.0. As the rule is while x >100. x is not more than 100 so it won't be stored. The next one x has to be less than 100, which it is, …

Member Avatar for JamesCherrill
0
164
Member Avatar for a.oprea

So, how would you remove a duplicated number in an array list without using "Collection.removeAll(Collection<?> c) " out of interest?

Member Avatar for JamesCherrill
0
214
Member Avatar for javaAddict

Scanner is the better option. Also because it has a lot more methods including the boolean methods to check a wide range of input types before to you begin implementing a certain function. As well as pattern matching and find in line, etc. It's a lot more easier to use.

Member Avatar for StephNicolaou
0
552
Member Avatar for nofanman4311

To simply have a counter on the number of times the scanner takes the next line, you just need, [code]count++[/code] after line 51 with a count variable initialised to 0 at the top of your class. To print this out just used a system print with this count variable after …

Member Avatar for CSloan7597
0
154
Member Avatar for lele07060

Do you just want 123456789987654321? [code] for (int i=1; i<=9; i++){ System.out.println("i"+i); } for (int j=9; j>=i; j--){ System.out.println(j"+j); } [/code] But there's probably a more expert way of doing this...

Member Avatar for NormR1
0
155
Member Avatar for sike.mausa

Where you have readFile( args[0] ); which calls the readfile method, you haven't constructed what the filename is within the method.

Member Avatar for sike.mausa
0
616
Member Avatar for StephNicolaou

Hey guys, I have an Jlabel class and trying to simply add it to the panel in my main class. However is nowhere to be seen! No errors are being output so currently have no idea what wrong...unless you can see whether my method is wrong... Jlabel class: [code] public …

Member Avatar for StephNicolaou
0
236
Member Avatar for StephNicolaou

Hey guys, I've seen very limited examples out there about this unsupported function, however I am sure there must be a quick method to get this done with the Affine Transform ? Any ideas appreciated. Cleo

Member Avatar for mKorbel
1
4K
Member Avatar for StephNicolaou

Hey guys, I've drawn a grid, and I have a label contatining a picture. Whenever I change the location of this label, the grid dissapears until I resize/move the frame. Any suggestions on best method to buffer these grid lines? They aren't going to be moving graphics or anything like …

Member Avatar for StephNicolaou
0
154
Member Avatar for StephNicolaou

Hey guys, I've constructed the main class to refer to a variable in it and I receive a stack overflow error. Any suggestions on the causes of this error, I've used this method previously and have not got this before. [code] In other class: MainClass class = new MainClass(); errors: …

Member Avatar for JamesCherrill
0
207
Member Avatar for StephNicolaou

Hey guys, I'm drawing a grid using the nested for loop with draw line method. Any tips on getting this in the center of my screen? I am currently using the getWidth and getHeight methods of my center panel but it is still drawing in the top left corner. It's …

Member Avatar for StephNicolaou
0
245
Member Avatar for StephNicolaou
Member Avatar for corliss

Fotsung, I'm assuming that you mean main class by "form" class. When you are anywhere in the main class, like the event method, you construct another class in your package like so: [code] OtherClass anyName = new OtherClass(); //OtherClass being the name of your other class [/code] Then, when you …

Member Avatar for StephNicolaou
0
169
Member Avatar for knjava2011

The alternative method is employing the Scanner class. Assuming you have completed this with the StringTokenizer class, this is the route I would have went with, and also to give you ideas of methods that can be used. I prefer to make the variables public within the class: [code] Public …

Member Avatar for Taywin
0
337
Member Avatar for DaniwebOS

DaniWebOS, Going from your first piece of code, you needed to get the radius first before anything else. All the calculations were otherwise useless as you were multiplying by 0. Then it would have been fine to begin with. I hope this helps. Regards, Cleo

Member Avatar for StephNicolaou
0
210
Member Avatar for StephNicolaou

Dear all, When printing a grid, for example a chess board, I was hoping it wouldn't have the same output as the console. When I want the position to be grid[x][y] = 5, 5, it will place the counter in the bottom right corner in a 5x5 grid, (5,1) instead …

Member Avatar for StephNicolaou
0
157
Member Avatar for David321

Hi David, An alternative method instead of having to re-construct the scanner class is changing your while argument. Where you have while next equals stop, I would have: [code] while(in.hasNextLine()){ [/code] Then you can use if statements to characterise between the types of input: [code] (inside while) System.out.print("What is the …

Member Avatar for StephNicolaou
0
194
Member Avatar for StephNicolaou

Hi all, Trying to simply call method, (below) from another class and return the value found by the scanner. Please see below: [code] public int getInt(String prompt) { System.out.print(prompt + "a"); //int result = in.nextInt(); if (in.hasNextInt()) { x = in.nextInt(); y = in.nextInt(); sum = x+y; System.out.print("sum" + sum); …

Member Avatar for StephNicolaou
0
150
Member Avatar for StephNicolaou

Hi All, As shown below, I have already managed to disable all menu items from the QAT. However I would also like the menu option to be completely removed! [code] <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui"> <commands> <command idMso="ApplicationOptionsDialog" enabled="false"/> <command idMso="FileExit" enabled="false"/> <command idMso="Help" enabled = "false"/> </commands> <ribbon startFromScratch="true"> <officeMenu> <button idMso="FileCompactAndRepairDatabase" …

0
145
Member Avatar for StephNicolaou

Hey all, I have split an Access database not on the server. I have decided to VBA code the links, however I have reached a stall when attempted to VBA code the update query; updating the remote table with data from the local temporary table. I have tried multiple things …

Member Avatar for StephNicolaou
0
903
Member Avatar for StephNicolaou

Morning all, Unfortunately I am currently working with Access VBA. I have a simple method; moving an object on a form: [code] button.Top = button.Top - 20 [/code] However on click, I receive the 'Invalid Outside Procedure' message, including: *The exression may not result in the name of the macro, …

Member Avatar for StephNicolaou
0
169
Member Avatar for StephNicolaou

Hi all, I thought it would be quicker to design using NetBeans, but now I'm finding that it's more trouble to work with NetBeans automatically generated garbage 'code'. Anyhow, I've tried to remove its automatically generated code for the frame's scrollbar but that just totally messes up the layout of …

Member Avatar for StephNicolaou
0
110
Member Avatar for StephNicolaou

Hi developers, I'm not sure if this is possible, but I've tried to add database elements to a list box. There are no errors shown, but it simply does not work. Here is the code below: [CODE] if(criteria1 == 1){ getDBConnection(); try { stmt = conn.createStatement(); if(stmt.execute("SELECT Clients.Firstname FROM Clients …

Member Avatar for StephNicolaou
0
126
Member Avatar for StephNicolaou

I'm not sure if this is the best way but I would like to display a list of addresses in a combo box where the columns come from different tables such as Countries, Cities and Types (work and home). I don't want to display the countryID or cityID, etc. but …

Member Avatar for Ezzaral
0
92
Member Avatar for StephNicolaou

Hi everyone, I'm new to C and have been given a C program to complete but found it includes many versions of the titled error for each class file. Can anyone please explain why it occurs and how I could get rid of them? Thanks, Cleo [code] q2.c:5: error: expected …

Member Avatar for Leo71
0
423
Member Avatar for StephNicolaou

I'm not sure if I'm doing this correctly but up to now I get an exception error. Can you see why? : [code] public void countHeap(){ System.out.println("input data:"); for (int i = 0; i < dataSet.length; i++) { System.out.print(" "+dataSet[i]); count++; } noDataElements = count; formHeapTree(); } public void formHeapTree(){ …

Member Avatar for quuba
0
156
Member Avatar for StephNicolaou

Hi all, Background: I am dealing with graphical objects on a canvas in which the user draws four lines and out of these four lines I get the top left corner, bottom right corner and figure out the width and height from these two points. Problem: I have completed this …

Member Avatar for peter_budo
0
124
Member Avatar for StephNicolaou

I'm trying to show a dialog message if the user clicks a button and a text field is empty. [code=java] Action listener - if(event.getSource() == cmdSaveSettings) if(txtPlayerOneName.getText().equals(emptyText)) { JOptionPane.showMessageDialog(null, "alert", "Please enter player one's name", JOptionPane.ERROR_MESSAGE); } [/code] Ive add an action to listener to the button and the textfield: …

Member Avatar for masijade
0
213
Member Avatar for StephNicolaou

I have had to repaint a couple of times because of a moving shape I have added to my program whenever the mouse is clicked. I also have a moving shape that follows the mouse over a grid as well which doesn't help a lot, could you please tell me …

Member Avatar for StephNicolaou
0
238
Member Avatar for Geekerz

The most illogical thread I've EVER read. Making a virus and then creating an Anti-virus for FREE. Developing a virus at all is kind of silly, not to mention running the code on your main computer.

Member Avatar for StephNicolaou
0
126
Member Avatar for StephNicolaou

This is a connect four game and I'm trying to show the counter falling. What I have so far is this which is in a for loop: [code] while(fallingCounter == true && x[j][i] < playerTurn) { //Move the counter vertically down the grid's rows appearing to fall fallingCounter(); g.setColor(counterColour); //counterWidth …

0
109
Member Avatar for StephNicolaou

Hi, I've followed the example in my lecture notes and it doesn't work! I want to add an image to a label and then add that label to my sub north panel. I want to do this with creating a new class...I'm not sure if I need an "image loader" …

Member Avatar for StephNicolaou
0
143
Member Avatar for StephNicolaou

I have been trying to write simple return statements and print the result of the return. I have read books such as O-Reily and have used examples but find that the examples don't work either so I guess I just need human communication!! First I have tried this return method …

Member Avatar for Dukane
0
202
Member Avatar for StephNicolaou

I'm trying to make a circle appear from a class I've developed to move following the x co-ordinate of the mouse. I've done that part correctly, it's just loading the class...Can anyone tell me why it isn't loading? I do love to solve problems myself but I've been working on …

Member Avatar for Ezzaral
0
233
Member Avatar for StephNicolaou

There isn't exactly anything wrong with my code, it's fine although the order isn't correct, I think, which makes my shapes appear behind the center panel. I'm not sure how to correct this as I've drawn my shapes under a paint method. I've tried moving the paint method before and …

0
70

The End.