Exemplo n.º 1
0
 /** {@inheritDoc} */
 @Override
 protected void installDefaults() {
   // Installs the text cursor on the component
   super.installDefaults();
   updateStyle(getComponent());
   getComponent().addFocusListener(handler);
 }
Exemplo n.º 2
0
  /**
   * This method gets called when a bound property is changed on the associated JTextComponent. This
   * is a hook which UI implementations may change to reflect how the UI displays bound properties
   * of JTextComponent subclasses. This is implemented to do nothing (i.e. the response to
   * properties in JTextComponent itself are handled prior to calling this method).
   *
   * @param evt the property change event
   */
  protected void propertyChange(PropertyChangeEvent evt) {
    if (SeaGlassLookAndFeel.shouldUpdateStyle(evt)) {
      updateStyle((JTextComponent) evt.getSource());
    }

    super.propertyChange(evt);
  }
Exemplo n.º 3
0
  protected void uninstallDefaults() {
    super.uninstallDefaults();

    if (!GraphicsEnvironment.isHeadless()) {
      getComponent().setDragEnabled(oldDragState);
    }
  }
Exemplo n.º 4
0
  protected void installDefaults() {
    if (!GraphicsEnvironment.isHeadless()) {
      oldDragState = getComponent().getDragEnabled();
      getComponent().setDragEnabled(true);
    }

    super.installDefaults();
  }
Exemplo n.º 5
0
  /** @see javax.swing.plaf.basic.BasicTextUI#installDefaults() */
  protected void installDefaults() {
    // Installs the text cursor on the component
    super.installDefaults();

    JTextComponent c = getComponent();

    updateStyle(c);
    c.addFocusListener(this);
  }
Exemplo n.º 6
0
  protected void uninstallListeners() {
    final JTextComponent c = getComponent();
    AquaTextFieldSearch.uninstallSearchFieldListener(c);
    AquaUtilControlSize.removeSizePropertyListener(c);
    c.removeFocusListener(handler);
    c.removePropertyChangeListener(handler);
    handler = null;

    super.uninstallListeners();
  }
Exemplo n.º 7
0
  /** {@inheritDoc} */
  @Override
  protected void uninstallDefaults() {
    SynthContext context = getContext(getComponent(), ENABLED);

    getComponent().putClientProperty("caretAspectRatio", null);
    getComponent().removeFocusListener(handler);

    style.uninstallDefaults(context);
    style = null;
    super.uninstallDefaults();
  }
Exemplo n.º 8
0
  protected void installListeners() {
    super.installListeners();

    handler = new AquaFocusHandler();
    final JTextComponent c = getComponent();
    c.addFocusListener(handler);
    c.addPropertyChangeListener(handler);

    LookAndFeel.installProperty(c, "opaque", UIManager.getBoolean(getPropertyPrefix() + "opaque"));
    AquaUtilControlSize.addSizePropertyListener(c);
    AquaTextFieldSearch.installSearchFieldListener(c);
  }
Exemplo n.º 9
0
 @Override
 protected void paintSafely(Graphics g) {
   super.paintSafely(g);
   JTextComponent comp = getComponent();
   if (hint != null && comp.getText().length() == 0 && (!(hideOnFocus && comp.hasFocus()))) {
     if (color != null) {
       g.setColor(color);
     } else {
       g.setColor(comp.getForeground().brighter().brighter().brighter());
     }
     int padding = (comp.getHeight() - comp.getFont().getSize()) / 2;
     g.drawString(hint, 3, comp.getHeight() - padding - 1);
   }
 }
Exemplo n.º 10
0
 protected void paintBackground(Graphics g) {
   super.paintBackground(g);
   //        Color c = BlueLookAndFeel.getControlShadow().darker();
   //        g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 64));
   //        g.drawLine(0, 1, myComponent.getWidth() - 1, 1);
   //
   //        g.setColor(new Color(c.getRed(), c.getGreen(), c.getBlue(), 32));
   //        g.drawLine(0, 2, myComponent.getWidth() - 1, 2);
   // Rectangle editorRect = getVisibleEditorRect();
   // Graphics2D g2D = (Graphics2D) g;
   // // paint one gradient in the upper half of the text field
   // GradientPaint gradient = new GradientPaint(0.0f, 0.0f, col1, 0.0f,
   // (float) myComponent.getHeight() * 2 / 3, col2);
   // g2D.setPaint(gradient);
   // g2D.fill(editorRect);
 }
Exemplo n.º 11
0
  /** @see javax.swing.plaf.basic.BasicTextUI#uninstallDefaults() */
  protected void uninstallDefaults() {
    JTextComponent c = getComponent();
    SeaGlassContext context = getContext(c, ENABLED);

    // Remove the search border, if present.
    Border border = c.getBorder();

    if (border instanceof TextFieldBorder) {
      c.setBorder(null);
    }

    c.putClientProperty("caretAspectRatio", null);
    c.removeFocusListener(this);

    style.uninstallDefaults(context);
    context.dispose();
    style = null;

    super.uninstallDefaults();
  }
Exemplo n.º 12
0
 @Override
 protected void installListeners() {
   super.installListeners();
   getComponent().addFocusListener(this);
 }
Exemplo n.º 13
0
 // Install a default keypress action which handles Cmd and Option keys properly
 protected void installKeyboardActions() {
   super.installKeyboardActions();
   AquaKeyBindings.instance().setDefaultAction(getKeymapName());
 }
Exemplo n.º 14
0
 @Override
 protected void uninstallListeners() {
   super.uninstallListeners();
   getComponent().removeFocusListener(this);
 }
Exemplo n.º 15
0
  /**
   * Paints the interface. This is routed to the paintSafely method under the guarantee that the
   * model won't change from the view of this thread while it's rendering (if the associated model
   * is derived from AbstractDocument). This enables the model to potentially be updated
   * asynchronously.
   *
   * @param context DOCUMENT ME!
   * @param g DOCUMENT ME!
   */
  protected void paint(SeaGlassContext context, Graphics g) {
    JTextComponent c = getComponent();

    super.paint(g, c);
  }
Exemplo n.º 16
0
 protected void paintSafely(final Graphics g) {
   paintBackgroundSafely(g);
   super.paintSafely(g);
 }
Exemplo n.º 17
0
 /** @see javax.swing.plaf.basic.BasicTextUI#uninstallListeners() */
 @Override
 protected void uninstallListeners() {
   super.uninstallListeners();
   uninstallMouseListeners();
 }
Exemplo n.º 18
0
 /**
  * Paints the specified component.
  *
  * <p>This is routed to the {@link #paintSafely} method under the guarantee that the model does
  * not change from the view of this thread while it is rendering (if the associated model is
  * derived from {@code AbstractDocument}). This enables the model to potentially be updated
  * asynchronously.
  *
  * @param context context for the component being painted
  * @param g the {@code Graphics} object used for painting
  * @see #update(Graphics,JComponent)
  */
 protected void paint(SynthContext context, Graphics g) {
   super.paint(g, getComponent());
 }
Exemplo n.º 19
0
 /** @see javax.swing.plaf.basic.BasicTextUI#installUI(javax.swing.JComponent) */
 public void installUI(JComponent c) {
   super.installUI(c);
   updateStyle((JTextComponent) c);
 }
 /**
  * This method gets called when a bound property is changed on the associated JTextComponent. This
  * is a hook which UI implementations may change to reflect how the UI displays bound properties
  * of JTextComponent subclasses.
  *
  * @param evt the property change event
  */
 public void propertyChange(PropertyChangeEvent evt) {
   super.propertyChange(evt);
 }