コード例 #1
0
 private JTextField createColorField(boolean hex) {
   final NumberDocument doc = new NumberDocument(hex);
   int lafFix = UIUtil.isUnderWindowsLookAndFeel() || UIUtil.isUnderDarcula() ? 1 : 0;
   UIManager.LookAndFeelInfo info = LafManager.getInstance().getCurrentLookAndFeel();
   if (info != null
       && (info.getName().startsWith("IDEA") || info.getName().equals("Windows Classic")))
     lafFix = 1;
   final JTextField field;
   if (SystemInfo.isMac && UIUtil.isUnderIntelliJLaF()) {
     field = new JTextField("");
     field.setDocument(doc);
     field.setPreferredSize(new Dimension(hex ? 60 : 40, 26));
   } else {
     field = new JTextField(doc, "", (hex ? 5 : 2) + lafFix);
     field.setSize(50, -1);
   }
   doc.setSource(field);
   field.getDocument().addDocumentListener(this);
   field.addFocusListener(
       new FocusAdapter() {
         @Override
         public void focusGained(final FocusEvent e) {
           field.selectAll();
         }
       });
   return field;
 }
コード例 #2
0
 private static boolean isTableDecorationSupported() {
   return UIUtil.isUnderAlloyLookAndFeel()
       || UIUtil.isUnderNativeMacLookAndFeel()
       || UIUtil.isUnderQuaquaLookAndFeel()
       || UIUtil.isUnderMetalLookAndFeel()
       || UIUtil.isUnderNimbusLookAndFeel()
       || UIUtil.isUnderWindowsLookAndFeel();
 }
コード例 #3
0
 @Override
 public void setUI(ProgressBarUI ui) {
   boolean nativeLaf =
       UIUtil.isUnderWindowsLookAndFeel()
           || UIUtil.isUnderAquaLookAndFeel()
           || UIUtil.isUnderGTKLookAndFeel();
   if (nativeLaf) {
     ui = new DarculaProgressBarUI();
   }
   super.setUI(ui);
   if (nativeLaf) {
     setPreferredSize(new Dimension(getPreferredSize().width, JBUI.scale(NATIVE_LAF_HEIGHT)));
   }
 }
コード例 #4
0
 private void updateIcon(AnAction action) {
   if (isToggleable()
       && (myPresentation.getIcon() == null
           || myInsideCheckedGroup
           || !UISettings.getInstance().SHOW_ICONS_IN_MENUS)) {
     action.update(myEvent);
     myToggled =
         Boolean.TRUE.equals(
             myEvent.getPresentation().getClientProperty(Toggleable.SELECTED_PROPERTY));
     if (ActionPlaces.MAIN_MENU.equals(myPlace) && SystemInfo.isMacSystemMenu
         || UIUtil.isUnderNimbusLookAndFeel()
         || UIUtil.isUnderWindowsLookAndFeel() && SystemInfo.isWin7OrNewer) {
       setState(myToggled);
     } else if (!(getUI() instanceof GtkMenuItemUI)) {
       if (myToggled) {
         setIcon(ourCheckedIcon);
         setDisabledIcon(IconLoader.getDisabledIcon(ourCheckedIcon));
       } else {
         setIcon(ourUncheckedIcon);
         setDisabledIcon(IconLoader.getDisabledIcon(ourUncheckedIcon));
       }
     }
   } else {
     if (UISettings.getInstance().SHOW_ICONS_IN_MENUS) {
       Icon icon = myPresentation.getIcon();
       if (action instanceof ToggleAction && ((ToggleAction) action).isSelected(myEvent)) {
         icon = new PoppedIcon(icon, 16, 16);
       }
       setIcon(icon);
       if (myPresentation.getDisabledIcon() != null) {
         setDisabledIcon(myPresentation.getDisabledIcon());
       } else {
         setDisabledIcon(IconLoader.getDisabledIcon(icon));
       }
     }
   }
 }