Overriding Ctrl + Tab of JTabbedPane
Dear All ,
I have registered a keyboard action (ctrl+Tab key) to the
JTabbedPane instance in my program for " Shifting TabbedPane's Tabs " . But its not working. If i register with ( Ctrl + any other key ) it working fine.
MY CODE:
sm_tabpaneGUI.registerKeyboardAction(rightAction,KeyStroke.getKeyStrokejava.awt.event.KeyEvent.VK_TAB,java.awt.Event.CTRL_MASK),JComponent.WHEN_FOCUSED);
where rightAction is an ActionListener object reference which does the necessary functionality.
But Acc. Bug Id 4481587 they have given a workaround.
" Edit the awt.properties files which have the focus traversal keys defined. "
It is not working. So any other workaround would be appreciated."
Srinivasan Samivelu
Software Development Engineer
BarcoNet Private Limited.
Mailto:[email protected]
http://www.barconet.com
try dropping this into your app ..
DefaultFocusManager myManager = new DefaultFocusManager(){
public void processKeyEvent(Component focusedComponent, KeyEvent anEvent)
// Returning when you receive CTRL-TAB makes your components able to control that key
if (anEvent.getKeyCode() == KeyEvent.VK_TAB && (anEvent.getModifiers() & KeyEvent.CTRL_MASK) == KeyEvent.CTRL_MASK)
return;
super.processKeyEvent(focusedComponent,anEvent);
FocusManager.setCurrentManager(myManager);
Similar Messages
-
I try to override the Ctrl-Tab key combination using the following:
final KeyStroke focusUnderneathTableKeyStroke = KeyStroke.getKeyStroke(KeyEvent.VK_TAB, Event.CTRL_MASK);
wrapper.overrideShortcutKey(new FocusOnTableAction(false), focusUnderneathTableKeyStroke, "focusUnderneathTable");The method overrideShortcutKey() is:
public void overrideShortcutKey( AbstractAction action, KeyStroke keyStroke, String sName )
InputMap im = getComponent().getInputMap( JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT );
ActionMap am = getComponent().getActionMap();
im.put( keyStroke, sName );
am.put( sName, action );
}This does not seem to work. If, however, I replace the Tab key with 'Q', it works. I want this to transfer focus to a wrapper underneath a table.
Anybody any suggestions for this? And why does Ctrl+Tab not work whereas Ctrl+Q works?I'm assuming by normal tab, you want to insert a tab. So here's this:
import java.awt.*;
import java.util.HashSet;
import java.util.Set;
import javax.swing.*;
public class TextAreaTab {
public static void main( final String[] args ) {
Runnable doCreate = new Runnable() {
public void run() {
new TextAreaTab().createGUI();
SwingUtilities.invokeLater( doCreate );
private void createGUI() {
JButton button = new JButton( "Button" );
JTextArea textArea = new JTextArea();
textArea.setText( "TextArea" );
KeyStroke ctrlTab = KeyStroke.getKeyStroke("ctrl TAB" );
Set set = new HashSet( textArea.getFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS) );
set.remove( ctrlTab );
textArea.setFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, set );
textArea.getInputMap().put( ctrlTab , "insert-tab" );
JFrame frame = new JFrame( "TextAreaTab" );
frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
frame.getContentPane().setLayout( new BorderLayout() );
frame.getContentPane().add( button, BorderLayout.SOUTH );
frame.getContentPane().add( textArea, BorderLayout.CENTER );
frame.setSize( new Dimension( 250, 100 ) );
frame.show();
} -
Override "crtl + tab" key behaviour with "tab" key for JtextArea .
I am trying to override the "crtl + tab" key behaviour for JTextArea with "tab" key plus add my own action. I am doing the following.
1. Setting Tab as forward traversal key for the JTextArea (the default traversal key from JTexArea is "crtl + Tab").
2. Supplementing the "crtl + Tab" key behaviour with my custom behaviour.
For the point 2 above, I need to get hold of the Action represented by the "crtl + Tab" key so that I could use that and then follow with my own custom action. But the problem is that there is no InputMap entry for "crtl + tab". I dont know how the "crtl + tab" key Action is mapped for JTextArea. I used the following code to search the InputMap.
System.out.println("Searching Input Map");
for (int i = 0; i < 3; i++) {
InputMap iMap = comp.getInputMap(i);
if (iMap != null) {
KeyStroke [] ks = iMap.allKeys();
if (ks != null) {
for (int j = 0;j < ks.length ;j++) {
System.out.println("Key Stroke: " + ks[j]);
System.out.println("Searching Parent Input Map");
for (int i = 0; i < 3; i++) {
InputMap iMap = comp.getInputMap(i).getParent();
if (iMap != null) {
KeyStroke [] ks = iMap.allKeys();
if (ks != null) {
for (int j = 0;j < ks.length ;j++) {
System.out.println("Key Stroke: " + ks[j]);
}In short, I need to get the Action associated with the "crtl + tab" for JTextArea.
regards,
nirvan.There is no Action for Ctrl+TAB. Its a focus traversal key.
-
Vim Ctrl + Tab for Tabs navigation
:noremap <silent> <c-Tab> :tabn<CR>
noremap! <silent> <C-Tab> :tabn<CR>
This doesn't work for me - any idea why? Ctrl-tab just doesn't shift tabs... I've definitely not bound the combination elsewhere in my .vimrc either.
- KD
Last edited by KomodoDave (2007-05-02 02:38:33)mosor wrote:
Here are my tab related settings (that work):
set showtabline=2 " File tabs allways visible
:nmap <C-S-tab> :tabprevious<cr>
:nmap <C-tab> :tabnext<cr>
:nmap <C-t> :tabnew<cr>
:map <C-t> :tabnew<cr>
:map <C-S-tab> :tabprevious<cr>
:map <C-tab> :tabnext<cr>
:map <C-w> :tabclose<cr>
:imap <C-S-tab> <ESC>:tabprevious<cr>i
:imap <C-tab> <ESC>:tabnext<cr>i
:imap <C-t> <ESC>:tabnew<cr>
Thanks for posting, mosor! Sadly your command lines don't work for me either...
Here's my .vimrc, much of which was cloned from phrakture's :
"""""""""" general options """"""""""
set nocompatible " Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
"syntax enable " enable syntax highlighting and keep current colour settings
syntax on " enable syntax highlighting and override current colour settings
behave xterm " mouse and selection xterm behaviour
filetype plugin indent on " filetype dependent indenting and plugins
set autoindent " indents line relative to the line above it
set autowrite " automatically write contents of file where sensible
set backspace=indent,eol,start " allow backspacing over eevrything in insert mode
set backup backupdir=$HOME/.vim/backup " set backup directory
set cinoptions=g0,:0,l1,(0,t0 " C indentation options
set clipboard=unnamed " yank and paste in visual mode without prepending "*
set cmdheight=1 " cmdline height
set complete=.,t,i,b,w,k " keyword completion configuration
set encoding=utf-8 " encoding
set expandtab " insert spaces instead of tab character
set formatoptions+=l " add format option preventing lines longer than 'textwidth' being broken
set guioptions-=T " no toolbar
set hidden " don't have to save when switching buffers
set history=100 " cmdline history table size
"set ignorecase " search is case insensitive when search term is all lower case
set incsearch " live search while typing search expression
set laststatus=2 " always display the status line
set nohlsearch " no highlighting when performing search
set nowrap " don't wrap visible lines
set number " precede line with line number when printing
set pastetoggle=<F9> " toggle paste mode
set previewheight=5 " preview window size
"set ruler " show line and column in status line
set shell=/bin/sh " set the shell to be used
set shiftwidth=4 " number of spaces used for (auto)indent
set showcmd " show partial command in status line
set showmode " show whether in insert, visual mode etc
set showmatch " indicate matching parentheses, braces etc
set showtabline=2 " File tabs allways visible
set shortmess=a " abbreviate file messages
set smartcase
set smartindent
set softtabstop=4 " tab defaults to 4 spaces while performing editing operations
set splitbelow " split creates new window below current one
set statusline=%-3.3n\ %f\ %r%#Error#%m%#Statusline#\ (%l/%L,\ %c)\ %P%=%h%w\ %y\ [%{&encoding}:%{&fileformat}]\ \ "status line settings
set tabstop=4 " tab defaults to 4 spaces
set textwidth=80 " maximum column width of inserted text - longer lines are broken after whitespace
set ttyfast " for fast terminals - smoother (apparently)
set termencoding=utf-8
set whichwrap=h,l,<,>,[,] " allow line-wrapped navigation
set wildchar=<Tab> " type tab in cmdline to start wildcard expansion
set wildmenu " enhanced cmdline completion
set wildmode=longest:full,full " cmdline completion mode settings
set writebackup " make a file backup before overwriting it
" Convenient command to see the difference between the current buffer and the
" file it was loaded from, thus the changes you made.
command DiffOrig vert new | set bt=nofile | r # | 0d_ | diffthis
\ | wincmd p | diffthis
"""""""""" keyboard mappings """"""""""
" Dvorak caret navigation
:noremap t <Up>
:noremap h <Down>
:noremap d <Left>
:noremap n <Right>
:noremap k d
:noremap l n
:noremap j t
" Window split and navigation
:noremap <C-w><S-s> :vsplit<CR>
:noremap <C-w>t <C-w><Up>
:noremap <C-w>h <C-w><Down>
:noremap <C-w>d <C-w><Left>
:noremap <C-w>n <C-w><Right>
" Ctrl-s saves
:inoremap <C-s> <Esc>:w<CR>a
:nnoremap <C-s> :w<CR>
" Tab manipulation
":noremap <silent> <C-t> :tabnew<cr>
":noremap <silent> <C-x> :tabc<cr>
":noremap <silent> <C-tab> :tabn<cr>
":noremap <silent> <C-s-tab> :tabp<cr>
"noremap! <silent> <C-t> :tabnew<cr>
"noremap! <silent> <C-x> :tabc<cr>
"noremap! <silent> <C-tab> :tabn<cr>
"noremap! <silent> <C-s-tab> :tabp<cr>
:nmap <C-S-tab> :tabprevious<cr>
:nmap <C-tab> :tabnext<cr>
:nmap <C-t> :tabnew<cr>
:map <C-t> :tabnew<cr>
:map <C-S-tab> :tabprevious<cr>
:map <C-tab> :tabnext<cr>
:map <C-x> :tabclose<cr>
:imap <C-S-tab> <ESC>:tabprevious<cr>i
:imap <C-tab> <ESC>:tabnext<cr>i
:imap <C-t> <ESC>:tabnew<cr>
"Key bindings
noremap <silent> <F1> :Tlist<cr>
noremap <silent> <F2> :VSBufExplore<cr>
"noremap <silent> <F3> :Make<cr>
noremap <silent> <F3> <c-o>:Project<cr>
noremap <silent> <F6> :set spell!<cr>
noremap! <silent> <F1> <c-o>:Tlist<cr>
noremap! <silent> <F2> <c-o>:VSBufExplore<cr>
"noremap! <silent> <F3> <c-o>:Make<cr>
noremap! <silent> <F3> <c-o>:Project<cr>
noremap! <silent> <F6> <c-o>:set spell!<cr>
" I never use these anyway
noremap ( :bprev<cr>
noremap ) :bnext<cr>
":inoremap ^] ^[A
":inoremap ð ^N
" Don't use Ex mode, use Q for formatting
"map Q gq
"""""""""" autocommand stuff """"""""""
" Only do this part when compiled with support for autocommands.
if has("autocmd")
" Enable file type detection.
" Use the default filetype settings, so that mail gets 'tw' set to 72,
" 'cindent' is on in C files, etc.
" Also load indent files, to automatically do language-dependent indenting.
filetype plugin indent on
" Put these in an autocmd group, so that we can delete them easily.
augroup vimrcEx
au!
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text setlocal textwidth=78
" When editing a file, always jump to the last known cursor position.
" Don't do it when the position is invalid or when inside an event handler
" (happens when dropping a file on gvim).
autocmd BufReadPost *
\ if line("'\"") > 0 && line("'\"") <= line("$") |
\ exe "normal! g`\"" |
\ endif
augroup END
else
set autoindent " always set autoindenting on
endif " has("autocmd")
" if autocmd is on
if has("autocmd")
" read Ex commands from file if syntax matches
au Syntax {cpp,c,idl} runtime syntax/doxygen.vim
au Syntax {cpp,c,lisp,scheme} runtime plugin/RainbowParenthesis.vim
au FileType qf if &buftype == "quickfix" |
\ setlocal statusline=%-3.3n\ %0*[quickfix]%=%2*\ %<%P |
\endif
au FileType mail setlocal spell
au FileType cvs setlocal spell
au FileType help setlocal statusline=%-3.3n\ [help]%=\ %<%P
" for all files enable cursorline upon entering a window, and disable when
" leaving
"au WinEnter * setlocal cursorline
"au WinLeave * setlocal nocursorline
au BufReadPost * if line("'\"")>0 && line("'\"")<=line("$")|exe "normal g`\""|endif
" syntax highlighting for html that permits embedded javascript
au BufRead *.html set filetype=htmlm4
" when a PKGBUILD is loaded into a buffer, trigger all sh filetype autocommands
" this occurs before modelines are read
au BufRead,BufNewFile PKGBUILD set ft=sh
" when a .as file is loaded into a buffer,, trigger all actionscript
" filetype autocommands, and use C indenting rules
" this occurs before modelines are read
au BufRead,BufNewFile *.as setlocal ft=actionscript cindent
" omni functionality
au FileType css setlocal ofu=csscomplete#CompleteCSS
au Filetype * if exists('&ofu') && &ofu == "" |
\ set ofu=syntaxcomplete#Complete |
\endif
endif
"""""""""" abbreviations and remaps """"""""""
":abbreviate #! #!/usr/bin/env python
"""""""""" other stuff """"""""""
" vim.org tip 867: get help on python in vim, eg :Pyhelp os
:command -nargs=+ Pyhelp :call ShowPydoc("<args>")
function ShowPydoc(module, ...)
let fPath = "/tmp/pyHelp_" . a:module . ".pydoc"
:execute ":!pydoc " . a:module . " > " . fPath
:execute ":sp ".fPath
endfunction
"bracket autocompletion
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {<CR>}<ESC>O
autocmd Syntax html,vim inoremap < <lt>><ESC>i| inoremap > <c-r>=ClosePair('>')<CR>
inoremap ) <c-r>=ClosePair(')')<CR>
inoremap ] <c-r>=ClosePair(']')<CR>
inoremap } <c-r>=CloseBracket()<CR>
inoremap " <c-r>=QuoteDelim('"')<CR>
inoremap ' <c-r>=QuoteDelim("'")<CR>
function ClosePair(char)
if getline('.')[col('.') - 1] == a:char
return "\<Right>"
else
return a:char
endif
endf
function CloseBracket()
if match(getline(line('.') + 1), '\s*}') < 0
return "\<CR>}"
else
return "\<ESC>j0f}a"
endif
endf
function QuoteDelim(char)
let line = getline('.')
let col = col('.')
if line[col - 2] == "\\"
"Inserting a quoted quotation mark into the string
return a:char
elseif line[col - 1] == a:char
"Escaping out of the string
return "\<Right>"
else
"Starting a string
return a:char.a:char."\<ESC>i"
endif
endf
"folding options
if has("folding")
" enable folds
set foldenable
" {{{ markers indicate folds
set foldmethod=marker
" leave all/most folds open
set foldlevel=100
endif
" if using gvim
if has('gui_running')
" allow pasting into other applications after visual selection
set guioptions+=a
" use console dialogs instead of popups
set guioptions+=c
" don't add tab pages
set guioptions-=e
" don't include toolbar
set guioptions-=T
" set color scheme
colors zenburn
" if running under windows
if has('win32')
" set number of columns and lines
set columns=120
set lines=60
" select font
set guifont=Bitstream_Vera_Sans_Mono:h8:cANSI
else
" select font
set guifont=Bitstream\ Vera\ Sans\ Mono\ 8
endif
" if we're in a linux console
elseif (&term == 'screen.linux') || (&term =~ '^linux')
" use 8 bit colour
set t_Co=8
" set color scheme
colors desert
" if we're in xterm, urxvt or screen with 256 colours
elseif (&term == 'rxvt-unicode') || (&term =~ '^xterm') || (&term =~ '^screen-256')
" allow mouse in all editing modes
set mouse=a
" use xterm mouse behaviour
set ttymouse=xterm
" set encoding to uft-8
set termencoding=utf-8
" set color scheme
colors desert256-transparent
" if we're in a different terminal
else
" set color scheme
colors desert
endif
" if we're in screen and autocmd is enabled
if &term =~ "^screen" && has("autocmd")
" this fixes background artifacting when leaving vim inside screen
autocmd VimLeave * :set term=screen
endif
let mapleader = "`"
" cd includes current directory, as well as $HOME and projects folders
let &cdpath=','.expand("$HOME").','.expand("$HOME").'/projects'
" if vim version is >= 7
if v:version >= 700
" display cursor line
set cursorline
" Insert mode completion options
set completeopt=menu,menuone,longest,preview
" spellchecker language is US
set spelllang=en_us
" spelling suggestions operate on 'fast' mode with max 20 suggestions
set spellsuggest=fast,20
" use min 1 column for line number
set numberwidth=1
" imma commnt with missspellings, use me tu tesst
endif
"set dictionary=/usr/share/dict/words
" typing q: == :q
nmap q: :q<cr>
" typing :Q == :q
nmap :Q :q<cr>
" man-page autoreturn after view
nmap K K<cr>
iab NDB Author: N David Brown
"tags files search for a project
" :FindTags('~/projects/something')
"command! -nargs=1 -complete=dir FindTags :call ProjectTags(<args>)
"function! ProjectTags(projectbase)
"let tfiles = glob("$(find ".a:projectbase." -name tags -print)")
"let &tags = substitute(tfiles, "\n", ",", "g")
"endfunction
"command! -nargs=* Make :call SilentMake(<f-args>)
"function! SilentMake()
"let oldsp=&shellpipe
"setlocal shellpipe=>%s\ 2>&1
"exe 'silent make '.string(a:000)
"cwindow
"set shellpipe=&oldsp
"redraw! "this screws up the screen sometimes, fix that
"endfunction
"Project
let g:proj_flags = "ibmstg"
let g:proj_window_width = 35
"TODO get this working better
"TagsParser
"let g:TagsParserLastPositionJump = 1
"let g:TagsParserCurrentFileCWD = 1
let g:TagsParserWindowSize = 30
"let g:TagsParserAutoOpenClose = 1
"let g:TagsParserSingleClick = 1
"let g:TagsParserHighlightCurrentTag = 1
"let g:TagsParserSortType = "line"
"let g:TagsParserFileReadTag = 1
"let g:TagsParserFileReadDeleteTag = 1
"enable the Vim 7.0 options
if v:version >= 700
let g:TagsParserCtrlTabUsage = 'tabs'
"Configure the projects - These have been renamed because the projects I work
"on at work are not really what is important, but rather the way they are configured.
let g:TagsParserProjectConfig = {}
let g:TagsParserProjectConfig['/home/griff/devel/pacman-lib/'] = { 'tagsPath' : '/home/griff/devel/pacman-lib/lib/libalpm/,/home/griff/devel/pacman-lib/src/pacman/' }
endif
"TagList
"let Tlist_Display_Tag_Scope = 1 "ugh...
let g:Tlist_Display_Prototype = 1
let g:Tlist_Use_Right_Window = 1
let g:Tlist_Exit_OnlyWindow = 1
let g:Tlist_Enable_Fold_Column = 0
let g:Tlist_Sort_Type = "name"
let g:Tlist_Compact_Format = 0
let g:Tlist_File_Fold_Auto_Close = 0
let g:Tlist_WinWidth = 50
"VTreeExplorer
let g:treeExplVertical = 1
let g:treeExplWinSize = 35
let g:treeExplDirSort = 1
"NetRW
let g:netrw_keepdir = 1
let g:netrw_winsize = 40
let g:netrw_alto = 1
"BufExplorer
let g:bufExplorerOpenMode=1
let g:bufExplorerSortBy='mru'
let g:bufExplorerSplitType='v'
let g:bufExplorerSplitVertSize = 35
let g:bufExplorerShowDirectories=1
"Valgrind
let g:valgrind_arguments = "--leak-check=yes --num-callers=5000 --time-stamp=yes"
let g:valgrind_use_horizontal_window = 1
let g:valgrind_win_height = 7
"DoxygenToolkit
let g:DoxygenToolkit_authorName = "Aaron Griffin"
let g:DoxygenToolkit_briefTag_funcName = "yes"
"ShowMarks
let g:showmarks_enable = 0
let g:showmarks_ignore_type="hmpqr"
"Buftabs
let g:buftabs_only_basename = 1
"Lisp syntax
"let g:lisp_rainbow = 1
- KD
Last edited by KomodoDave (2007-05-04 13:34:16) -
Regarding ctrl-tab and ctrl-shift-tab
hi,
i have a JFrame inside which i have a JInternalFrame and this contains 4 JPanels
which have components now,
when i press ctrl-tab from first panel's component the focus should move to
first component of next panel same from other panels and ctrl-shift-tab - reverse
how can i achive it ?
i extended FocusManager and by overriding processKeyEvent() i was able achieve what a wanted
but i have many JInternalFrames which are entirely diffenent from each other
so had to have different FocusManagers .
after setting new focusmanager the Mnemonic of JFrame were not working .
so i need any work arounds for the above problem.
desperately need help.
thanks.Hi,
It should work. In the case, don't minimize the Book3.xlsx's window. Then you should be able to use Ctrl+Tab and Ctrl+F6 to switch between the book1,2 and 3.
Because Excel 2013 move to a single document interface, so there is no workbook title bar minimize, maximize, and close buttons. When you minimize the Book3's window in Excel 2013, the action will be treated as you have used the workbook title
bar minimize button to minimize the workbook.
In Excel 2010, the buttons can be found here:
If you use the workbook title bar minimize button in Excel 2010 instance, the same behavior can be reproduced.
Best regards,
Rex Zhang
TechNet Community Support -
Ctrl+tab is not working in editing mode
I have JcheckBox and JTable in my JPanel. When user clicks or presses F2 to edit any cell value of the JTable a comboBox will appear with possible values. (This comboBox is coming from table CellEditor). When user presses ctrl+tab from the table focus should transfer to JComboBox all time. It is working only when the user presses ctrl+tab from the table cell which is not in editing mode. If the user presses ctrl+tab from the table cell which is in editing mode (i.e. focus is on the ComboBox of the cellEditor) it does not work. Please help me to find the solution.
I give a sample code here for your reference.
public class Frame1 extends JFrame {
public Frame1()
super();
this.setLayout( null );
this.setSize( new Dimension(400, 300) );
JTextField ch = new JTextField();
ch.setVisible(true);
ch.setBounds(10, 10, 10, 10);
this.add(ch, null);
DefaultTableModel tmodel = new DefaultTableModel(3, 1);
tmodel.setValueAt("0 0 1",0,0);
tmodel.setValueAt("1 0 1",1,0);
tmodel.setValueAt("2 0 1",2,0);
JTable custLayersTable = new JTable(tmodel);
custLayersTable.getColumnModel().getColumn(0).
setCellEditor(new ComboEditor());
custLayersTable.setBounds(new Rectangle(40, 40, 280, 145));
custLayersTable.setSurrendersFocusOnKeystroke(true);
this.add(custLayersTable, null);
public static void main(String[] args)
Frame1 a = new Frame1();
a.setVisible(true);
final class ComboEditor extends AbstractCellEditor
implements TableCellEditor
public Component getTableCellEditorComponent(JTable table,
Object value,
boolean isSelected,
int row,
int column)
Vector<String> layerValSet = new Vector<String>();
for(int i=0; i<3; i++)
layerValSet.add(row+" "+column+" "+i);
mComboModel = new DefaultComboBoxModel(layerValSet);
mComboModel.setSelectedItem(value);
mEditorComp = new JComboBox(mComboModel);
return mEditorComp;
public Object getCellEditorValue()
return mEditorComp.getSelectedItem();
private DefaultComboBoxModel mComboModel;
private JComboBox mEditorComp;
}Thanks a lot for your reply.
Since the textField is in a different class i could not use the transferFocus API directly. I tried the following code in the keyreleased event of Combo Box but it was not working.
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent(
e.getComponent().getParent());
I also tried the following code in stopCellEditing and is not working.
KeyboardFocusManager.getCurrentKeyboardFocusManager().focusNextComponent();
Is there any other way to achieve this? -
Ctrl+Tab not working in Visual Studio 2013 in Remote Desktop
My PC is W81, and I'm RDing into a W7 machine running Visual Studio 2013 SP4.
When I press Ctrl+Tab (and hold), I very briefly see the usual editor window list come up, but it goes away and the editor does not switch.
If I hold Ctrl+Tab and let the repeat start, the same thing happens in rapid succession, but the current tab still never changes.
I have of course rebooted both client and server, and made sure my keyboard wasn't at fault and toggled all the keys. No dice.
Thanks.Sorry, but that doesn't get me the original behavior, where I can tab through the list or double-tab, triple-tap TAB to visit the last, second to last, or third to last file I visited (or I could use the visual navigator). I frequently use these commands,
and it's really slowing me down.
Can I please get an admission this is a bug and a commitment to fix it? -
Ctrl+Tab and Ctrl+F6 still not working in Excel 2013?
I am using Windows 7 64-bit. I just switched to Office Home & Business 2013 (32-bit), and I discovered that ctrl+tab behavior in Excel 2013 is incredibly broken.
If you are using any other programs concurrently with Excel, then it makes switching tasks through ctrl+tab impossible. Switching workbooks in this way has unpredictable behavior: often, Excel will switch to a workbook that is hidden behind other windows
(fails to foreground the window correctly). Even when it appears to be switching appropriately between windows, the order of switching is wrong: rather than cycling through all windows, it seems to switch between workbooks somewhat randomly.
See similar issues discussed here: https://social.technet.microsoft.com/Forums/office/en-US/f288d91d-835a-48c4-a39c-738ca05002c4/ctrltab-and-ctrlf6-not-working-properly-in-excel-2013?forum=officeitpro
and here: http://answers.microsoft.com/en-us/office/forum/office_2013_release-excel/cycling-between-open-windows-using-ctrlf6-or/7314b632-7f48-44f1-8e96-7d7000ac86d8
There does not appear to be any solution to this issue so far. I have attempted to repair my installation of Microsoft Office, but it did not correct the problem.Hi Dlup12345,
Based on my testes with local environment (Windows 8.1 and Excel 2013:15.0.4675.1000), the two Keyboard shortcuts worked as expected. In my view, this issue might be occur with Keyboard shortcuts, because you said the issue occurred intermittently. If we
only open multiple Excel files without other program, the shortcuts should worked fine. Please check if other program affected Excel shortcuts.
If you have any update, please feel free let us know.
Regards,
George Zhao
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. -
I deleted the sign-in tab in Ctrl-Tab 0.21.1. How do I get it back?
I installed Ctrl-tab 0.21.1. Initially there were several tabs prefilled, one of which, was for sign-in. I made a mistake and deleted it and now I want to recover it. How do I do this? Thank you. Marsh
I tried installing several times and it did not work. Each time I downloaded it, and restarted the computer it went back to the web site you gave to down load. Each time I checked the Ctrl-Tab and the sign-in was not listed. Now I have done some further checking in the profile and it shows a blue dot in default, but none in on or off. I don't know if that makes a difference. In fact, when I down loaded it there was no difference between what I had and after the down load. In other words, what tabs I had when I first installed the Ctrl-tab did not appear, only the ones that I added, minus the sign-in tab, which I inadvertently deleted. I did remove Ctrl-tab before doing all this. Another thing I noticed is after restarting the computer it goes back to down load, but I do not get any indication that it is being installed. I hope this helps. Bruson
-
CTRL-Tab isn't working anymore in Indesign CC nor in CC (2014)
Hi, I use to switch between open documents using the CTRL-TAB and CTRL-SHIFT-TAB in Indesign.
Since we have upgraded to CC and now CC (2014) it seems that Indesign refuses to use these shortcuts.
All tough it's possible to assign them, they just do nothing.
I can assign also other shortcuts for this function and they do work, except the one I want.
While in Photoshop this works fine, in Illustrator it is not possible to assign such shortcut (that is another story).
What have I done? Removed prefs and even uninstalled and reinstalled all CC apps…
Any suggestions?@Peter – yes.
It would be slightly different with a German keyboard layout on Mac OSX.
There it is:
cmd + <
and:
cmd + shift + <
Where the < key is right to the shift key on my MacBook Pro keyboard.
Or directly above the ctrl key, if that helps.
Uwe -
Version 33, problems when moving tab to new window, then if you open a new tab in that window it doesn't switch to it unless you use Ctrl-Tab.
Type '''about:preferences'''<enter> in the address bar.
Select '''General.''' Look for '''Tabs.'''
Turn on '''When I open a link in a new tab, switch to it immediately''' -
When I am on a Youtube video that is running and I want to switch to another tab, the Ctrl+<tab number> does not work, is that intended functionality?
This can happen when the video player (Flash plugin) has the focus.
In that case the plugin consumes all the key presses.
You will have to click with the mouse elsewhere on the page or in the user interface to make keyboard shortcuts work. -
Changing Colors of selected tab in JTabbedPane.
Do someone has some code that can show how to
change the color of the selected tab with JTabbedPane.
I can change the other tabs colors with setBackground and setForeground, setBackgroundAt........ but it is the selected
tab that will not change from the default grey color.
thankstry this code, it works.
public class TabBackgroundChange extends JFrame {
private JTabbedPane tabPane = null;
public static final Color selTabColor = Color.red;
Color nonSelectedTabColor = null;
public TabBackgroundChange() {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
catch(Exception ex) {
ex.printStackTrace();
tabPane = new JTabbedPane();
tabPane.add("One", new JPanel());
tabPane.add("Two", new JPanel());
tabPane.add("Three", new JPanel());
this.getContentPane().add(tabPane);
this.setSize(200, 200);
this.setVisible(true);
tabPane.addChangeListener(new TabChangeListener());
tabPane.setSelectedIndex(1);
tabPane.setSelectedIndex(0);
public static void main(String[] args) {
TabBackgroundChange tabBackgroundChange1 = new TabBackgroundChange();
private class TabChangeListener implements ChangeListener {
public void stateChanged(ChangeEvent ce) {
int iSelTab = tabPane.getSelectedIndex();
Color unSelectedBackground = tabPane.getBackgroundAt(iSelTab);
for(int i=0; i<tabPane.getTabCount(); i++) {
tabPane.setBackgroundAt(i, unSelectedBackground);
tabPane.setBackgroundAt(iSelTab, Color.red);
} -
Why Ctrl+Tab stops working when opening a flash embedded page?
This a huge pet peeve I have. Everytime I watch a video in youtube.com or megavideo.com, I can't just Ctrl+Tab to change tabs. I'll have to clic in some portion of the page without video to get it to work, but even that, isn't always the case.
- jtbandes
http://superuser.com/questions/12601/why-ctrltab-stops-working-when-opening-a-flash-embedded-pageThere are other things that need your attention.
Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
*Shockwave Flash 10.1 r53
See:
*http://www.mozilla.com/plugincheck/
Update the Flash plugin to the latest version.
*https://support.mozilla.com/kb/Managing+the+Flash+plugin
*http://kb.mozillazine.org/Flash
*http://www.adobe.com/software/flash/about/
Update the Adobe Reader plugin to the latest version.
*https://support.mozilla.com/kb/Using+the+Adobe+Reader+plugin+with+Firefox
*http://kb.mozillazine.org/Adobe_Reader
*http://get.adobe.com/reader/otherversions/ -
Hi
I trying to develop a Closable Tab in JTabbedPane. The close button should appear after/before the tab title all the time (like in JBuilder IDE).
I know the trick where close button appears when the mouse is in that area, but i want it to be displayed all the time irrespective of the mouse position.
How i should be able to create this component??
I am very new to swing please help...
Thanks for your help...
-VinodThanks Stas,
Your code was really helpfull.
I've improved it a litte bit. So I'd like to share It.
To use it, just create a ClosableTabbedPane.
If you need to change the default action (remove the tab) then use the method setCloseTabAction(CloseTabAction) to change the action.
Cheers,
Rafa
================================
The TabbedPaneUI
================================
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.plaf.basic.BasicTabbedPaneUI;
public class ClosableTabbedPaneUI extends BasicTabbedPaneUI
public final static int BUTTON_SIZE = 12;
public final static int BORDER_SIZE = 3;
public ClosableTabbedPaneUI()
super();
protected void paintTab(Graphics g, int tabPlacement, Rectangle[] rects, int tabIndex, Rectangle iconRect, Rectangle textRect)
super.paintTab(g,tabPlacement,rects,tabIndex,iconRect,textRect);
Rectangle rect=rects[tabIndex];
int yPosition = (rect.height-BUTTON_SIZE)/2;
int xPosition = rect.x+rect.width-Math.round(BUTTON_SIZE*1.5f);
g.setColor(Color.BLACK);
g.drawRect(xPosition,yPosition,BUTTON_SIZE,BUTTON_SIZE);
g.setColor(Color.black);
g.drawLine(xPosition+BORDER_SIZE,yPosition+BORDER_SIZE,xPosition+BUTTON_SIZE-BORDER_SIZE,yPosition-BORDER_SIZE+BUTTON_SIZE);
g.drawLine(xPosition+BORDER_SIZE,yPosition-BORDER_SIZE+BUTTON_SIZE,xPosition+BUTTON_SIZE-BORDER_SIZE,yPosition+BORDER_SIZE);
protected int getTabLabelShiftX(int tabPlacement, int tabIndex, boolean isSelected)
return super.getTabLabelShiftX(tabPlacement, tabIndex, isSelected)-BUTTON_SIZE;
protected int calculateTabWidth(int tabPlacement, int tabIndex, FontMetrics metrics)
return super.calculateTabWidth(tabPlacement,tabIndex,metrics)+BUTTON_SIZE;
protected MouseListener createMouseListener()
return new MyMouseHandler();
class MyMouseHandler extends MouseHandler
public MyMouseHandler()
super();
public void mouseClicked(MouseEvent e)
int x=e.getX();
int y=e.getY();
int tabIndex=-1;
int tabCount = tabPane.getTabCount();
for (int i = 0; i < tabCount; i++)
if (rects[ i ].contains(x, y))
tabIndex= i;
break;
if (tabIndex >= 0)
Rectangle rect = rects[tabIndex];
int yPosition = (rect.height-BUTTON_SIZE)/2;
int xPosition = rect.x+rect.width-Math.round(BUTTON_SIZE*1.5f);
if( new Rectangle(xPosition,yPosition,BUTTON_SIZE,BUTTON_SIZE).contains(x,y))
if( tabPane instanceof ClosableTabbedPane )
ClosableTabbedPane closableTabbedPane = (ClosableTabbedPane)tabPane;
CloseTabAction closeTabAction = closableTabbedPane.getCloseTabAction();
if(closeTabAction != null)
closeTabAction.act(closableTabbedPane, tabIndex);
else
// If somebody use this class as UI like setUI(new ClosableTabbedPaneUI())
tabPane.removeTabAt(tabIndex);
======================================
The Closable TabbedPane
======================================
public class ClosableTabbedPane extends JTabbedPane
private CloseTabAction closeTabAction = null;
public ClosableTabbedPane()
super();
init();
public ClosableTabbedPane(int arg0)
super(arg0);
init();
public ClosableTabbedPane(int arg0, int arg1)
super(arg0, arg1);
init();
private void init()
setUI(new ClosableTabbedPaneUI());
closeTabAction = new CloseTabAction()
public void act(ClosableTabbedPane closableTabbedPane, int tabIndex)
closableTabbedPane.removeTabAt(tabIndex);
public CloseTabAction getCloseTabAction()
return closeTabAction;
public void setCloseTabAction(CloseTabAction action)
closeTabAction = action;
=========================
The Action
=========================
public interface CloseTabAction
public void act(ClosableTabbedPane closableTabbedPane, int tabIndex);
Maybe you are looking for
-
Req:Download of purchase order item details using normal ALV
Hi all, Can we display the output as script form by using function module reuse_alv_grid_display_lvc.
-
Error 49.38.07 Error (4A04) on Laserjet M551
One of our printers recently started getting an "49.38.07 Error (4A04)" message during bootup. I have downloaded the latest firmware to my PC but I don't know how to install it. There are no USB ports on the printer to plug a thumbdrive into. I ac
-
My screen has locked in portrait view on email?
Can't put my screen on landscape view when using email. All other screens ok, with option of landscape or portrait. I've obviously done something, as it was ok up until recently
-
Background: Im creating an ASP .Net app in VS2005. Local machine has SQL express installed and server has developer edition of SQL 2005. When it tries to create the database file on a UNC share it comes up with an error "The file "\\server\Visual Stu
-
Power Mac G5 won´t start
Hi, when I went to bed last night I put the computer on sleep. This morning when I tried to make it start by moving the mouse and pressing the keys on the keyboard nothing happened. The led is on, but is on steady, it doesn´t slowly blink as usual. I