private InputMap getInputMap(int condition) { if (condition == JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT) { return (InputMap) UIManager.get("Grid.ancestorInputMap"); } else { return null; } }
private ActionMap getActionMap() { ActionMap actionMap = (ActionMap) UIManager.get("Grid.actionMap"); if (actionMap == null) { actionMap = createActionMap(); if (actionMap != null) { UIManager.put("Grid.actionMap", actionMap); } } return actionMap; }
public HelpFrame(String helpFileName) { super("Help", true, true, true, true); setFrameIcon( (Icon) UIManager.get( "Tree.openIcon")); // PENDING(steve) need more general palce to get this icon setBounds(200, 25, 400, 400); HtmlPane html = new HtmlPane(helpFileName); setContentPane(html); }
private int getMnemonic(String key, Locale l) { String value = (String) UIManager.get(key, l); if (value == null) { return 0; } try { return Integer.parseInt(value); } catch (NumberFormatException nfe) { } return 0; }
protected void installDefaults() { Color defaultGridColor = UIManager.getColor("Table.gridColor"); Color defaultForegroundColor = UIManager.getColor("Table.foreground"); Color defaultBackgroundColor = UIManager.getColor("Table.background"); Border defaultBorder = UIManager.getBorder("Table.scrollPaneBorder"); Color defaultSelectionForeground = UIManager.getColor("Table.selectionForeground"); Color defaultSelectionBackground = UIManager.getColor("Table.selectionBackground"); Color defaultFocusCellForeground = UIManager.getColor("Table.focusCellForeground"); Color defaultFocusCellBackground = new Color(153, 153, 204); Font defaultFont = UIManager.getFont("Table.font"); Border defaultGridBorder = UIManager.getBorder("Table.border"); InputMap inputMap = (InputMap) UIManager.get("Table.ancestorInputMap"); if (!installed) { UIManager.getDefaults().put("Grid.gridColor", defaultGridColor); UIManager.getDefaults().put("Grid.foreground", defaultForegroundColor); UIManager.getDefaults().put("Grid.background", defaultBackgroundColor); UIManager.getDefaults().put("Grid.selectionForegroundColor", defaultSelectionForeground); UIManager.getDefaults().put("Grid.selectionBackgroundColor", defaultSelectionBackground); UIManager.getDefaults().put("Grid.focusForegroundColor", defaultFocusCellForeground); UIManager.getDefaults().put("Grid.focusBackgroundColor", defaultFocusCellBackground); UIManager.getDefaults().put("Grid.border", defaultGridBorder); UIManager.getDefaults().put("Grid.font", defaultFont); UIManager.getDefaults().put("Grid.scrollPaneBorder", defaultBorder); UIManager.getDefaults().put("Grid.ancestorInputMap", inputMap); installed = true; } Color foregroundColor = grid.getForeground(); Color backgroundColor = grid.getBackground(); Font font = grid.getFont(); Border border = grid.getBorder(); Color gridColor = grid.getGridColor(); Color selectionForeground = grid.getSelectionForegroundColor(); Color selectionBackground = grid.getSelectionBackgroundColor(); Color focusForeground = grid.getFocusForegroundColor(); Color focusBackground = grid.getFocusBackgroundColor(); if (foregroundColor == null || foregroundColor instanceof UIResource) grid.setForeground(defaultForegroundColor); if (backgroundColor == null || backgroundColor instanceof UIResource) grid.setBackground(defaultBackgroundColor); if (font == null || font instanceof UIResource) grid.setFont(defaultFont); if (gridColor == null || gridColor instanceof UIResource) grid.setGridColor(defaultGridColor); if (border == null || border instanceof UIResource) grid.setBorder(defaultGridBorder); if (selectionForeground == null || selectionForeground instanceof UIResource) grid.setSelectionForegroundColor(defaultSelectionForeground); if (selectionBackground == null || selectionBackground instanceof UIResource) grid.setSelectionBackgroundColor(defaultSelectionBackground); if (focusForeground == null || focusForeground instanceof UIResource) grid.setFocusForegroundColor(defaultFocusCellForeground); if (focusBackground == null || focusBackground instanceof UIResource) grid.setFocusBackgroundColor(defaultFocusCellBackground); }