112 updateModelFromText();
113 }
114
115 public void removeUpdate(DocumentEvent e) {
116 updateModelFromText();
117 }
118
119 public void changedUpdate(DocumentEvent e) {
120 updateModelFromText();
121 }
122
123 // View method
124 public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) {
125 if (!isSettingAttributes) {
126 setTextFromModel();
127 }
128 }
129
130 // local methods
131
132 void updateYAlign(Font font) {
133 Container c = getContainer();
134 FontMetrics fm = (c != null) ? c.getFontMetrics(font) :
135 Toolkit.getDefaultToolkit().getFontMetrics(font);
136 float h = fm.getHeight();
137 float d = fm.getDescent();
138 yAlign = (h > 0) ? (h - d) / h : 0;
139 }
140
141 void resetBorder() {
142 Component comp = getComponent();
143
144 if (comp != null) {
145 if (isEndTag()) {
146 ((JPanel)comp).setBorder(EndBorder);
147 }
148 else {
149 ((JPanel)comp).setBorder(StartBorder);
150 }
151 }
|
112 updateModelFromText();
113 }
114
115 public void removeUpdate(DocumentEvent e) {
116 updateModelFromText();
117 }
118
119 public void changedUpdate(DocumentEvent e) {
120 updateModelFromText();
121 }
122
123 // View method
124 public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) {
125 if (!isSettingAttributes) {
126 setTextFromModel();
127 }
128 }
129
130 // local methods
131
132 @SuppressWarnings("deprecation")
133 void updateYAlign(Font font) {
134 Container c = getContainer();
135 FontMetrics fm = (c != null) ? c.getFontMetrics(font) :
136 Toolkit.getDefaultToolkit().getFontMetrics(font);
137 float h = fm.getHeight();
138 float d = fm.getDescent();
139 yAlign = (h > 0) ? (h - d) / h : 0;
140 }
141
142 void resetBorder() {
143 Component comp = getComponent();
144
145 if (comp != null) {
146 if (isEndTag()) {
147 ((JPanel)comp).setBorder(EndBorder);
148 }
149 else {
150 ((JPanel)comp).setBorder(StartBorder);
151 }
152 }
|