Chinmay Kant

Greenhorn
+ Follow
since Feb 04, 2008
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 Chinmay Kant

Hi All,

I am great follower and admirer of Java ranch.
Can i Help Java Ranch Office in development or maintenance work??
if yes, how ??
I am an experienced Java programmer having 3.5 years of Java Work exp.
i would like to know if I can help java ranch

Thanks,
Chinmay Kant
13 years ago
Yes I am talking of Sliders only.

Currently, in My Scroll Pane, i have a panel on which a image is shown.

The vertical slider for this image should by default be at bottom of scroll pane
which currently is coming at the top of scroll pane.
14 years ago
Hi,

Is there any way to bring the a Vertical Scroll Bars of the Scroll Pane at the Bottom by default???

My problem is that I need to have a vertical scroll bar not at top but at the bottom of the Pane by default i.e when window is created.
Currently the scroll bar is at top.

Thanks in advance !!!

14 years ago
I have a text field which will have only Integer (positive and negative values). So,I am using JFormattedtextField as shown below:-

The getFormatter(0 method is as follows:-

This makes me only type 0 to 9 and - sign iniside the text box.
My Problem:-
I have already a neagtive value like "-1222" inside the text field
[Now using if a set a value which is positive i.e "1234"
then after that i see the result as "-1234"
Here though my value was positive, it did not remove the negative sign
What could be the problem not getting???
Is my formatter wrong??


14 years ago

Originally posted by sri dev:
class Foo
{
public void doFooStuff()
{
System.out.println("All Foo stuff");
}
}

class Bar extends Foo
{
public void doBarStuff()
{
System.out.println("All Bar Stuff Baby!");
}
}

class TestFooBar
{
public static void main(String[] args)
{
Foo f=new Bar(); //legal as bar is the subclass of foo
f.doBarStuff();

}
}

The above Foo and Bar classes have compiled but the "TestFooBar" class is not compiling and showing the following error , what can be the error?


TestFooBar.java:8: cannot find
symbol : method doBarStuff()
location: class Foo
f.doBarStuff();
^
1 error




Here overriding the doBarStuff method is not done.
Though the object created is of Bar type but it is referenced
as Foo type. So, it will not have knowledge of the
method doBarStuff
Guide Me on How many Objects are created??
--code
------------------------------
public String mkstrings()
{
String s = "fred";
s = s + 47;
s = s.substring(2,5);
s = s.toUppercase();
return s.toString();
}
-------------------------------
How many String Objects are created when the Method is invoked
-----------------------------------------


I think there are 6 Objects created but the Ans says 3
Hi,

I have 1.5 years of experience in Java, Eclipse, Hibernate. The Projects I have worked are Desktop or Windows Application. I can spend 1-2 Hrs daily and need to work from Home. If any Projects need my help, contact me.

Email:- Kant.Chinmay@yahoo.com
[ May 01, 2008: Message edited by: Chinmay Kant ]
15 years ago
In Generics we can use extends for Interfaces as well as Classes.

Consider that ISampleInterface is an interface and SampleClass implements ISampleInterface, then

if a code has ArrayList<? extends ISampleInterface>, then can I use the ArrayList as:-
ArrayList<ISampleInterface>
and
ArrayList<SampleClass>


My Query is when I use extends keyword in generics for interface, then does it means anything which implements that interface or interface itself.
Assume there are many tabbed panes in a window.

If JtabbedPane is not active then change color of Title Bar of Tabbed Pane to gray, just like in eclipse,
If Active, the Color of the Title Bar of Tabbed Pane is Blue.

How can i achieve this Functionality??
16 years ago
The Method setOrientation sets the Child Component from Right to left, not the Parent component.

What is my actual case is there is toolbar where there are tool buttons and to the end of this tool bar, i need to attach a Image. All Buttons are on the Left Side whereas the only Image is on RightSide.

Please Help me considering the scenario
16 years ago
Hi,

How can I add a Button to A ToolBar so that the Button comes on the Right hand side of the Toolbar, not on the Left Hand Side. Just Like the Close Maximize and Minimize Buttons for Windows Application

In other words, How can i add a Button so that it comes at the end of Toolbar
16 years ago
Code:-
------------------------------------------------------------------------------------------------------------------------------------------------------
public class Test21{
public static void main(String a[]){
String s1 = new String("Hai");
String s2 = "Hai";
String s3 = new String("Hai").intern();
System.out.println(s1 == s2);
System.out.println(s1 == s3);
System.out.println(s2 == s3);
}
}
------------------------------------------------------------------------------------------------------------------------------------------------------

The Answer is false false true

SO, why Answer cannot be false true false.

------------------------------------------------------------------------------------------------------------------------------------------------------
Here are the details of intern method from javadocs:-

public String intern()
Returns a canonical representation for the string object.

A pool of strings, initially empty, is maintained privately by the class String.

When the intern method is invoked, if the pool already contains a string equal to this String object as determined by the equals(Object) method, then the string from the pool is returned. Otherwise, this String object is added to the pool and a reference to this String object is returned.

It follows that for any two strings s and t, s.intern() == t.intern() is true if and only if s.equals(t) is true.

------------------------------------------------------------------------------------------------------------------------------------------------------
Code:-
------------------------------------------------------------------------------------------------------------------------------------------------------
public class Test15{
public static void method(StringBuffer sb){
sb.append(" Added");
sb = new StringBuffer("Hai");
}

public static void main(String a[]){
StringBuffer sb = new StringBuffer("String Buffer");
method(sb);
System.out.println(sb);
}
}
What is output?
A1 String Buffer
A2 String Buffer Added
A3 Hai
A4 Compiler Error
------------------------------------------------------------------------------------------------------------------------------------------------------

Here the O/p is String Buffer Added.

My Doubt is if it can append the String "Added" on the same Object, when it is set to new, why it does not change to newly created StringBuffer"Hai"

Thanks in Advance
Please see your private message
16 years ago