Forum: Java 24 Days Ago |
| Replies: 3 Views: 245 |
Forum: Java 25 Days Ago |
| Replies: 3 Views: 245 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... |
Forum: Java 31 Days Ago |
| Replies: 10 Views: 782 you did not understand?
It gives a good example.
I think the first perfect integer is 6 because positive proper divisors are 1 2 3 and 1+2+3 = 6.
12 is not perfect cause 1+2+3+4+6 = 16 > 12... |
Forum: Java 31 Days Ago |
| Replies: 7 Views: 2,617 sorry I found my answer.
Desktop.open(File) does this task perfect. |
Forum: Java 31 Days Ago |
| Replies: 7 Views: 2,617 Isnt there a way like java Desktop API, it can browse with default browser, cant it open a directory? |
Forum: Java 33 Days Ago |
| Replies: 3 Views: 199 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... |
Forum: Java 33 Days Ago |
| Replies: 1 Views: 186 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... |
Forum: Java 34 Days Ago |
| Replies: 1 Views: 215 |
Forum: Java Nov 8th, 2009 |
| Replies: 4 Views: 256 public class Server {
public static void main(String[] args) throws IOException {
ServerSocket serverSocket = null;
boolean listening = true;
// start the stdinReader... |
Forum: Java Nov 8th, 2009 |
| Replies: 4 Views: 256 Your approach is right. On server side, before starting the server-client mechanism, first start your stdInReaderThread. Its up to you what to do when you get "q". You can just close the server.... |
Forum: Java Nov 7th, 2009 |
| Replies: 4 Views: 256 with
join();
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.
... |
Forum: Java Nov 7th, 2009 |
| Replies: 5 Views: 349 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... |
Forum: Java Jun 23rd, 2009 |
| Replies: 4 Views: 1,717 ................
private Socket client;
private BufferedInputStream input;
private PrintWriter output;
byte[] buffer = new byte[4096];
...............
client = new... |
Forum: Java Jun 22nd, 2009 |
| Replies: 4 Views: 1,717 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]... |
Forum: Java Nov 12th, 2008 |
| Replies: 8 Views: 572 ok,now I see it,
thanks... |
Forum: Java Nov 11th, 2008 |
| Replies: 8 Views: 572 What exactly does this mean? |
Forum: Java Nov 11th, 2008 |
| Replies: 8 Views: 572 I understand what you want to tell. Waiting a valid input file may be a good choice.
But, if I don't want to give that right to the user, I mean user has to enter a valid filename at his first... |
Forum: Java Nov 11th, 2008 |
| Replies: 8 Views: 572 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... |
Forum: C++ Oct 28th, 2008 |
| Replies: 8 Views: 1,273 it seems interesting...does it require to include any third party header files? |
Forum: C++ Oct 24th, 2008 |
| Replies: 8 Views: 1,273 What I mean was using new and delete.
anyway, I learned the solution:local pointers should be handled before going out of scope.
:) |
Forum: C++ Oct 24th, 2008 |
| Replies: 8 Views: 1,273 Hi,
assuming that Element is a class,I prefer to create an array of objects size of which is unknown in this way:
Element *elementArray = new Element[length];
Is there another way to create an... |
Forum: C++ Oct 24th, 2008 |
| Replies: 3 Views: 437 you already have a dequeue function
why not use such a loop
while(!isempty())
{
dequeue();
} |
Forum: Java Oct 15th, 2008 |
| Replies: 12 Views: 3,133 thank you very much,I will try Jlabels... |
Forum: Java Oct 15th, 2008 |
| Replies: 12 Views: 3,133 now,I found the problem,its not about the overriden method!
now there is something new,
You suggested me to use Jlabels ,but I used drawRectangle to draw nodes.Can these nodes(shapes) be... |
Forum: Java Oct 15th, 2008 |
| Replies: 12 Views: 3,133 Is there any way for panel to draw without overriding paintComponent method?Can I put my method just in Jpanel and then call it? |
Forum: Java Oct 15th, 2008 |
| Replies: 12 Views: 3,133 no,of course I put my drawing function in paintComponent! but it doesnt show anything!
As far as I see,there is no probelm with Jpanel or Jframe,maybe my drawing method in overriden paintComponent... |
Forum: Java Oct 15th, 2008 |
| Replies: 12 Views: 3,133 I have created a JFrame frame and a Jpanel panel,
then I added the panel to frame.
I have overriden paintComponent method in my panel.
Now,do I have to call paintComponent method on Jpanel... |
Forum: Java Oct 14th, 2008 |
| Replies: 12 Views: 3,133 |
Forum: Java Oct 14th, 2008 |
| Replies: 12 Views: 3,133 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... |
Forum: Java Oct 12th, 2008 |
| Replies: 4 Views: 2,257 |
Forum: Java Oct 12th, 2008 |
| Replies: 4 Views: 2,257 thanks,this approach seems simpler than class hierarchy equivalent of union in C. |
Forum: Java Oct 12th, 2008 |
| Replies: 4 Views: 2,257 a generalized list structure can be declared in C as follows:
typedef struct element{
bool sign;
union{
char data;
element* link;
};
... |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 oh,I found where I was wrong
these member functions cant be const ,right?
ifstream& FileHandler::getFileIn(){
return fileIn;
}
ofstream& FileHandler::getFileOut()
{ |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 .
.
private:
string fileName;
ifstream fileIn;
ofstream fileOut;
.
.
ifstream& FileHandler::getFileIn()const{ |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 no,as you see its not local varable,its class member,how can I do that? |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 class FileHandler
{
public:
FileHandler(const string &);
~FileHandler();
string getFileName()const;
void setFileName(const string &);
ifstream& getFileIn()const;
ofstream&... |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 and sorry but this gives error too
ifstream& FileHandler::getFileIn()const{
return fileIn;
}
compile error:
invalid initialization of reference of type 'std::ofstream&' from expression of... |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 yeah I tried it and it gives no compiling error
but when I want use it in such a loop
string line;
while(getline(pFileHandlerObj->getFileIn(),line)){
} |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 #ifndef FILEHANDLER_H_
#define FILEHANDLER_H_
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class FileHandler |
Forum: C++ Oct 11th, 2008 |
| Replies: 11 Views: 1,535 I want to do somthing like this.
ifstream My_File::GetFile_Stream() const
{
return(this->Input_Stream);
}
where Input_Stream is a private member of the class My_File and is declared as... |