@Override public void setUI( TableUI ui ) { JBroTableUI oldUI = getUI(); if ( oldUI != null || ui instanceof JBroTableUI ) { super.setUI( ui ); if ( !( ui instanceof JBroTableUI ) ) { if ( ui != null ) ui.uninstallUI( this ); this.ui = oldUI; oldUI.setNoDefaults( true ); oldUI.installUI( this ); oldUI.setNoDefaults( false ); firePropertyChange( "UI", ui, oldUI ); refresh(); } } }
/** * Maps {@code JTable.getUI()} through queue */ public TableUI getUI() { return (runMapping(new MapAction<TableUI>("getUI") { @Override public TableUI map() { return ((JTable) getSource()).getUI(); } })); }
/** * Maps {@code JTable.setUI(TableUI)} through queue */ public void setUI(final TableUI tableUI) { runMapping(new MapVoidAction("setUI") { @Override public void map() { ((JTable) getSource()).setUI(tableUI); } }); }
/** * This method sets the table's UI delegate. * * @param ui The table's UI delegate. */ public void setUI(TableUI ui) { super.setUI(ui); // The editors and renderers must be recreated because they constructors // may use the look and feel properties. createDefaultEditors(); createDefaultRenderers(); }
/** * Standard JTable's UI has non convenient keybinding for * editing. Therefore we have to replace some standard actions. */ public void setUI(final TableUI ui){ super.setUI(ui); // Customize action and input maps @NonNls final ActionMap actionMap=getActionMap(); @NonNls final InputMap focusedInputMap=getInputMap(JComponent.WHEN_FOCUSED); @NonNls final InputMap ancestorInputMap=getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); actionMap.put("selectPreviousRow",new MySelectPreviousRowAction()); actionMap.put("selectNextRow",new MySelectNextRowAction()); actionMap.put("startEditing",new MyStartEditingAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F2,0),"startEditing"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_F2,0)); actionMap.put("smartEnter",new MyEnterAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0),"smartEnter"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER,0)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),"cancel"); ancestorInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE,0),"cancel"); actionMap.put("expandCurrent", new MyExpandCurrentAction(true)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD,0),"expandCurrent"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ADD,0)); actionMap.put("collapseCurrent", new MyExpandCurrentAction(false)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,0),"collapseCurrent"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT,0)); }
public void updateUI() { // Update the UI of the table header if (tableHeader != null && tableHeader.getParent() == null) { tableHeader.updateUI(); } setUI((TableUI) UIManager.getUI(this)); }
public void testGetSetUpdateUI() throws Exception { assertTrue(table.getUI() instanceof BasicTableUI); TableUI ui = new BasicTableUI(); table.setUI(ui); assertSame(ui, table.getUI()); table.updateUI(); assertNotSame(ui, table.getUI()); }
/** * Morten Alver: This override is a workaround NullPointerException when * dragging stuff into the table. I found this in a forum, but have no idea * why it works. * @param newUI */ @Override public void setUI(TableUI newUI) { super.setUI(newUI); TransferHandler handler = getTransferHandler(); setTransferHandler(null); setTransferHandler(handler); }
/** * Standard JTable's UI has non convenient keybinding for * editing. Therefore we have to replace some standard actions. */ @Override public void setUI(final TableUI ui) { super.setUI(ui); // Customize action and input maps @NonNls final ActionMap actionMap = getActionMap(); @NonNls final InputMap focusedInputMap = getInputMap(JComponent.WHEN_FOCUSED); @NonNls final InputMap ancestorInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); actionMap.put("selectPreviousRow", new MySelectPreviousRowAction()); actionMap.put("selectNextRow", new MySelectNextRowAction()); actionMap.put("startEditing", new MyStartEditingAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "startEditing"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)); actionMap.put("smartEnter", new MyEnterAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "smartEnter"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); ancestorInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); actionMap.put("expandCurrent", new MyExpandCurrentAction(true)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, 0), "expandCurrent"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, 0)); actionMap.put("collapseCurrent", new MyExpandCurrentAction(false)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, 0), "collapseCurrent"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, 0)); }
@Override public void setUI(TableUI ui) { super.setUI(ui); renderer = null; sheetCellEditor = null; }
public void setUI(TableUI ui) { needCalcRowHeight = true; inSetUI = true; super.setUI(ui); inSetUI = false; }
@Override public void setUI( TableUI ui ) { super.setUI( new TabTableUI() ); }
@Override public void setUI( TableUI ui ) { super.setUI( new TaskListTableUI() ); setTableHeader( createDefaultTableHeader() ); }
public TableUI getUI() { AndroidClassUtil.callEmptyMethod(); return null; }
public void setUI(TableUI ui) { AndroidClassUtil.callEmptyMethod(); }
public void updateUI() { setUI((TableUI) UIManager.getUI(this)); }
public void setUI(TableUI ui) { super.setUI(ui); // Customize action and input maps ActionMap actionMap = getActionMap(); setFocusTraversalKeys( KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalKeys(KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS)); setFocusTraversalKeys( KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.getCurrentKeyboardFocusManager().getDefaultFocusTraversalKeys(KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS)); InputMap focusedInputMap = getInputMap(JComponent.WHEN_FOCUSED); InputMap ancestorInputMap = getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); actionMap.put("selectPreviousRow", new MySelectNextPreviousRowAction(false)); actionMap.put("selectNextRow", new MySelectNextPreviousRowAction(true)); actionMap.put("startEditing", new MyStartEditingAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0), "startEditing"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_F2, 0)); actionMap.put("smartEnter", new MyEnterAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0), "smartEnter"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); ancestorInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancel"); actionMap.put("restoreDefault", new MyRestoreDefaultAction()); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "restoreDefault"); ancestorInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, 0), "restoreDefault"); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "restoreDefault"); ancestorInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SPACE, 0), "restoreDefault"); actionMap.put("expandCurrent", new MyExpandCurrentAction(true, false)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, 0), "expandCurrent"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, 0)); actionMap.put("expandCurrentRight", new MyExpandCurrentAction(true, true)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0), "expandCurrentRight"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0), "expandCurrentRight"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0)); actionMap.put("collapseCurrent", new MyExpandCurrentAction(false, false)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, 0), "collapseCurrent"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, 0)); actionMap.put("collapseCurrentLeft", new MyExpandCurrentAction(false, true)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0), "collapseCurrentLeft"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)); focusedInputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0), "collapseCurrentLeft"); ancestorInputMap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0)); }
public TableUI getUI() { return (TableUI) ui; }
public void setUI(TableUI ui) { super.setUI(ui); }
@Override public void updateUI() { setUI((TableUI) UIManager.getUI(this)); }