1,678 Posted Topics
Re: You have most of the correct code. [CODE]import java.util.Scanner; import java.io.*; /** */ public class ChargeAccountValidation { public static void main(String[] args) throws IOException { final int SIZE = 50; int[] numbers = new int[SIZE]; int result, searchValue; int index = 0; // Open the file. File file = new … | |
Re: [url]http://support.microsoft.com/kb/85068[/url] ??? | |
Re: I agree with you, mainly, but what did that 'hijack' thread have to do with people who don't show effort on homework assignments? I thought the whole 'hijack' thing was about threads that had gotten split or something like that. Guess I'm out of the loop... | |
Re: Your explanation makes no sense. Do you want to know how to use a JOptionPane? [CODE]JOptionPane.showMessageDialog(null, "Here is some text!");[/CODE] | |
Re: Create an interface called ClickHandler. Have all of your classes (that you want to execute code when the thing is clicked) implement the ClickHandler interface. The ClickHandler interface should have one method called handleClick(). Each of your classes can provide their own implementation of handleClick(). Now, in your base class, … | |
Re: It means that, at the line where you got that error, you are trying to use a variable which has not been initialized. | |
Re: [QUOTE=mgern26;1161118]im sorry im new to coding could you show me what you would do[/QUOTE] Sure. I would read resources and examples on Java programming, especially on the topics that my assignment covered. Then I would think about how what I had learned applies to my current assignment. Then, if I … | |
Re: [QUOTE=clutchkiller;1157114]Do people who use these API's even know how to program? Ive never used XNA before, but it seems like the average Joe can download it, copy past from some tutorials and make some triple A game title. It kinda pisses me off. If anyone here begs to differ, let … | |
Re: This is the java forum. And you can use either Swing or SWT. Go read about them on google. | |
Re: Don't use Netbeans for dynamically generating panels. It only leads to frustration. Write your GUI by hand. | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/button.html[/url] You can make JButtons with images, text, or both images and text on them. You can add these to a JPanel that uses the GridLayout layout manager. For example [CODE] //Creates a panel with a layout that has 10 rows and 10 columns. JPanel panel = new JPanel(new GridLayout(10, … | |
Re: "Rumour" is spelled rumor in the U.S. :p ![]() | |
Re: Isn't this the exact same question you had in [URL="http://www.daniweb.com/forums/post1158872.html#post1158872"]this thread[/URL] in the Java forum, where I gave you a very detailed explanation of what you needed to do? You never even replied back. Shame. Guess I wasn't very helpful. | |
Re: Are you using a JTextField? Then it would be textField.setText(someString); to set the text. Other than that, you haven't given nearly enough code for anyone to be of assistance.. | |
Re: If they aren't part of the same package then lets say you have a class called OtherClass in a package called other. Then you would need to add the following statement to the top of the class you wanted to use OtherClass from: [CODE]import other.OtherClass; [/CODE] Then you would be … | |
Re: [QUOTE=CE-hacker;1161023]what are they focusing on ccna this time ??? i heard its about subbneting this time in the exam !! im planin to do it tomrw though ...let me know ...anyone anyone[/QUOTE] It's purely focused on grammar. You don't stand a chance. | |
Re: Yeah; after you add the new widget to the JFrame, call myFrame.validate(); | |
Re: [CODE]Object obj = ois.readObject(); allRequests = (ArrayList) ois.readObject();[/CODE] should be? [CODE]allRequests = (ArrayList<Type>) ois.readObject();[/CODE] Por ejemplo, esto es mejor: [CODE]import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectInputStream; import java.io.ObjectOutputStream; import java.io.Serializable; import java.util.ArrayList; public class SerializationTest implements Serializable{ private static final long serialVersionUID = 196385420706158250L; static ArrayList<String> list = new … | |
Re: If you want to be assured that someone is using your work so badly, why not look for a job with a different company? But I agree with jwenting in that your focus should shift more towards taking pride in the work that you do and improving yourself rather than … | |
Re: I've never used the valueOf() method. Just use the '+' operator. The + operator creates a [B]new[/B] String in the background anyway. The valueOf() method returns a new String so it does the same. Neither method has a time advantage that anyone cares about; although I don't claim to know … | |
Re: You have to declare each variable separately. Putting = new JPanel() at the end only declares the last variable, not all of them. Therefore your pnlUser variable has never been initialized with a "new" statement and is giving a NullPointerException. | |
Re: [CODE]PlatformUI.getWorkbench.showPerspective(perspectiveID, window)[/CODE] It has been many months since I worked on Eclipse RCP .. but I think that is the correct way to do it. If you look at the methods available to you in the PlatformUI class you can trace those method calls yourself. [url]http://publib.boulder.ibm.com/infocenter/rsdhelp/v7r0m0/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/PlatformUI.html[/url] | |
Re: I'll look at your code but in the future use code tags. | |
Re: If you wanted to show all of the results you'd have to do [CODE] showResult= showResult + "Found Names: "+found+ "Similarity: " +compare+"Path: "+file.getName();[/CODE] or, equivalently, [CODE]showResult +="Found Names: "+found+ "Similarity: " +compare+"Path: "+file.getName();[/CODE] | |
Re: That depends on what 'this' is, what 'point' is, what code is in the method, and what the error message actually says. Post the code for the method and post the full error message. | |
Re: Above your methods you should add standard Javadoc comments: [CODE] /** * bodilyFunctionsMethod * This method makes the program more gross and its purpose * is to demonstrate bodily functions. This is the description. * @param farts they make this method stink * @param poop it makes this method gooey … | |
Re: [CODE]System.out.println("My Strength is " + (strength +20) + " my Health is " + (health +50));[/CODE] doesn't change the value of strength. On a separate line, write strength = strength + 20; and it will change the value of strength. Is that what you were asking? | |
Re: Please don't give working code, give advice instead, if possible. To the OP, keep in mind that when running a program with command line arguments, those arguments are stored into the args array. So args[0] would be the first command line argument, args[1] the second, etc. Combined with the code … | |
Re: I don't know but if you wait another 3-5 years I'll up this thread with an unrelated question for solidarity's sake. | |
Re: [QUOTE=bibiki;1159046]you have name = CharSet.next() perhaps what you need is CharSet.nextInt()[/QUOTE] No; that would result in an error because name is a String and nextInt() obviously returns an int. He might want to say name = CharSet.nextLine() but that is not the source of his compiler error. His compiler error … | |
Re: Where are you getting stuck, what do you need help with, etc... | |
Re: [QUOTE=pikesh;1158783]Hoe i can solve this type of error?[/QUOTE] What did you call me? ;) | |
Re: No problem Claire (I'll take credit for any good information, hehe). Welcome to the site! | |
Re: Write a scheduling algorithm for the OS. | |
Re: [url]http://www.java2s.com/Tutorial/Java/0120__Development/UsingJavasprintfMethod.htm[/url] | |
Re: [CODE]int i; for (i= 0; i < array.length; i++){ if (array[i] == '\0') array[i] = '\n'; }[/CODE] My C coding skills are very rusty but that is the general idea, you might have to tweak it a little bit to make it compile haha (I don't remember if C uses … | |
Re: [QUOTE=Biker920;1155158]Tell you what you pay my $45 until job cranks back up to full time check. Then I will pay full freight. Anyhoo back in real life I'll make my self as useful as possible, because feel good doesn't pay for roof & family. Not grumping just stating facts. Later---[/QUOTE] … | |
Re: Are you sure you aren't missing a . right before the second ? I just did something similar in Perl so I can probably help.. but an example of what your input and output are would be nice. | |
Re: define the array as a char array instead of as an int array. [CODE]char[][] mychars = new char[10][10]; mychars[0][0] = 'x';[/CODE] And if you're going to make new threads about the same topic, mark your other thread solved. Otherwise just keep posting in the other thread. | |
Re: Do you really want to truncate the value, or do you actually want to print out a value up to three decimal places? [url]http://java.sun.com/docs/books/tutorial/java/data/numberformat.html[/url] Look at the DecimalFormat example there. You can also use a C-style printf statement if you want to. You could also use DecimalFormat to truncate the … | |
Re: Assigning x = board does nothing. The variable x goes out of scope as soon as your method call returns. You should be saying board = x. Once you fix that, your program still will not work. You never created & initialized any values in your 2D array. Really, at … | |
Re: [CODE]JOptionPane.showMessageDialog(null, "Your message goes here");[/CODE] | |
Re: [url]http://java.sun.com/docs/books/tutorial/java/nutsandbolts/op2.html[/url] Read the section on instanceof. One good use of instanceof is in the equals() method that is inherited from the Object class. Since the method is defined as taking a type Object as a parameter, you need to check that it is of the correct type before casting it … | |
Re: Your output isn't correct because you are only checking to see how many words [I]exist[/I] in your input, not how many words have the letter you are looking for. You might want to do something like [CODE]Scanner input = new Scanner(System.in); int wordsWithTheLetter = 0; while(input.hasNext()){ String word = input.next(); … | |
Re: Can someone please close this thread? For the last week I've been hoping it would die, but it seems like every couple days somebody posts a new "solution" in here. | |
Re: Define a GUI class that has a constructor which takes an ArrayList<Location> as its argument. [CODE]public class YourGUI{ public YourGUI(ArrayList<Location> list){ //add it to a JList here, add that JList to a JPanel & JFrame, show the JFrame, etc } }[/CODE] Your project statement seems quite complicated so I find … | |
Re: Well your switch statement has no affect because you declared your variables inside the switch. Declare the variables outside of the switch if you want your assignment statements to do anything. i.e. what I did with your 'm' variable below. [CODE]public class Travel { public static void main(String[] argv) { … | |
Re: Or perhaps most people don't care that google has mundane information about them on their databases. . | |
Re: [url]http://java.sun.com/docs/books/tutorial/uiswing/components/button.html[/url] They have fully working examples as well as explanations. If you go to some of the JButton examples you'll be able to adapt it to your needs. You also might want to check out some other Swing topics such as [URL="http://java.sun.com/docs/books/tutorial/uiswing/layout/grid.html"]how to use GridLayout [/URL] (also has examples with … |
The End.