Пример #1
0
 protected void paintText(Graphics g, JMenuItem menuItem, Rectangle textRect, String text) {
   Graphics2D g2D = (Graphics2D) g;
   Object savedRenderingHint = null;
   if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
     savedRenderingHint = g2D.getRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING);
     g2D.setRenderingHint(
         RenderingHints.KEY_TEXT_ANTIALIASING,
         AbstractLookAndFeel.getTheme().getTextAntiAliasingHint());
   }
   if (menuItem.isSelected() && menuItem.isArmed()) {
     g.setColor(AbstractLookAndFeel.getMenuSelectionForegroundColor());
   } else {
     g.setColor(AbstractLookAndFeel.getMenuForegroundColor());
   }
   super.paintText(g, menuItem, textRect, text);
   if (AbstractLookAndFeel.getTheme().isTextAntiAliasingOn()) {
     g2D.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, savedRenderingHint);
   }
 }
  /** Called when a choice was made in the additional display combo box. */
  public void additionalDisplayCombo_actionPerformed() {
    int selectedIndex = additionalDisplayCombo.getSelectedIndex();
    switch (selectedIndex) {
      case HackController.SCRIPT_ADDITIONAL_DISPLAY:
        if (!scriptMenuItem.isSelected()) scriptMenuItem.setSelected(true);
        break;

      case HackController.OUTPUT_ADDITIONAL_DISPLAY:
        if (!outputMenuItem.isSelected()) outputMenuItem.setSelected(true);
        break;

      case HackController.COMPARISON_ADDITIONAL_DISPLAY:
        if (!compareMenuItem.isSelected()) compareMenuItem.setSelected(true);
        break;

      case HackController.NO_ADDITIONAL_DISPLAY:
        if (!noAdditionalDisplayMenuItem.isSelected())
          noAdditionalDisplayMenuItem.setSelected(true);
        break;
    }

    notifyControllerListeners(
        ControllerEvent.ADDITIONAL_DISPLAY_CHANGE, new Integer(selectedIndex));
  }
Пример #3
0
  public void actionPerformed(ActionEvent ev) {
    super.actionPerformed(ev);
    String com = ev.getActionCommand();

    if (com.equals("GameInformationFrame.LOAD")) // $NON-NLS-1$
    {
      loadFromFile();
    } else if (com.equals("GameInformationFrame.PRINT")) // $NON-NLS-1$
    {
      try {
        editor.print();
      } catch (Exception pex) {
        LGM.showDefaultExceptionHandler(pex);
      }
      return;
    } else if (com.equals("GameInformationFrame.SETTINGS")) // $NON-NLS-1$
    {
      if (settings == null) {
        settings = new SettingsFrame();
      }
      settings.setVisible(true);
    } else if (com.equals("GameInformationFrame.FILESAVE")) // $NON-NLS-1$
    {
      saveToFile();
      return;
    } else if (com.equals("GameInformationFrame.FONTCOLOR")) // $NON-NLS-1$
    {
      String colorStr = Messages.getString("GameInformationFrame.FONTCOLOR"); // $NON-NLS-1$
      Color c = JColorChooser.showDialog(this, colorStr, fgColor);
      if (c != null) {
        fgColor = c;
        setSelectionAttribute(StyleConstants.Foreground, c);
      }
      return;
    } else if (com.equals("GameInformationFrame.BOLD")) // $NON-NLS-1$
    {
      miBold.setSelected(tbBold.isSelected());
      setSelectionAttribute(StyleConstants.Bold, tbBold.isSelected());
      return;
    } else if (com.equals("GameInformationFrame.ITALIC")) // $NON-NLS-1$
    {
      miItalic.setSelected(tbItalic.isSelected());
      setSelectionAttribute(StyleConstants.Italic, tbItalic.isSelected());
      return;
    } else if (com.equals("GameInformationFrame.UNDERLINE")) // $NON-NLS-1$
    {
      miUnderline.setSelected(tbUnderline.isSelected());
      setSelectionAttribute(StyleConstants.Underline, tbUnderline.isSelected());
      return;
    } else if (com.equals("GameInformationFrame.MENU_BOLD")) // $NON-NLS-1$
    {
      miBold.setSelected(!miBold.isSelected());
      tbBold.setSelected(miBold.isSelected());
      setSelectionAttribute(StyleConstants.Bold, miBold.isSelected());
      return;
    } else if (com.equals("GameInformationFrame.MENU_ITALIC")) // $NON-NLS-1$
    {
      miItalic.setSelected(!miItalic.isSelected());
      tbItalic.setSelected(miItalic.isSelected());
      setSelectionAttribute(StyleConstants.Italic, miItalic.isSelected());
      return;
    } else if (com.equals("GameInformationFrame.MENU_UNDERLINE")) // $NON-NLS-1$
    {
      miUnderline.setSelected(!miUnderline.isSelected());
      tbUnderline.setSelected(miUnderline.isSelected());
      setSelectionAttribute(StyleConstants.Underline, miUnderline.isSelected());
      return;
    } else if (com.equals("GameInformationFrame.ALIGN_LEFT")) // $NON-NLS-1$
    {
      setSelectionAlignment(StyleConstants.ALIGN_LEFT);
      return;
    } else if (com.equals("GameInformationFrame.ALIGN_CENTER")) // $NON-NLS-1$
    {
      setSelectionAlignment(StyleConstants.ALIGN_CENTER);
      return;
    } else if (com.equals("GameInformationFrame.ALIGN_RIGHT")) // $NON-NLS-1$
    {
      setSelectionAlignment(StyleConstants.ALIGN_RIGHT);
      return;
    } else if (com.equals("GameInformationFrame.COLOR")) // $NON-NLS-1$
    {
      String colorStr = Messages.getString("GameInformationFrame.COLOR"); // $NON-NLS-1$
      Color c = JColorChooser.showDialog(this, colorStr, editor.getBackground());
      if (c != null) setEditorBackground(c);
      return;
    } else if (com.equals("GameInformationFrame.CUT")) // $NON-NLS-1$
    {
      editor.cut();
      return;
    } else if (com.equals("GameInformationFrame.COPY")) // $NON-NLS-1$
    {
      editor.copy();
      return;
    } else if (com.equals("GameInformationFrame.PASTE")) // $NON-NLS-1$
    {
      editor.paste();
      return;
    } else if (com.equals("GameInformationFrame.SELECTALL")) // $NON-NLS-1$
    {
      editor.selectAll();
      return;
    } else if (com.equals("GameInformationFrame.CLOSESAVE")) // $NON-NLS-1$
    {
      this.doDefaultSaveAction();
      return;
    } else if (com.equals("GameInformationFrame.CLOSE")) { // $NON-NLS-1$
      settings.setVisible(false);
    }
  }
Пример #4
0
 public void paintIcon(Component c, Graphics g, int x, int y) {
   JMenuItem b = (JMenuItem) c;
   if (b.isSelected()) {
     drawCheck(g, x, y + 1);
   }
 }