Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd2754e

Browse filesBrowse files
add RunnerTextPane to be used for text with hyperlinks
1 parent 61b9b83 commit dd2754e
Copy full SHA for dd2754e

File tree

1 file changed

+56
-0
lines changed
Filter options

1 file changed

+56
-0
lines changed
+56Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
* Copyright 2019 Philipp Salvisberg <philipp.salvisberg@trivadis.com>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.utplsql.sqldev.ui.runner
18+
19+
import java.awt.Graphics
20+
import java.awt.event.FocusEvent
21+
import java.awt.event.FocusListener
22+
import javax.swing.JTextPane
23+
import javax.swing.UIManager
24+
25+
class RunnerTextPane extends JTextPane implements FocusListener{
26+
27+
new() {
28+
super()
29+
this.addFocusListener = this
30+
}
31+
32+
override paintComponent(Graphics g) {
33+
// default for non-opaque components
34+
if (!opaque) {
35+
super.paintComponent(g)
36+
return
37+
}
38+
39+
// use value of JTextField for consistency
40+
g.color = UIManager.getColor("TextField.inactiveBackground")
41+
g.fillRect(0, 0, width, height)
42+
43+
// do rest, changing opaque to ensure background is not overwritten
44+
setOpaque(false)
45+
super.paintComponent(g)
46+
setOpaque(true)
47+
}
48+
49+
override void focusGained(FocusEvent e) {
50+
this.caret.visible = true
51+
}
52+
53+
override focusLost(FocusEvent e) {
54+
this.caret.visible = false
55+
}
56+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.