public void installUI(JComponent c) { super.installUI(c); c.setFocusable(false); AlgebraTheme theme = AlgebraTheme.getInstance(); c.setBackground(theme.getHighlightPaper()); c.setForeground(theme.getHighlightInk()); }
GitManualPushToBranch( @NotNull Collection<GitRepository> repositories, @NotNull final Runnable performOnRefresh) { super(); myRepositories = repositories; myManualPush = new JCheckBox("Push current branch to alternative branch: ", false); myManualPush.setMnemonic('b'); myDestBranchTextField = new JTextField(20); myComment = new JBLabel("This will apply to all selected repositories", UIUtil.ComponentStyle.SMALL); myRefreshAction = new GitPushLogRefreshAction() { @Override public void actionPerformed(AnActionEvent e) { performOnRefresh.run(); } }; myRefreshButton = new ActionButton( myRefreshAction, myRefreshAction.getTemplatePresentation(), myRefreshAction.getTemplatePresentation().getText(), ActionToolbar.DEFAULT_MINIMUM_BUTTON_SIZE); myRefreshButton.setFocusable(true); final ShortcutSet shortcutSet = ActionManager.getInstance().getAction(IdeActions.ACTION_REFRESH).getShortcutSet(); myRefreshAction.registerCustomShortcutSet(shortcutSet, myRefreshButton); myRemoteSelector = new RemoteSelector(getRemotesWithCommonNames(repositories)); myRemoteSelectorComponent = myRemoteSelector.createComponent(); setDefaultComponentsEnabledState(myManualPush.isSelected()); myManualPush.addActionListener( new ActionListener() { @Override public void actionPerformed(ActionEvent e) { boolean isManualPushSelected = myManualPush.isSelected(); setDefaultComponentsEnabledState(isManualPushSelected); if (isManualPushSelected) { myDestBranchTextField.requestFocus(); myDestBranchTextField.selectAll(); } } }); layoutComponents(); }
@Override public void setParent(final JComponent parent) { SwingUtilities.invokeLater( () -> { final JScrollPane scrollPane = new JScrollPane(tree); scrollPane.setAutoscrolls(true); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); parent.setVisible(false); parent.setLayout(new MigLayout("ins 0, fill")); parent.add(scrollPane, "grow"); parent.setFocusable(false); parent.setVisible(true); setColours(); eventBus.subscribe(this); swingEventBus.subscribe(this); redoTreeView(); }); }
private void installFocusable( final JComponent comp, final AnAction action, final int prevKeyCode, final int nextKeyCode, final boolean focusListOnLeft) { comp.setFocusable(true); comp.setFocusTraversalKeysEnabled(true); comp.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { final JList list = UIUtil.findComponentOfType(FlatWelcomeFrame.this.getComponent(), JList.class); if (e.getKeyCode() == KeyEvent.VK_ENTER) { InputEvent event = e; if (e.getComponent() instanceof JComponent) { ActionLink link = UIUtil.findComponentOfType((JComponent) e.getComponent(), ActionLink.class); if (link != null) { event = new MouseEvent( link, MouseEvent.MOUSE_CLICKED, e.getWhen(), e.getModifiers(), 0, 0, 1, false, MouseEvent.BUTTON1); } } action.actionPerformed( AnActionEvent.createFromAnAction( action, event, ActionPlaces.WELCOME_SCREEN, DataManager.getInstance().getDataContext())); } else if (e.getKeyCode() == prevKeyCode) { focusPrev(comp); } else if (e.getKeyCode() == nextKeyCode) { focusNext(comp); } else if (e.getKeyCode() == KeyEvent.VK_LEFT) { if (focusListOnLeft) { if (list != null) { list.requestFocus(); } } else { focusPrev(comp); } } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) { focusNext(comp); } } }); comp.addFocusListener( new FocusListener() { @Override public void focusGained(FocusEvent e) { comp.setOpaque(true); comp.setBackground(getActionLinkSelectionColor()); } @Override public void focusLost(FocusEvent e) { comp.setOpaque(false); comp.setBackground(getMainBackground()); } }); }
/** Constructor de clase */ public MyCellEditor() { super(new JCheckBox()); component.setFocusCycleRoot(false); component.setFocusable(false); }
private static JSplitPane createSplitPane() { // Help tab is used by drawing view. Initialize it first // helpTab = new JScrollPane(new HelpView()); // helpTab = new HelpView(); recognizedTab = new JScrollPane(new RecognizedView()); // 25-09-09 helpDrawingView = new HelpDrawingView(); helpSubTab = helpDrawingView.DrawingWindow(); helpRecognizeView = new HelpRecognizeView(); helpRecognizeTab = helpRecognizeView.constraintWindow(); dv = new DrawingView(); drawingTab = new JScrollPane(dv); drawingTab.setFocusable(true); // add Scrollbar adjustment listener to Drawing Window - horizontal and vertical final JScrollBar drawHrBar = ((JScrollPane) drawingTab).getHorizontalScrollBar(); drawHrBar.setMaximum(100); AdjustmentListener hListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { hs.setXMoved(((Adjustable) e.getSource()).getValue()); } }; drawHrBar.addAdjustmentListener(hListener); final JScrollBar drawVerBar = ((JScrollPane) drawingTab).getVerticalScrollBar(); AdjustmentListener vListener = new AdjustmentListener() { public void adjustmentValueChanged(AdjustmentEvent e) { vs.setYMoved(((Adjustable) e.getSource()).getValue()); } }; drawVerBar.addAdjustmentListener(vListener); vs = new VerticalScale(); verticalScale = new JScrollPane(vs); verticalScale.setFocusable(true); tc = new TempClass(); // just a filler above Vertical Scale tempclass = new JScrollPane(tc); tempclass.setFocusable(true); hs = new HorizontalScale(); // horizontal divider horizontalScale = new JScrollPane(hs); horizontalScale.setFocusable(true); m_LeftSplitPane = createSplitPane( JSplitPane.VERTICAL_SPLIT, tempclass, verticalScale, TOP_HORIZONTAL_DIVIDER); m_hzScaleDrawView = createSplitPane( JSplitPane.VERTICAL_SPLIT, horizontalScale, drawingTab, TOP_HORIZONTAL_DIVIDER); m_vtScaleDraw = createSplitPane( JSplitPane.HORIZONTAL_SPLIT, m_LeftSplitPane, m_hzScaleDrawView, LEFT_VERTICAL_DIVIDER); // m_upperPane = createSplitPane(JSplitPane.HORIZONTAL_SPLIT, m_vtScaleDraw,helpSubTab, // RIGHT_VERTICAL_DIVIDER); m_LowerPane = createSplitPane(JSplitPane.VERTICAL_SPLIT, m_vtScaleDraw, recognizedTab, BOTTOM_DIVIDER); m_splitpane = createSplitPane( JSplitPane.HORIZONTAL_SPLIT, m_LowerPane, helpSubTab, RIGHT_VERTICAL_DIVIDER); // m_splitpane.setResizeWeight(0.7); return m_splitpane; }
public static void main(String args[]) { JComponent ch = new JComponent() {}; ch.getAccessibleContext(); ch.isFocusTraversable(); ch.setEnabled(false); ch.setEnabled(true); ch.requestFocus(); ch.requestFocusInWindow(); ch.getPreferredSize(); ch.getMaximumSize(); ch.getMinimumSize(); ch.contains(1, 2); Component c1 = ch.add(new Component() {}); Component c2 = ch.add(new Component() {}); Component c3 = ch.add(new Component() {}); Insets ins = ch.getInsets(); ch.getAlignmentY(); ch.getAlignmentX(); ch.getGraphics(); ch.setVisible(false); ch.setVisible(true); ch.setForeground(Color.red); ch.setBackground(Color.red); for (String font : Toolkit.getDefaultToolkit().getFontList()) { for (int j = 8; j < 17; j++) { Font f1 = new Font(font, Font.PLAIN, j); Font f2 = new Font(font, Font.BOLD, j); Font f3 = new Font(font, Font.ITALIC, j); Font f4 = new Font(font, Font.BOLD | Font.ITALIC, j); ch.setFont(f1); ch.setFont(f2); ch.setFont(f3); ch.setFont(f4); ch.getFontMetrics(f1); ch.getFontMetrics(f2); ch.getFontMetrics(f3); ch.getFontMetrics(f4); } } ch.enable(); ch.disable(); ch.reshape(10, 10, 10, 10); ch.getBounds(new Rectangle(1, 1, 1, 1)); ch.getSize(new Dimension(1, 2)); ch.getLocation(new Point(1, 2)); ch.getX(); ch.getY(); ch.getWidth(); ch.getHeight(); ch.isOpaque(); ch.isValidateRoot(); ch.isOptimizedDrawingEnabled(); ch.isDoubleBuffered(); ch.getComponentCount(); ch.countComponents(); ch.getComponent(1); ch.getComponent(2); Component[] cs = ch.getComponents(); ch.getLayout(); ch.setLayout(new FlowLayout()); ch.doLayout(); ch.layout(); ch.invalidate(); ch.validate(); ch.remove(0); ch.remove(c2); ch.removeAll(); ch.preferredSize(); ch.minimumSize(); ch.getComponentAt(1, 2); ch.locate(1, 2); ch.getComponentAt(new Point(1, 2)); ch.isFocusCycleRoot(new Container()); ch.transferFocusBackward(); ch.setName("goober"); ch.getName(); ch.getParent(); ch.getGraphicsConfiguration(); ch.getTreeLock(); ch.getToolkit(); ch.isValid(); ch.isDisplayable(); ch.isVisible(); ch.isShowing(); ch.isEnabled(); ch.enable(false); ch.enable(true); ch.enableInputMethods(false); ch.enableInputMethods(true); ch.show(); ch.show(false); ch.show(true); ch.hide(); ch.getForeground(); ch.isForegroundSet(); ch.getBackground(); ch.isBackgroundSet(); ch.getFont(); ch.isFontSet(); Container c = new Container(); c.add(ch); ch.getLocale(); for (Locale locale : Locale.getAvailableLocales()) ch.setLocale(locale); ch.getColorModel(); ch.getLocation(); boolean exceptions = false; try { ch.getLocationOnScreen(); } catch (IllegalComponentStateException e) { exceptions = true; } if (!exceptions) throw new RuntimeException("IllegalComponentStateException did not occur when expected"); ch.location(); ch.setLocation(1, 2); ch.move(1, 2); ch.setLocation(new Point(1, 2)); ch.getSize(); ch.size(); ch.setSize(1, 32); ch.resize(1, 32); ch.setSize(new Dimension(1, 32)); ch.resize(new Dimension(1, 32)); ch.getBounds(); ch.bounds(); ch.setBounds(10, 10, 10, 10); ch.setBounds(new Rectangle(10, 10, 10, 10)); ch.isLightweight(); ch.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); ch.getCursor(); ch.isCursorSet(); ch.inside(1, 2); ch.contains(new Point(1, 2)); ch.isFocusable(); ch.setFocusable(true); ch.setFocusable(false); ch.transferFocus(); ch.getFocusCycleRootAncestor(); ch.nextFocus(); ch.transferFocusUpCycle(); ch.hasFocus(); ch.isFocusOwner(); ch.toString(); ch.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); ch.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); ch.setComponentOrientation(ComponentOrientation.UNKNOWN); ch.getComponentOrientation(); }