Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

Yogvinder Singh Ghotra

Ranch Hand
+ Follow
since Sep 10, 2007
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 Yogvinder Singh Ghotra

i am in India. I don't think they deliver in India.
Hi Guyzz,

Where from to get the R M H book?
Which of paint or paintComponent is called?
11 years ago
What is happening is that ... I connect to a database... when i first connect to the database whatever is there in the Main panel is removed and added again (based on database values). however the newly added items may or may not be same.

when this happends overridden paint and repaint are not getting called instead i am calling overridden update method().
11 years ago
In the Main JPanel i have overridden paint and repaint methods and both are calling their respective super methods.
11 years ago
Hi,

I have a Swing Application the secription of which is as following :

The Frame contains Menu Bar and a JPanel(Main) only

JPanel itself has another JPanel(search) plus other Graphic 2D images like ellipse etc

the ellipses and connections between them are drawn based on some database values.

Main JPanel overrides paint, update methods.

Since the ellipse are based on database values any changes to these require updation to database and due to same .. all the components of main JPanel are removed and redrawn.

However due to this the Menu bar items become garbled i.e the search Jpanel starts showing at its location as well as above the menu items.

Please help .
11 years ago
Hi, Cleared the SCJP5.0 yesterday with 91%. What you preparing for now?
Saurabh, Are you sure no of options will be known in advance?
What's your profile currently?
binary numeric promotion.


If T is broader than int, both operands are converted to T; otherwise, both operands are converted to int.
do take some mock exams and work on simulators. Self study is enough but practice is very important.
I don't think so. If it will come, it will be a compilation error for sure.
Hi.. Swati..

Please go through the tutorial
http://java.boot.by/scjp-tiger/ch06s04.html

Here in java ranch, You can rad the thread
https://coderanch.com/t/265228/java-programmer-SCJP/certification/Generic-methods-wildcards

Hope this will help. If not, do tell me.
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

public class EqualsHashcode {

public static void main(String... args){
final int x = 4;


Set<SortOf> set= new HashSet<SortOf>();
SortOf t = new SortOf(2,"abc", (short) x);
SortOf t1 = new SortOf(1,"abc", (short) (x + 4));
set.add(t);
set.add(t1);

ArrayList <? super SortOf> a = new ArrayList<SortOf>();
add(a);
System.out.println(set.size());
}

public static void add(List <? super SortOf> a){
a.add(new Object());
// Compile Time Error
}
}

class SortOf {
String name;

int bal;

String code;

short rate;

SortOf(int bal,String code, short rate){
this.bal = bal;
this.code = code;
this.rate = rate;
}

public int hashcode() {
return (code.length() * bal);
}

public boolean equals(Object o) {
return ((SortOf) o).code.length() * ((SortOf) o).bal
* ((SortOf) o).rate == this.code.length() * this.bal
* this.rate;
}
}

Can anyone explain this behavior? // Compile Time Error why is it coming??
[ September 19, 2007: Message edited by: Yogvinder Singh Ghotra ]
okie..i got it... Anyway.. You have a Happy hunting..time
12 years ago