- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 10
- Posts with Upvotes
- 9
- Upvoting Members
- 7
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
48 Posted Topics
Re: I dont know what the problem is, but instead dataInputStream and dataOutputStream, you can try BufferedInputStream and PrintWriter which I always use in socket programming in java. And a byte[4096] buffer maybe better. | |
Re: [QUOTE=Ezzaral;802897]If you mean you want to open it for general browsing in the OS (with Explorer for example), you'll have to use Runtime.exec() or ProcessBuilder for that.[/QUOTE] Isnt there a way like java Desktop API, it can browse with default browser, cant it open a directory? | |
Re: [QUOTE=alreem;1053790]Can any one help me with this exercise . . ! I did not understnd it . ? [B] A number is called a proper divisor of N if M < N and M divides N. A positive integer is called perfect if it is the sum of its positive … | |
Hello, I am trying to write a simple javascript to read all forms. My ReadForm function works right. I tried it out of ReadAllForms function, there is no problem with it. I think document.getElementsByTagName returns false. Why can this happen? [CODE=javascript] function ReadAllForms() { if (document.getElementsByTagName) var myforms = document.getElementsByTagName("form"); … | |
Re: I think you want to get the index to be able to remove the InfoObject from the Arraylist list. You can do it without an index. You can directly pass the object to remove method. [CODE=java] InfoObject info1 = new InfoObject(); InfoObject info2 = new InfoObject(); ArrayList<InfoObject> list = new … | |
Re: JTextComponent class has a method: [ICODE]setDisabledTextColor(Color).[/ICODE] it will work for subclasses JTextField, JTextArea...,etc ... So, you can use this method with the components inherited from JTextComponent in your Calendar or whatever. | |
Re: its hard to tell what the problem is. Maybe its because of your eclipse installation or another problem. If you try to create your jar file by yourself rather than exporting in eclipse, you can better understand the problem. [URL="http://java.sun.com/docs/books/tutorial/deployment/jar/index.html"]http://java.sun.com/docs/books/tutorial/deployment/jar/index.html[/URL] | |
Re: you may need to call validate() and repaint() methods on the component where your button resides. | |
Re: You set these fields non-editable. [CODE=java] tRadius.setEditable(false); tCirc.setEditable(false); tDiameter.setEditable(false); tArea.setEditable(false); [/CODE] But then you try to get the values from these fields. [CODE=java] radius = Double.parseDouble(tRadius.getText()); circ = Double.parseDouble(tCirc.getText()); diameter = Double.parseDouble(tDiameter.getText()); area = Double.parseDouble(tArea.getText()); [/CODE] I think you use these fields for showing output, thus you made them non-editable. … | |
Re: [QUOTE=Dizzzy;1153596] Also is there a way of restricting the value being input to only being a number and not negative?[/QUOTE] [URL="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/InputVerifier.html"]http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/InputVerifier.html[/URL] | |
Re: yes you can. and its also better for you if you build it upon your previous work. | |
Re: your should create your comparator class by implementing Comparator Interface. Once you do it, then you can create your hashtable as follows: [code=java] private Hashtable<String, Planes> planesFlying = new Hashtable<String, Planes>(new YourMapComparator()); [/code] something similar to this. | |
Re: [CODE=Cpp] #include "stdafx.h" #include <iostream> using namespace std; int doubleNumber(int x) { return 2 * x; } int main() { cout << "Number to double: " << endl; cin >> x; cout << "Doubled number: " << doublenumber(x) << endl; return 0; } [/CODE] | |
Re: please post your code using code tags. | |
Re: Well, firstly you dont need the arbitrary 11 or whatever. You just need to calculate both ends. If you subtract paddingY(paddingX) from width(length), you only handle one end. So you should subtract paddingY*2 (paddingX*2) to make the paddings equal on each side. For your second problem, if you use getHeight() … | |
Re: because the answer does not read y, it reads a whitespace character from the last read line, then it doesnt read the "y" entered. Change the following portion as this: [code=JAVA] if (w == 1) { System.out.println("X is wins!"); t.resetGame(); scan.nextLine(); System.out.println("Do you want to play? y(yes) or n(no): "); … | |
![]() | Re: whats the problem? this code already prints an isosceles triangle? ![]() |
Re: [code=JAVA] int c = System.in.read(); System.out.println("You pressed the key " + (char)c + " whose ascii value is " + c); [/code] | |
Re: I implemented tihs algorithm before. My approach was different. anyway, just wonder why readEdges method has a parameter M[][]? | |
Re: so much netbeans code... anyway, you use repaint() and validate(). While you use the re-paint, why not use re-validate? | |
Re: no. this is what java.sun.com says: [B]A switch works with the byte, short, char, and int primitive data types. It also works with enumerated types (discussed in Classes and Inheritance) and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Integer.[/B] If you use static strings … | |
Re: You are using StringTokenizer to split the words. Thats ok. But why are you using it to count the vowels? It doesn't give the right result, because it ignores adjacent wovels and counts them as one. You have to make a comparison char by char. [code=java] import java.util.*; import java.io.*; … | |
Re: there is already a built in mechanism that does what you want to do. its tooltip. String text = "blablahblah"; yourButton.settooltiptext(text); thats it, when the mouse hovers on it, the tooltip appears. | |
Hello everyone, This piece of C# code does not produce any overflow exception. wordsize is a constant equal to 32. the x and y can be very big at the computation time. So big that long or decimal even cant hold. But C# handles the problem even the value of … | |
[code=c] #include <stdio.h> int main() { char name[50]; printf("enter your name:"); gets(name); puts(name); return 0; } [/code] hello, the above program should first print out "enter your name:", but it does not. it occurs in this way on the console: --------------------------- abc enter your name:abc --------------------------- it prints "enter your … | |
Re: have you noticed that the [CODE=java]else days = 30;[/CODE] statement always runs. you should use [CODE=java]break [/CODE]statement after every [CODE=java]if [/CODE]control. in fact, its better if you use [CODE=java]switch [/CODE]statement. | |
Re: Firstly, I think you should obey java naming convention and indention rules. I didnt exactly understand your design but I can tell you why you will have to resize. Its because you use paint() method. The frame calles this method whenever the frame resizes. | |
Re: if its takes a few seconds, I assume you are using a Thread for that process. Or are you just leaving it to normal program flow?? If its the former, there are useful built-in methods to prevent duplicate runnings. If its the latter, its the wrong way. | |
Re: I think when button clicked, a long process is started in your application and you dont want to get any clicks until it is finished? Why dont you disable the button as soon as it clicked and re-enable it when the process finished. | |
Re: Related to posting thread, have you heard about CODE TAGS? Also can you please write a few sentences telling what you need and what you are trying to do. Related to your problem, have you heard about DEBUGGING? What do you think the following line does?? [icode]Input = Temp;[/icode] | |
Re: [QUOTE=begforcode;1049974][COLOR="Green"]Hello I'm new to Java. I wanted to make a card game in which i want to overlap those cards. I just want to know how to overlap cards, like "solitaire" or "hearts" card games. Kindly help... I'll be grateful.[/COLOR][/QUOTE] Use JLayeredPane. [URL="http://www.google.com.tr/url?sa=t&source=web&ct=res&cd=1&ved=0CAkQFjAA&url=http%3A%2F%2Fjava.sun.com%2Fdocs%2Fbooks%2Ftutorial%2Fuiswing%2Fcomponents%2Flayeredpane.html&ei=K4kCS829DMOe_gbh29VJ&usg=AFQjCNEn18WWpxHFjHHjkfwPAvAfniIX3A&sig2=6ZNS55mW-hmf_5aNY3Sdiw"]http://www.google.com.tr/url?sa=t&source=web&ct=res&cd=1&ved=0CAkQFjAA&url=http%3A%2F%2Fjava.sun.com%2Fdocs%2Fbooks%2Ftutorial%2Fuiswing%2Fcomponents%2Flayeredpane.html&ei=K4kCS829DMOe_gbh29VJ&usg=AFQjCNEn18WWpxHFjHHjkfwPAvAfniIX3A&sig2=6ZNS55mW-hmf_5aNY3Sdiw[/URL] | |
Re: with [code=java] join(); [/code] if you keep all the threads you created in an array,vector... then you can call join() on all threads to kill them all...Of course, this will cause all threads to be done. If you mean stopping server imediately, then just close the server... server.close(); | |
Re: As the previous poster said, use a boolean for first click, also increment your counter in mousePressed. If you increment it in paintComonent, counter will be incremented everytime the frame is repainted. For example when you resize your frame, your counter dramatically changes. This is the fixed code. [code=java] import … | |
As far as I know, exceptions that are not subclasses of runtime exception or error should be caught (handled). When a file exception occurs, it should be caught because its a subclass of exception class, but how can it be recovered? If file is not found,it sounds silly to recover … | |
Hi, assuming that Element is a class,I prefer to create an array of objects size of which is unknown in this way: [icode]Element *elementArray = new Element[length];[/icode] Is there another way to create an array of objects size of which is unknown without using new key(without malloc too)? I am … | |
Re: you already have a dequeue function why not use such a loop [code=C++] while(!isempty()) { dequeue(); } [/code] | |
I want to draw a tree in Jframe, the tree view is available in the attachment, As you see there are nodes connecting to each other.I know that I have to find the midpoint of the nodes at the same level or things like that. What I want your help … | |
a generalized list structure can be declared in C as follows: [code=C++] typedef struct element{ bool sign; union{ char data; element* link; }; element* link; } [/code] as you see in this approach an element can have either "data" or "element* link"(the last link is included in every element) and … | |
I want to do somthing like this. [code=C++] ifstream My_File::GetFile_Stream() const { return(this->Input_Stream); } [/code] where Input_Stream is a private member of the class My_File and is declared as follows: ifstream Input_Stream; When I compile I get the following errors: /usr/include/c++/3.3.1/bits/ios_base.h: In copy constructor ` std::basic_ios<char, std::char_traits<char> >::basic_ios(const std::basic_ios<char, std::char_traits<char> … | |
[code=C++] while(cin >> par1 >> par2 >> par3){ // get inputs cout << par1 << par2 << par3 << endl; [/code] I want to read three inputs with cin,as long as three inputs exist,the loop works good. But if the user enters two inputs,this time it waits for the next … | |
Re: change the line `cin >> n >>endl;` as `cin >> n;` cin can work like this `cin >> param1 >> param2 >> param3;` I think it's obvious that you cannot use endl with cin... | |
Re: [QUOTE=iamthwee;703303]Avoid using [icode]eof[/icode] to control file i/o:[/QUOTE] why is that? | |
hello,I would like to create a class for basic file operations-just reading and writing a line.There seems no error in my program but it doesn't output anything.I think there is a problem with the functions for reading and writing.Please help... [code=C++] #ifndef HANDLER_H_ #define HANDLER_H_ #include <iostream> #include <fstream> #include … | |
I want to create a class for I/O operations. This class take filename as parameter and then provides functions to write and read from file. I had to include two different fstream objects,one for input and one for output ,so I designed such an implementation.If you can see a better … |
The End.