5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javax.swing.tree;
27
28 import javax.swing.*;
29 import javax.swing.border.*;
30 import javax.swing.event.*;
31 import javax.swing.plaf.FontUIResource;
32 import java.awt.*;
33 import java.awt.event.*;
34 import java.util.EventObject;
35
36 /**
37 * A <code>TreeCellEditor</code>. You need to supply an
38 * instance of <code>DefaultTreeCellRenderer</code>
39 * so that the icons can be obtained. You can optionally supply
40 * a <code>TreeCellEditor</code> that will be layed out according
41 * to the icon in the <code>DefaultTreeCellRenderer</code>.
42 * If you do not supply a <code>TreeCellEditor</code>,
43 * a <code>TextField</code> will be used. Editing is started
44 * on a triple mouse click, or after a click, pause, click and
45 * a delay of 1200 milliseconds.
46 *<p>
47 * <strong>Warning:</strong>
48 * Serialized objects of this class will not be compatible with
49 * future Swing releases. The current serialization support is
50 * appropriate for short term storage or RMI between applications running
51 * the same version of Swing. As of 1.4, support for long term storage
52 * of all JavaBeans™
53 * has been added to the <code>java.beans</code> package.
575 protected Border border;
576
577 /**
578 * Constructs a
579 * <code>DefaultTreeCellEditor.DefaultTextField</code> object.
580 *
581 * @param border a <code>Border</code> object
582 * @since 1.4
583 */
584 public DefaultTextField(Border border) {
585 setBorder(border);
586 }
587
588 /**
589 * Sets the border of this component.<p>
590 * This is a bound property.
591 *
592 * @param border the border to be rendered for this component
593 * @see Border
594 * @see CompoundBorder
595 * @beaninfo
596 * bound: true
597 * preferred: true
598 * attribute: visualUpdate true
599 * description: The component's border.
600 */
601 public void setBorder(Border border) {
602 super.setBorder(border);
603 this.border = border;
604 }
605
606 /**
607 * Overrides <code>JComponent.getBorder</code> to
608 * returns the current border.
609 */
610 public Border getBorder() {
611 return border;
612 }
613
614 // implements java.awt.MenuContainer
615 public Font getFont() {
616 Font font = super.getFont();
617
618 // Prefer the parent containers font if our font is a
619 // FontUIResource
620 if(font instanceof FontUIResource) {
|
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25 package javax.swing.tree;
26
27 import javax.swing.*;
28 import javax.swing.border.*;
29 import javax.swing.event.*;
30 import javax.swing.plaf.FontUIResource;
31 import java.awt.*;
32 import java.awt.event.*;
33 import java.beans.BeanProperty;
34 import java.util.EventObject;
35
36 /**
37 * A <code>TreeCellEditor</code>. You need to supply an
38 * instance of <code>DefaultTreeCellRenderer</code>
39 * so that the icons can be obtained. You can optionally supply
40 * a <code>TreeCellEditor</code> that will be layed out according
41 * to the icon in the <code>DefaultTreeCellRenderer</code>.
42 * If you do not supply a <code>TreeCellEditor</code>,
43 * a <code>TextField</code> will be used. Editing is started
44 * on a triple mouse click, or after a click, pause, click and
45 * a delay of 1200 milliseconds.
46 *<p>
47 * <strong>Warning:</strong>
48 * Serialized objects of this class will not be compatible with
49 * future Swing releases. The current serialization support is
50 * appropriate for short term storage or RMI between applications running
51 * the same version of Swing. As of 1.4, support for long term storage
52 * of all JavaBeans™
53 * has been added to the <code>java.beans</code> package.
575 protected Border border;
576
577 /**
578 * Constructs a
579 * <code>DefaultTreeCellEditor.DefaultTextField</code> object.
580 *
581 * @param border a <code>Border</code> object
582 * @since 1.4
583 */
584 public DefaultTextField(Border border) {
585 setBorder(border);
586 }
587
588 /**
589 * Sets the border of this component.<p>
590 * This is a bound property.
591 *
592 * @param border the border to be rendered for this component
593 * @see Border
594 * @see CompoundBorder
595 */
596 @BeanProperty(preferred = true, visualUpdate = true, description
597 = "The component's border.")
598 public void setBorder(Border border) {
599 super.setBorder(border);
600 this.border = border;
601 }
602
603 /**
604 * Overrides <code>JComponent.getBorder</code> to
605 * returns the current border.
606 */
607 public Border getBorder() {
608 return border;
609 }
610
611 // implements java.awt.MenuContainer
612 public Font getFont() {
613 Font font = super.getFont();
614
615 // Prefer the parent containers font if our font is a
616 // FontUIResource
617 if(font instanceof FontUIResource) {
|