Skip to content

Commit dd3f071

Browse files
add RunnerTextField.java generated by Xtend 2.20.0
1 parent ddbc419 commit dd3f071

File tree

1 file changed

+40
-36
lines changed

1 file changed

+40
-36
lines changed
Lines changed: 40 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,43 @@
1-
package org.utplsql.sqldev.ui.runner
1+
package org.utplsql.sqldev.ui.runner;
22

3-
import java.awt.Graphics
4-
import java.awt.event.FocusEvent
5-
import java.awt.event.FocusListener
6-
import javax.swing.JTextField
7-
import javax.swing.UIManager
3+
import java.awt.Graphics;
4+
import java.awt.event.FocusEvent;
5+
import java.awt.event.FocusListener;
6+
import javax.swing.JTextField;
7+
import javax.swing.UIManager;
8+
import javax.swing.text.Caret;
89

9-
class RunnerTextField extends JTextField 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-
g.color = UIManager.getColor("TextField.inactiveBackground")
24-
g.fillRect(0, 0, width, height)
25-
26-
// do rest, changing opaque to ensure background is not overwritten
27-
setOpaque(false)
28-
super.paintComponent(g)
29-
setOpaque(true)
30-
}
31-
32-
override void focusGained(FocusEvent e) {
33-
this.caret.visible = true
34-
}
35-
36-
override focusLost(FocusEvent e) {
37-
this.caret.visible = false
38-
}
10+
@SuppressWarnings("all")
11+
public class RunnerTextField extends JTextField implements FocusListener {
12+
public RunnerTextField() {
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+
g.fillRect(0, 0, this.getWidth(), this.getHeight());
27+
this.setOpaque(false);
28+
super.paintComponent(g);
29+
this.setOpaque(true);
30+
}
31+
32+
@Override
33+
public void focusGained(final FocusEvent e) {
34+
Caret _caret = this.getCaret();
35+
_caret.setVisible(true);
36+
}
37+
38+
@Override
39+
public void focusLost(final FocusEvent e) {
40+
Caret _caret = this.getCaret();
41+
_caret.setVisible(false);
42+
}
3943
}

0 commit comments

Comments
 (0)