1,034 Posted Topics
Re: Of course there is, and there is many ways of doing this. [Code] x = 5; /loop //parse a string entered by a user if (inputedNumber < x || inputedNumber > x) { //inputedNumber = aNewValue } //end loop [/Code] | |
Re: I'm not sure I understand completely...So correct me if I'm wrong, when the user enters a specific key, such as "friends", you want to "spit" out the array corresponding to that array. | |
I plan on writing an app that will graph polynomial expressions. My question is, what should I draw the graph on? Should I just use the regular frame and use DrawLine(), or is there something like a bitmap, or canvas thing I should use? | |
Re: Hope you don't mind me suggesting one, but this tutorial worked great for me...It's a little old, but very good. [url]http://chortle.ccsu.ctstateu.edu/CS151/cs151java.html[/url] | |
Re: I rewrote it, but you really need to work on your conventions: indenting, and naming. [Code] import java.io.*; public class Slope { public static void main(String args [ ]) { double y2, y1, x2, x1; y2 =0; y1 =0; x2 =0; x1 =0; BufferedReader reader = new BufferedReader(new InputStreamReader(System.in)); try … | |
Re: I don't think you can use the break statement in for loops. I guess you would have to set the count variable to something greater than the ending condition in the loop, that way it won't loop anymore. [Code] for int(i=0; i<10; i++) { if (i=2) { i = 11; … | |
Re: I think there is some method that takes an image, and creates an array of pixels out of it: I think it's something like this: [Code] int x = getPixels(Image); [/Code] | |
Re: [QUOTE=Ceaser] It is a possibility that you formated over the Linux partition. [/QUOTE] This is most likely what's happend unless maybe you used something like partition magic to partition. This can sometimes cause it to boot directly into one OS and ignore the other. | |
Re: I'll help you with the System.outs to get rid of the bulk of the problem, but I am very sick right now, or else I would help you fix all of it. System.out.print("Cannot find specified item -" ' + item + '); should be something like this" System.out.print("Cannot find specified … | |
Re: are you wanting to add it to the textfield? If so, all you have to do is create a document from the textfield.. import these: [Code] import javax.swing.undo.*; import javax.swing.event.*; import javax.swing.text.*; [/Code] add an UndoableEditListener create an UndoManager as an instance variable create a Document as an instance variable … | |
For the AP Comp. Sci. exam, we have to read 150 pages on this stupid program, and my teacher is wanting us to read the teacher's manual of it on the side..Which is another 130 pages...Now, I have heard that the questions on that case study makes up less than … | |
Re: Of course, as long as you import the right statements. | |
I have a JMenu with some radio buttons...For some reason, when I click the stupid things, they won't do anything...and by that, I mean they want change their state to being clicked(as in the circle being filled)..It's like they are disabled...I'll post the snippets of code with them in it: … | |
Let's say I have two classes, Class1, and Class2..... Class2 creates and instance of Class1 and calls one of it's methods like this: [Code] Class 2 { Class1 c1 =new Class1(); c1.myMethod(); } [/Code] Now, that would work...But, could you have just the class variable instead of the class instance … | |
Re: [Code] drawOval(int x, int y, int width, int height) [/Code] Just use threads to increment the x and y value position at certain intervals. | |
Re: I think you would run into accesibilty issues there. I don't think applet are allowed to do that. | |
Re: You can always set the foreground or background color of your panel or content pane...Or I think you could create a Font object. | |
I have the datasoure and drivers set up, but for some reason this code is not updating the database. [Code] import java.sql.*; public class TestCreateCoffeeTable { public TestCreateCoffeeTable() { } public static void main(String[] args) { try { String createStatement; Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); String dataSource = "jdbc:odbc:Coffeebreak"; Connection con = DriverManager.getConnection(dataSource); Statement … | |
Re: I wonder if this would work: Create one array with all the values you need, then create a gridlayout with the certain number of rows and columns you need and then append them to the container set to the grid layout | |
Re: You WON'T understand certain concept untill your very experienced with java. Polymorphism, inheritance, and other concepts like that aren't very difficult, but you just want grasp it starting out. I wouldn't even waste too much time looking at it, untill you have a good understanding of java, then it is … | |
I'm curious as to how many of you routinely use jdk 1.5 tigers added features, methods, api's and whatever. Or, do you just stick to 1.4? | |
Re: If you don't have to use the 'if' way, you could always throw them in an array and sort them int[] nums = {a,b,c,d,e}; Arrays.sort(nums); int x = nums.length; System.out.println(nums[0] + " " + nums[x]); | |
Re: I don't recall anything like that. I would either leave them, or remove them manually. | |
Re: hmm. If I remember right, java doesn't support those file extensions. I think it supports weird ones like au, aiff, and stuff like that. But, I do think it supports .wav files. Maybe someone will correct me if I'm wrong | |
I know how to find a directory if I know the full path name of the directory I'm searching for..But, let's say I only know the directory name, and not the full path name..How can I find that directory on a users system? Is there some recursive function or looping … | |
Re: If you use an ArraList like jwenting suggested, you can use: [Code] Collections.sort(ArrayList); [/Code] You might could use that on a vector, but I doubt it. Never tried. Also, isn't there some way to use the comparator interface to sort? | |
Re: Im curious, why do you create an instance of the class in each method? [Code] CurrencyConv2 a1 = new CurrencyConv2(); [/Code] | |
Re: [Code] int a = 5; int b = 7; if (a > b) { b += 1; } else { b -= 1; } [/Code] Is this what your talking about? | |
Re: you forgot the main method: public static void main(String[] args) { } | |
Is it possible to update your programs information from other websites? I mean if you have like a stock program or currency program, the data changes everyday. So can you recieve updates from websites, and change this info? If so could you point me to a site that explains how, … | |
Re: I noticed that you didn't have an instance of the ArrayUtilities class in your first project. I don't have a jdk on this computer so I can't test it or I would. But to me that looks like the problem. You could do something like this: ArrayUtilities ar = new … | |
Does anyone know how you could process an equation, or even get an equation with more than two operands? Right now, in my calculator, I can only have two operands, and I want to have more. Right here is what I have: [Code] import java.awt.*; import java.awt.event.*; import javax.swing.*; public … | |
Re: [QUOTE=freesoft_2000]Hi everyone, You can try to google for them or you can try sun's official website. They have some pretty good tutorials over there Richard West[/QUOTE] Sun's website has some really good tutorials, but the website is huge and hard to sort through at times. Note: I'm not good at … | |
Re: I wonder if you'll have to do any bit shifting. hmm. I'll have to do some searching and see what I can find. I know I did this in vb.net(except I took regular numbers), but I can't remember the formula. I'll get back to ya. | |
Re: What's the scanf function? I'm not familar with C++.. | |
Re: [QUOTE=freesoft_2000] PS: Don't be bothered about what narue said, some people simple refuse to help others out but when they need help they expect others to help them out. [/QUOTE] I've seen it many times on here. You would think that some people would realize there is no need for … | |
I have this simple calculator I just started on, and I'm having just a few problems. First of all, I don't know how to append text to a textfield. Maybe I would have to create a string buffere or something. Then, when the user clicks one of the buttons, the … | |
I've been trying to do this for weeks now, and can't seem to get it to work. I have a JTextPane called textArea2, and I have a variable called doc that gets the document from the textpane. I want to get the selected text but I can't get no code … | |
Re: 1. I've never done this so I'm not too clear on this. I think you have to set some kind of system property and then you can get properties of the console, and use escape sequences to clear console. public class Hello { public static void main(String[] args) { System.out.println("Hello"); … | |
Does anyone know if I can use my linksys wireless g card on the linux platform? I don't see any linux files on my setup cd, nor is there any initial downloads for it that I know of. | |
Re: You said none of the images were printing, how are you reading the file? I don't know if this will have anything to do with it, but it might :cheesy: | |
Re: Run the network setup wizard on both computers. At least this is what I did, it's very easy, and it worked for me. | |
Re: Do you have a java enabled browser? And it might be helpful to post your code to make sure there is no errors in it. | |
Re: that one class was not needed: [Code] import java.io.*; public class search { String str; int key,size,seaArr[]; public void getdata() { System.out.print("Enter how many data you want to enter : "); System.out.flush(); try{ BufferedReader obj=new BufferedReader(new InputStreamReader(System.in)); str=obj.readLine(); size=Integer.parseInt(str); seaArr=new int[size]; for(int i=0;i<size;i++) { System.out.print("Enter element at "+(i+1)+"th position : … | |
| |
I need to get the position in a JTextArea...Anyone know how to do this? | |
I have this code that is suppose to append text to a JTextPane, using the Document method insertString(). I can't seem to get the attribute argument right, so maybe one of you can point me in the right direction... Here is the one line of code giving me problems, just … | |
I have a method that counts the number of words in a JTextArea. It works pretty good, except for the fact it counts characters that's not letters as words(such as "!@#$" would be a word)... Here is the code that I have got so far(no erros, compiles and runs fine, … | |
I made a text editor with very basic funtionalities. I wrote it all in one class because I really wasn't sure what to put into other classes. Right now the code is pretty messy and I want to rewrite it. I was wondering if anyone could give me some input … |
The End.