LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-21-2005, 01:37 AM   #1
LUB997
Member
 
Registered: Jul 2003
Distribution: openSUSE Linux, Apple Darwin UNIX
Posts: 66

Rep: Reputation: 15
Java: How do I use "\t" in a JMenuItem?


Trying to make Java menu items that look like the following:

Code:
New...
Open...         Enter
Move...         F7
Copy...         F8
etc., but the problem I am having is that when I use "\t" in the code, the tabs don't show up in the menu when I actually run the program. My output looks like the following:

New...
Open...Enter
Move...F7
Copy...F8

I tried spaces instead, and that works, but it looks really sloppy.

Here is an example of my code:

JMenuItem moveItem = new JMenuItem("Move...\t\t\tF7");
moveItem.setMnemonic('M');
fileMenu.add(moveItem);


Does anybody know how to make "\t" work?

Last edited by LUB997; 06-21-2005 at 01:39 AM.
 
Old 06-21-2005, 02:17 AM   #2
enemorales
Member
 
Registered: Jul 2004
Location: Santiago, Chile
Distribution: Ubuntu
Posts: 410

Rep: Reputation: 31
Hi,

I think that you want accelerators. Take a look at this page:

http://www.java2s.com/ExampleCode/Sw...celerators.htm

Good luck!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 11:26 AM
"Xlib: extension "XFree86-DRI" missing on display ":0.0"." zaps Linux - Games 9 05-14-2007 03:07 PM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 03:47 AM
I cannot use "java chat". Browser says plugin required "x-java-vm". jdruin Linux - Software 4 04-18-2004 05:44 PM
Java does "age" or "Age" matter when declaring an Int?? Laptop2250 Programming 3 10-13-2003 12:34 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration