169 } |
169 } |
170 |
170 |
171 pretty_text_area.addFocusListener(new FocusAdapter { |
171 pretty_text_area.addFocusListener(new FocusAdapter { |
172 override def focusGained(e: FocusEvent) |
172 override def focusGained(e: FocusEvent) |
173 { |
173 { |
174 tip_border(3) |
174 tip_border(true) |
175 } |
175 } |
176 override def focusLost(e: FocusEvent) |
176 override def focusLost(e: FocusEvent) |
177 { |
177 { |
178 Pretty_Tooltip.hierarchy(tip) match { |
178 Pretty_Tooltip.hierarchy(tip) match { |
179 case Some((Nil, _)) => Pretty_Tooltip.dismiss(tip) |
179 case Some((Nil, _)) => Pretty_Tooltip.dismiss(tip) |
180 case _ => tip_border(1) |
180 case _ => tip_border(false) |
181 } |
181 } |
182 } |
182 } |
183 }) |
183 }) |
184 |
184 |
185 pretty_text_area.resize(Rendering.font_family(), |
185 pretty_text_area.resize(Rendering.font_family(), |
186 Rendering.font_size("jedit_tooltip_font_scale").round) |
186 Rendering.font_size("jedit_tooltip_font_scale").round) |
187 |
187 |
188 |
188 |
189 /* main content */ |
189 /* main content */ |
190 |
190 |
191 def tip_border(thickness: Int = 1) |
191 def tip_border(has_focus: Boolean) |
192 { |
192 { |
193 tip.setBorder(new LineBorder(Color.BLACK, thickness)) |
193 tip.setBorder(new LineBorder(if (has_focus) Color.BLACK else Color.GRAY)) |
194 tip.repaint() |
194 tip.repaint() |
195 } |
195 } |
196 tip_border(1) |
196 tip_border(true) |
197 |
197 |
198 override def getFocusTraversalKeysEnabled = false |
198 override def getFocusTraversalKeysEnabled = false |
199 tip.setBackground(rendering.tooltip_color) |
199 tip.setBackground(rendering.tooltip_color) |
200 tip.add(controls.peer, BorderLayout.NORTH) |
200 tip.add(controls.peer, BorderLayout.NORTH) |
201 tip.add(pretty_text_area) |
201 tip.add(pretty_text_area) |