Help coderanch get a
new server
by contributing to the fundraiser

Balasubramanian Chandrasekaran

Ranch Hand
+ Follow
since Nov 28, 2007
Balasubramanian likes ...
Firefox Browser VI Editor Linux
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Balasubramanian Chandrasekaran

Rob i will try out your suggestion.
13 years ago
Rob Camick - Thanks for your reply

I tried out your code and found that it is working perfectly fine with the JMenu Help laid at the right end of JMenuBar. But, when i tried to change your code to meet my requirement of placing a JLabel at the right end i end up with another problem.

I took your code and then replaced Help - JMenu with a JLabel

When i run this code initially it came up well (Attachment Step1.jpg) then i tried resizing to increase the size of JFrame which also worked perfectly (Attachment Step2.jpg) then i tried resizing to reducing the size of JFrame and found that the JLabel which was added is causing the JMenu to disappear(Attachment Step3.jpg)

I tried the same operation with native windows application which does a reverse case of hiding the Label. So can you tell me your suggestion to make the same for this JFrame as well. If i try to reduce the size of the JFrame then the JLabel can be hidden but the JMenu should appear.

And finally you got a nice blog post explaining the issue and can i use your in my code provided i will include your blog URL in the code.
13 years ago
Finally, searching the bug tracker of java revealed a similar issue which i am facing and i tried out the code provided in the bug tracker

Old Java Bug

and that one seemed to work if i have only the menu aligned in the left of the JFrame. When i tried adding a JLabel onto JMenuBar using Box.createHorizontalGlue() to align only the JLabel to the right the custom layout code is not working as it uses the FlowLayout wherein the Glue will work perfectly under BoxLayout only. So any idea how to over come this situation.

Here is the updated code which i am trying now
13 years ago
I am working under Windows OS, the default behavior while resizing application under windows is to bring the menu downwards if it doesn't fit the size. (Please refer the attachment Expected.jpg) where i tried resizing the Eclipse IDE window which shows the menu perfectly and all the menu's are accessible

Wherein if i try to resize the JFrame which i have created using the code below

I can see that the menu is no longer usable (Please refer Result.jpg in attachment). How can i prevent this from happening. I tried using FlowLayout on JMenuBar but still i can't see any difference.
13 years ago
Hi all,

I am trying to capture the Alt+Tab combination key from my custom JFrame application. Is it possible under Java?

14 years ago
I would prefer a chapter wise approach, as this will make you strong in base concepts.
15 years ago

neeni maur wrote: ny 1 can tell me why we use methode or constuctor overloading??
dose it related in terms of memory ???

Constructor are special methods which takes the same name of the declared class. So, the same rule quoted by Steve Luke applies for constructor also.

Simple example: String class constructors.
15 years ago
I chnaged the language settings from english layout to german from the regional settings. the keyboard behave as german. but in my java application i have to get the keyboard layoout whether it is english or german. i tried by using Locale.getdefault it always display the english US. if the regional setting is changed also locale.getdefault display the english as.

How to get the current keyboard layout or language setting using java.
15 years ago

Originally posted by Arjun Reddy:
Hi all,

Can we create our own string class? If so, can someone tell me how to do it? This is an Interview question. Does it mean can we create a class that is immutable like string or something else?


Hi Arjun,

Recently i came across this link.I think it will be of use to you!!
15 years ago
Finally i got the method to read bdata by using reflections,

I will post my solution here.
16 years ago
Reply for Ulf Dittmer,

What's in that array?
I can see keyboard scan code which gets stored in that byte array.This one you can verify by placing a breakpoint inside MyKeyListener inner class which i posted in my initial post and Debug it using Eclipse and once the control reaches there i can [i]Right click on Object reference 'e' for KeyEvent and select Inspect Option which shows that bdata private field values. This is how i figured out that it contains some value which i need in my program.

Maybe there's some other way to accomplish this
What is the other way, can you explain in brief.

Reply for Rob Prime,

There are some special keys in Japanese keyboard which is not recognized by KeyEvent it gives value as 0(zero).But, that bdata array which i quoted earlier contains keyboard scan code values which i can see using Debug option under Eclipse editor.

Are you sure that accessing this field will help you?
Ya i am sure that accessing bdata field is useful.As i already seen scan code gets stored in that field.

what is actually in this field?
When i checked, it contains keyboard scan code values in that byte array.

Expecting your reply...
16 years ago
Hi folks,

I need to access private variable 'bdata[]' which is inside java.awt.AWTEvent abstract class.

I am trying a multilingual program which requires input from all kinds of keyboard (i.e.,) Japanese,Chinese.. etc. When i was trying with Japanese keyboard i found that for some special keys i am not able to detect those keys by extending KeyEvent class in my inner class

<pre name="code" class="core">

class MyKeyListener extends KeyEvent {

public void keyPressed(KeyEvent e)
System.out.println ("Keyevent pressed");
public void keyReleased(KeyEvent e)
System.out.println ("Keyevent released");

I am using eclipse for my development purpose.When i try to debug using Eclipse i can able to see the value of bdata[] array.How to access that bdata[] in AWTEvent class using Java code to get scan code for my Key Inputs.

Thanks in advance
16 years ago

Originally posted by santomh Mclain:
I've installed JRE 1.6_03 in my system few months ago for IE 7.0 and it was working fine. but now java console disappeared automatically and my browser can no longer run the applets. while JRE1.6_03 still persist in the system.
I don't know how did this happen and I've gone through the java related settings in tools menu but couldn't do more enough.
how can i reconfigure the installed JRE for IE and Firefox sepereatlly?

I think re-installation will fix your issue.
16 years ago

Originally posted by Ashlon Hill:
What is the command/process to check the version of the JVM or JRE?

To know version of your JDK you can use
%>javac -version

To know version number of your JRE you can use
%>java -version
in your Command Prompt(Terminal)
[ July 10, 2008: Message edited by: Balasubramanian Chandrasekaran ]
16 years ago

Originally posted by Gavin Tranter:
Ah. Cool, didnt know/remember that.
Yeah I would use a lightweigth thread that when it detected a change fires off an event, that the main app catches.

Thanks for your comments. I will move ahead with that lightweight thread approach.
16 years ago