2,777 Posted Topics
Re: On my computer this program prints 3 pages. I'm on WinXP SP3. [code] import javax.swing.*; public class PrintProblem { public static void main(String[] args) { JTextArea txtA = new JTextArea(); // fill up for(int i=0; i < 100; i++) txtA.append("this line forever " + i + "\n"); try { boolean … | |
Re: Can you explain how you create the output from the input? | |
Re: What is the purpose of the addAttribute() method? What are 'CP's? | |
Re: [QUOTE]++draw[ 1+ (randLotto.nextInt(35))];[/QUOTE] How large is the array "draw"? The max index into that array is the size - 1! What is the value of the index into that array: 1+ (randLotto.nextInt(35)) Is it less than the size of the array? What is that statement supposed to do? If you … | |
Re: [QUOTE]what should i do to make a reverse[/QUOTE] You need to come up with the algorithm/design to do this. Take a piece of paper and work out the steps you need to do to reverse the list. Or use a deck of cards laying out a few cards in a … | |
Re: Put a newline character ("\n") at the end of the part of the string where you want the following string to go on the next line. | |
Re: No idea if this will improve the speed. Here's some code that uses PixelGrabber to change colors: [CODE]// Fill a polygon starting at a clicked on point import java.awt.event.*; import java.awt.*; import javax.swing.*; import java.awt.image.*; import java.util.*; public class FillPolygon extends JPanel implements ActionListener { final int MaxLvl = 3000; … | |
Re: Sounds like an indexing problem. Try debugging your code by printing out the values of the indexes that you are using as they are set and changed. | |
Re: Sounds like you could have two definitions using the same name. One local and one global. You update the local one. The global one never changes. | |
Re: [QUOTE]two .dll files (in the root of the project) if they are removed project does not compile [/QUOTE] I know of no .dll files that are outside of the javac command files that would cause problems with a compile. Can you explain what the .dll files have to do with … | |
Re: Sorry, I missed your question? Or are you just showing us your code? | |
Re: [QUOTE]How can I stop a job if time is more than 60 seconds?[/QUOTE] Use a Timer to call a method in 60 seconds. | |
Re: For examples of GUI, do a Search for java files that extend the JFrame class. | |
Re: [QUOTE] it gives me errors[/QUOTE] Please copy and paste the full text of the errors here. | |
Re: Can you explain how your code works? Does it preserve its order as new nodes are added? Or can the user insert nodes anywhere and then call a sort method to sort the current list? [QUOTE]How to get it sort automatically everytime user entered a data?[/QUOTE] I don't see how … | |
Re: Can you show/post the input to and the output from your program? Have you studied arrays yet? What your code needs is an array to hold the values in as they are being read in. Once they are read in you can sort them and then print them. | |
Re: Hard to say without seeing the code. Be sure to use code tags (upper right icon) around your code. | |
![]() | Re: The IDE helps you write the app, but once the app is finished, the IDE goes away. I don't know how a particular IDE would change how you write your code. Of course I don't use an IDE so I can't tell you how to use it. If you have … |
Re: Looks like the compiler is really lost. Possible cause is mismatched {} or (). Does your IDE have a Find matching function? Put cursor on a { and it finds matching } Or do it manually. Print out the source and use a pen to circle matching pairs. | |
Re: Do Font's have colors? Or are you talking about what is drawn? | |
Re: [QUOTE]how can i make the program look for corresponding words[/QUOTE] Looks like you need to build an array of substrings of what is in the first line and check if any of them are in the second line. The longer ones being better matches. For example Given: i will go … | |
Re: [QUOTE]but the client just closes before the server [/QUOTE] have you tried debugging the code by adding println() statements to show where and what and why? What do you expect the code in the finally clause to do? And when? | |
Re: [QUOTE]how to gradually draw a line [/QUOTE] Sounds like you need a Timer to call repaint() with small incremental changes in where the line is to be drawn. The persistence of the line would be effected by drawing over/or redrawing the old line each time together with the extension for … | |
Re: Is this a java programming problem or a database usage problem? | |
Re: [QUOTE]it does not work[/QUOTE] When you have errors, please copy and paste the full text of the message here. It saves lots of time figuring out what [B]does not work[/B] | |
Re: Is your program an Applet or an application? An Applet requires a browser or Appletviewer to execute. An application needs the java command. In both cases you put the class files into a jar file for ease of handling. For the application to be executable without knowing which class to … | |
Re: [QUOTE]hat actually print like how i wanted?[/QUOTE] Can you explain "how I wanted"? The site at your link has code to generate Strings of XML and print them on the screen. Have you tried replacing the 'print to screen' method calls with classes and methods that will write the Strings … | |
Re: Are you looking to write the code or for a package that does it? The Graphics and Graphics2D classes have methods for drawing. You override a paint/paintComponent method and use a drawing method to create anything you want. | |
Re: What do you want the code to do differently? What does the API doc for text area say about the select() method? Are you assuming it is possible to select more than one area of text? | |
Re: Do you have an algorithm or design for how you want you program to work? Once you get that, we can help you when you having problems writing the program. | |
Re: JLabels don't normally get the focus. You're going to have to tell the system that it can get the focus. There's is/are method(s) to call to enable this. | |
Re: Have you read the API doc for the ConcurrentModificationException? Did any of that make sense? Are you using Swing components and threads in a way that could cause the error? There is a section in the Java Tutorial about how to update Swing components safely. Sorry, I don't have its … | |
Re: The friends variable only exists when there is an instance of the Test class created using new. The Names() method exists outside of any instance of the Test class. Either create an instance of the Test class and use object.variable syntax to access the variable Or remove static from Names() … | |
Re: [QUOTE] need help to get it working [/QUOTE] What is the program supposed to do? What does it do that you want changed? My crystal ball is broken again. | |
Re: [QUOTE]I should get 10.6842041GB (16.02630615GB total space needed). [/QUOTE] What do you get? You don't show what the program currently outputs. What is the program supposed to do? What is the relationship between: k, fps, min and seconds? I see that you are doing integer divisions. for example: gbyte = … | |
Re: [QUOTE]i/o usage of a process?[/QUOTE] That sounds like Operating System stuff. It would probably require native code. | |
Re: [QUOTE]i tried out bt not working[/QUOTE] Can you post what is NOT WORKING and show the errors or problems with it. | |
Re: [QUOTE]b1.addActionListener(this)[/QUOTE] This statement calls the addActionListener() method for the object b1. The reference to the action listener is saved in a list. Object b1 must be of class that can receive Action Events, like a key press. When that object b1 receives an Action Event, it looks in its list … | |
Re: What happens if you use more primitive write/read methods that write bytes and read bytes and build an image from those bytes vs using ImageIO? You'd have to send a header with the length of the image data. Or write a small self contained program that demos the problem and … | |
Re: [QUOTE]Is there other way to write a Menu code, not using Switch, or creating other Method[/QUOTE] Can you define what "Menu code" is? | |
Re: A lot of your arithmetic uses integers. integer division does not return real values. 1/3 = 0 or in English: 3 goes into 1 zero times. NO REMAINDER. No fractional part. Change the hardcoded integers to be real numbers. It would be better to define a CONSTANT to use in … | |
Re: [QUOTE]When I enter a respond for either one and press the yes button,nothing happens.[/QUOTE] Add some System.out.println(what is happening here) statements to the code to show what is happening at that point. | |
Re: What kind of hardware do you need to use this program? | |
Re: If you are able to compile the program, you must have the library with the classes needed. You need to make that library available at execution time so the java.exe program can find the missing class. | |
Re: [QUOTE]cannot find symbol symbol : variable Total[/QUOTE] The error message says it all: The compile can NOT find a definition for the variable: Total. | |
Re: Sounds like you need a mouse listener to detect the click and call a method to do what you want. | |
Re: [QUOTE]I need more of a global save[/QUOTE] That implies that you need a server to save the scores for all the users. | |
Re: Sounds like an exercise for indexOf() - find the string in the source, and build a new source: "everything up to where found" + <tag> + foundString + </tag> + "everything after the end of the found string" | |
Re: Do you have a design for the program yet? Think like a computer and write down the steps one by one that you must do to solve this problem. For resources: you'll need to use the Random class to generate numbers from 1 to 6. Use: System.out.println("the message you want … |
The End.