Shashank Gokhale

Ranch Hand
+ Follow
since Jan 07, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Shashank Gokhale

@Paul,

Hmm, okay.  Ill have to try it out again.  But then if it is possible to put any statement in a try block, then why isnt this the default, that is why not put everything in a gigantic try block
4 years ago
As far as I understand, the join method lets the compiler knows that it should let the specified thread finish completion and then join the other threads.  So, question is does join put all other threads in a sleep state or a wait state.  As I understand it, sleep is a modal state, that is it causes execution to pause completely, that is all threads are paused until the lock is released.  Wait is a method that is not modal, it does not stop execution of other threads.  Am I right?

Also, what is the difference between setting .join on a thread, and setting the priorities on all the threads so that the priority of the thread which should be executed to completion first is set higher than the priories of the other threads?  Say there are 3 threads, t1, t2 and t3.  Wouldn't both ways t1.join() vs t1.setPriority(10); t2.setPriority(2); and t3.setPriority(2); cause t1 to execute first, and then let t2 and t3 start after t1 has completed?  
4 years ago
have a question on Exceptions.  When we put a statement or group of statements in a try =/catch block, we do so because we know that there is a certain value where the statement will fail.  But what if we don't know that a statement can fail, but just want to provide a try/catch block just in case, why is that not possible?  For example, why cant we put a statement like a = b * 2; in a try/catch block.


What is the advance of using specific exceptions like ArithmeticException vs the catchall Exception
4 years ago
I got it to work actually.  The problem was, and I dont know why, that I was naming my points A,B,C,D, and I named them as such in the xml file.  The issue was that Eclipse, when generating the getter and setter methods, especially the setter method was passing in lowercase d even though I had used D when declaring the Point D property.  And because the objects are case sensitive, I was getting the null pointer exception
6 years ago
Ive been following a tutorial on youtube and Im upto the point where we start using autowire.  But the program throws a nullpointerexception and the member variables dont get the proper values.  Im including the code so please let me know whats going on

This is the main program "Drawing.java"


My triangle classs "Triangle.java"


The Point class "Point.java"


and finally the xml file "Spring1.xml"


If I remove the autowire tag and include the property statements, then the application works, but if add in the autowire and delete the property statements, then the application gives a null pointer exception in Triangle class at line 54 (where it is supposed to prints the coordinates of point A" and also in the Drawing class at line 11 where the draw method is called.  Whats going on, why is it not working?
6 years ago
I have over 7 years of Java Development, mostly working with Java SE running my own consulting company developing GUI applications for end users.  I now want to start working with a company.  So, do any of you have any tips on what are the techniques that are successful when looking for a java job?
7 years ago
[Okaiy, I have just listed the methods that are supposed to make the jtable show the correct info, but the jtable isnt showing the right info.  When I modif the sql table through code, the sql table is changed, but then to display the latest table, I need to read from the table and add rows to the jatable.  But for some reason, its not working that way, Ive got a for loop in the first method (the insert method) that removes all the rows and then I call the display method to read and display the table, but its not working.  And I dont know why


>
7 years ago
Ya, it is a lot of code, basically I pasteed everything that was generated by Netbeans and stuff, but basically the thing is that when I have an sql table, and I modify the table, I want to find a way of displaying the updated table each time in the jtable.  Should I delete all rows of the jtable by setting setRowCount to 0, and then repopulating or is there a better way
7 years ago
okay i think Ive got that figured out.  The rows that were aready present in the jTable were the ones showing up, and while the populated rows were being added, they were outside the lower boundary of the JTable, and so I couldnt see them.  So basically I deleted the empty rows that were in the JTable component.  But I cant get the insert, update or delete buttons to make changes to the Table, at least i dont see any changes
7 years ago
Ya, I realized I didnt call all the methods I should.  Anyways here is  a new piece of code, and Ive called all the right methods in the constructor.  When I run the program, yes the JFrame is displayed but the data that is read from the database does not get get listed in the jtable.  The data is properly put into the set of row objects, as I used a system.out.println statement to find out.  So Im thinking that for some reason the table.addRow(row) is not displaying the data to the jtable.  Or is there something else Im missing

7 years ago
I have written the following code and I cannot for the life of me figure out what is going wrong.  When I run the program, nothing happens but when I exit the GUI, the data is writtencorrectly  via System.out.println to my netbeans console.  Please tell me what Im doing wrong

7 years ago
Im just trying to follow along step by step from some examples of double buffering on the web, I am sure there is another way, but I need to know everything from the ground up. So I still need answers to whats happening in the code.
9 years ago


I get the concept of double buffering, but there are a few questions.
1) Does the line Dimension d=size() get the dimensions of the entire screen or a JFrame?
2) From what I understand, the line offscreen = createImage(d.width, d.height) creates a blank image with the given dimensions. Am I correct?
3) Does offgc=offscreen.getGraphics() basically say that now we are going to access the graphics context of the image created by the previous line of code. So whenever anything is then drawn, this line causes the drawing to be made on the created image. Is this correct?
4) The lines offgc.fillRect(...), draws to that context, meaning on the created image. Correct?
5) What does paint(offgc) do, if the lines above it do the drawing?
5) drawImage then draws the secondary image back to the onscreen Image, correct?

So if Im understanding the whole process, what is happening is that new images replace the previous onscreen images each time that the update method is called, correct? So, nothing is being erased, the images on the screen are replaced with the images that have been create with createImage(), correct?
9 years ago
chris,

Yes they are checked. Is it possible that when Eclipse installed, the Javadocs or whatever is required did not install at the same time?
9 years ago
paul chapman:

you're right!! I just had to move the getHeight() and getWidth() statements after the setVisible(true).
I thought initially that I could write the statements in any order, because if I wrote

setVisible(true);
setSize(100,200);

the frame still showed up with dimensions 100,200 even though the setSize was written after the setVisible.

Rico: thanks for the link


I am currently using Eclipse to write java code. But when I hover the mouse over any of the method names or keywords, I dont get a popup showing what that method or keyword does. I know Im supposed to so is there a way to inlude that documentation?

9 years ago