Skip to content

Commit 3450897

Browse files
add RunnerTextArea.java generated by Xtend 2.20.0
1 parent 9eda9e6 commit 3450897

File tree

1 file changed

+46
-39
lines changed

1 file changed

+46
-39
lines changed
Lines changed: 46 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,47 @@
1-
package org.utplsql.sqldev.ui.runner
2-
3-
import java.awt.Graphics
4-
import java.awt.event.FocusEvent
5-
import java.awt.event.FocusListener
6-
import javax.swing.JTextArea
7-
import javax.swing.UIManager
8-
9-
class RunnerTextArea extends JTextArea implements FocusListener{
10-
11-
new() {
12-
super()
13-
this.addFocusListener = this
14-
}
15-
16-
override paintComponent(Graphics g) {
17-
// default for non-opaque components
18-
if (!opaque) {
19-
super.paintComponent(g)
20-
return
21-
}
22-
23-
// use value of JTextField for consistency
24-
g.color = UIManager.getColor("TextField.inactiveBackground")
25-
g.fillRect(3, 3, width - 6, height - 6)
26-
27-
// do rest, changing opaque to ensure background is not overwritten
28-
setOpaque(false)
29-
super.paintComponent(g)
30-
setOpaque(true)
31-
}
32-
33-
override void focusGained(FocusEvent e) {
34-
this.caret.visible = true
35-
}
36-
37-
override focusLost(FocusEvent e) {
38-
this.caret.visible = false
39-
}
1+
package org.utplsql.sqldev.ui.runner;
2+
3+
import java.awt.Graphics;
4+
import java.awt.event.FocusEvent;
5+
import java.awt.event.FocusListener;
6+
import javax.swing.JTextArea;
7+
import javax.swing.UIManager;
8+
import javax.swing.text.Caret;
9+
10+
@SuppressWarnings("all")
11+
public class RunnerTextArea extends JTextArea implements FocusListener {
12+
public RunnerTextArea() {
13+
super();
14+
this.addFocusListener(this);
15+
}
16+
17+
@Override
18+
public void paintComponent(final Graphics g) {
19+
boolean _isOpaque = this.isOpaque();
20+
boolean _not = (!_isOpaque);
21+
if (_not) {
22+
super.paintComponent(g);
23+
return;
24+
}
25+
g.setColor(UIManager.getColor("TextField.inactiveBackground"));
26+
int _width = this.getWidth();
27+
int _minus = (_width - 6);
28+
int _height = this.getHeight();
29+
int _minus_1 = (_height - 6);
30+
g.fillRect(3, 3, _minus, _minus_1);
31+
this.setOpaque(false);
32+
super.paintComponent(g);
33+
this.setOpaque(true);
34+
}
35+
36+
@Override
37+
public void focusGained(final FocusEvent e) {
38+
Caret _caret = this.getCaret();
39+
_caret.setVisible(true);
40+
}
41+
42+
@Override
43+
public void focusLost(final FocusEvent e) {
44+
Caret _caret = this.getCaret();
45+
_caret.setVisible(false);
46+
}
4047
}

0 commit comments

Comments
 (0)