lakshmi nair

Ranch Hand
+ Follow
since Oct 11, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by lakshmi nair

I have a frame which contains some text components, which takes in values and validates (a database connection). After validations a different set of components has to be displayed with the window size maximized. I could do everything except the maximizing part. The frame remains the same size with the new contents in it. How can i do this? I tried using functions - setSize, setBounds, doLayout, repaint, update, validate etc. combinations of these. what is going wrong in this?
I tried out this other method, opening a new window, with the required size. But how do i close the first window without exiting the application?
thanks,
lakshmi
[This message has been edited by lakshmi nair (edited May 31, 2001).]
23 years ago
I think Bruce Eckel (Thinking In Java) talks about JApplets whose default is BorderLayout
Note that the constructor public DerivedDemo(int x, int y) is not explicitly calling the base class version like the other one public DerivedDemo(int x).Then it will call a default no args constructor of the super class. So we must provide a Demo() no args constructor in the Demo class.
This is not provided by the compiler because there is already a constructor Demo(int) in the super class.


Hi, I met a quite hard question in bill's mock simulation:
Given the following class definition:
1.public class DeriveDemo extends Demo{
2. int M,N,L;
3. public DerivedDemo(int x, int y){
4. M=x; N=y;
5. }
6. public DerivedDemo(int x){
7. super(x);
8. }
9.}

Just wondering, is Void a wrapper class? Its not specified explicitly as for all other wrapper classes in the API.
Hi Aruna, Viji
I didnt try it further and as you see there are not many replies. Viji's code does not work correctly with me, i dont know why. Anyway less tensed, gave the test today and passed with 83. Time for lot of experiments now!!!
The above code displays 5 buttons. What i want is the second should begin at a position half from the first. I wrote this expecting a result like that. What change must i make?

Thanx
Lakshmi
This is from Abhilash's site.

1. The code will fail to compile. The class com.abhilash.abhilash can never be imported.
2. The code will compile. Runtime error occurs if one of the class in the import does not exist and is referenced.
3. The code will compile and run with out any problem
The answer is given as 1. I feel that is wrong.
Matt,
Let me put forward some rules which your code follows...
Runnable r = b;
Is ok because b implements Runnable interface through T.
Whenever we convert a class to an interface WITHOUT casting the class must implement that inteface (or its superclasses).
t = (T)r; // Why is the cast needed here?
Now here r is a Interface and t a class. For this to work without a cast, t MUST BE of type Object.All others need a cast.
After the cast, during runtime, since r
contains a reference to b of type B which is a subclass of T, it will work.
I just wanted to share some knowledge i gained.
There is a method Math.IEEEremainder(double,double) which can give you the a result which can be sometimes equivalent to % operation.
Here goes the actual explanation from API..
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard. The remainder value is mathematically equal to f1 - f2 � n, where n is the mathematical integer closest to the exact mathematical value of the quotient f1/f2, and if two mathematical integers are equally close to f1/f2, then n is the integer that is even. If the remainder is zero, its sign is the same as the sign of the first argument.

and some results...
IEEEremainder(10,2.5) 0.0
IEEEremainder(10.5, 2.5) 0.5
IEEEremainder(11, 2.5) 1.0
IEEEremainder(9.5, 2.5) -0.5
IEEEremainder(9.0, 2.5) -1.0
IEEEremainder(8.0, 2.5) 0.5
IEEEremainder(8.5, 2.5) 1.0
IEEEremainder(7.4, 2.5) -0.09999999999999964

lakshmi


[This message has been edited by lakshmi nair (edited November 16, 2000).]
Hi Ramesh,
Thats because in your program the comparison == is done against
"1)" + b.toString() and not b.toString(), due to the precedence of '+' over '=='.
Note that you are getting a false for the last one, where as the comparison b.toString()==b must return a true.


Hi,
All of the comparisons result is false value. My question was not that. I guess, I was not clear in my question. If you look closely in the print statement, you will see that a number and a bracket is also included. I expect the number with a bracket also to be printed out. Like:
1) false
2) false
3) false
4) false
To my surprise the numbers and brackets don't print. It just prints like this:
false
false
false
false
I wanted to know the reason behind skipping the number and a bracket.
Thanks.

You can see it for yourself using the code

a = a - 2.2 is the operation being done continously when we do % operation.
Hi Billesh,
All of those are really good and tricky...
Do post more..
Lakshmi
Congrats!!! Cool Score!!
Kai's notes at... http://www.cyberus.ca/~kaitung/my_java.htm
Please ...
Prevent this being a "Send me too, my id is..." thread.
Lakshmi
24 years ago