Esempio n. 1
0
 /** Update fonts. */
 public void updateFonts() {
   if (hasFocus && dockManager.hasFullFocusSystem()) {
     titleLabel.setFont(app.getBoldFont());
   } else {
     titleLabel.setFont(app.getPlainFont());
   }
   updateIcons();
 }
  public void updateFont() {

    Font font = app.getPlainFont();

    cbShowFormulaBar.setFont(font);
    cbShowGrid.setFont(font);
    cbShowColumnHeader.setFont(font);
    cbShowRowHeader.setFont(font);
    cbShowHScrollbar.setFont(font);
    cbShowVScrollbar.setFont(font);
    cbAllowSpecialEditor.setFont(font);
    cbAllowToolTips.setFont(font);
    cbPrependCommands.setFont(font);
    cbEnableAutoComplete.setFont(font);
    cbShowNavigation.setFont(font);
  }
Esempio n. 3
0
  /**
   * create the focus panel (composed of titleLabel, and, for EuclidianDockPanels, focus icon)
   *
   * @return the focus panel
   */
  protected JComponent createFocusPanel() {
    titleLabel = new JLabel(loc.getPlain(title));
    titleLabel.setFont(app.getPlainFont());
    titleLabel.setForeground(Color.darkGray);

    JPanel p = new JPanel(new FlowLayout(app.flowLeft(), 2, 1));

    if (app.getLocalization().isRightToLeftReadingOrder()) {
      p.add(titleLabel);
      p.add(Box.createHorizontalStrut(2));
      if (this.hasStyleBar) {
        p.add(this.toggleStyleBarButton);
      }
    } else {
      if (this.hasStyleBar) {
        p.add(this.toggleStyleBarButton);
      }
      p.add(Box.createHorizontalStrut(2));
      p.add(titleLabel);
    }
    return p;
  }
Esempio n. 4
0
  private void createTextButtons() {

    // ========================
    // text color button
    final Dimension textColoriconHeight = new Dimension(iconHeight, iconHeight);

    btnTextColor =
        new ColorPopupMenuButton(
            app, textColoriconHeight, ColorPopupMenuButton.COLORSET_DEFAULT, false) {

          private static final long serialVersionUID = 1L;

          private Color geoColor;

          @Override
          public void update(Object[] geos) {

            boolean geosOK = checkGeoText(geos);
            setVisible(geosOK);

            if (geosOK) {
              GeoElement geo = ((GeoElement) geos[0]).getGeoElementForPropertiesDialog();
              geoColor =
                  org.geogebra.desktop.awt.GColorD.getAwtColor(((GeoCasCell) geo).getFontColor());
              updateColorTable();

              // find the geoColor in the table and select it
              int index = this.getColorIndex(geoColor);
              setSelectedIndex(index);

              // if nothing was selected, set the icon to show the
              // non-standard color
              if (index == -1) {
                this.setIcon(getButtonIcon());
              }

              setFgColor(geoColor);
              setFontStyle(((TextProperties) geo).getFontStyle());
            }
          }

          @Override
          public ImageIcon getButtonIcon() {
            return GeoGebraIcon.createTextSymbolIcon(
                "A",
                app.getPlainFont(),
                textColoriconHeight,
                org.geogebra.desktop.awt.GColorD.getAwtColor(getSelectedColor()),
                null);
          }
        };

    btnTextColor.addActionListener(this);

    // ========================================
    // use as text button
    ImageIcon useAsTextIcon =
        GeoGebraIcon.createStringIcon(
            app.getPlain("Text").substring(0, 1),
            app.getPlainFont(),
            true,
            false,
            true,
            iconDimension,
            Color.black,
            null);
    btnUseAsText =
        new MyToggleButton(useAsTextIcon, iconHeight) {

          private static final long serialVersionUID = 1L;

          @Override
          public void update(Object[] geos) {

            setVisible(true);
            btnUseAsText.setSelected(checkGeoText(geos));
          }
        };
    btnUseAsText.addActionListener(this);

    // ========================================
    // bold text button
    ImageIcon boldIcon =
        GeoGebraIcon.createStringIcon(
            app.getPlain("Bold").substring(0, 1),
            app.getPlainFont(),
            true,
            false,
            true,
            iconDimension,
            Color.black,
            null);
    btnBold =
        new MyToggleButton(boldIcon, iconHeight) {

          private static final long serialVersionUID = 1L;

          @Override
          public void update(Object[] geos) {

            boolean geosOK = checkGeoText(geos);
            setVisible(geosOK);
            if (geosOK) {
              GeoElement geo = ((GeoElement) geos[0]).getGeoElementForPropertiesDialog();
              int style = ((GeoCasCell) geo).getGeoText().getFontStyle();
              btnBold.setSelected(style == Font.BOLD || style == (Font.BOLD + Font.ITALIC));
            }
          }
        };
    btnBold.addActionListener(this);

    // ========================================
    // italic text button
    ImageIcon italicIcon =
        GeoGebraIcon.createStringIcon(
            app.getPlain("Italic").substring(0, 1),
            app.getPlainFont(),
            false,
            true,
            true,
            iconDimension,
            Color.black,
            null);
    btnItalic =
        new MyToggleButton(italicIcon, iconHeight) {

          private static final long serialVersionUID = 1L;

          @Override
          public void update(Object[] geos) {

            boolean geosOK = checkGeoText(geos);
            setVisible(geosOK);
            this.setVisible(geosOK);
            if (geosOK) {
              GeoElement geo = ((GeoElement) geos[0]).getGeoElementForPropertiesDialog();
              int style = ((GeoCasCell) geo).getGeoText().getFontStyle();
              btnItalic.setSelected(style == Font.ITALIC || style == (Font.BOLD + Font.ITALIC));
            }
          }
        };
    btnItalic.addActionListener(this);

    // ========================================
    // text size button

    String[] textSizeArray = app.getLocalization().getFontSizeStrings();

    btnTextSize =
        new PopupMenuButton(
            app,
            textSizeArray,
            -1,
            1,
            new Dimension(-1, iconHeight),
            org.geogebra.common.gui.util.SelectionTable.MODE_TEXT) {

          private static final long serialVersionUID = 1L;

          @Override
          public void update(Object[] geos) {

            boolean geosOK = checkGeoText(geos);
            setVisible(geosOK);

            if (geosOK) {
              GeoElement geo = ((GeoElement) geos[0]);
              setSelectedIndex(
                  GeoText.getFontSizeIndex(
                      ((GeoCasCell) geo).getFontSizeMultiplier())); // font size
              // ranges from
              // -4 to 4, transform
              // this to 0,1,..,4
            }
          }
        };
    btnTextSize.addActionListener(this);
    btnTextSize.setKeepVisible(false);
  }
Esempio n. 5
0
 /** sets the title label when this has not the focus */
 protected void setTitleLabelFocus() {
   if (dockManager.hasFullFocusSystem()) {
     if (titleIsBold()) titleLabel.setFont(app.getBoldFont());
     else titleLabel.setFont(app.getPlainFont());
   }
 }