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 4c0a2aa

Browse filesBrowse files
fix look and feel of toolbar on Metal (Ubuntu)
Look and feel tested on - macOS (Oracle, Mac OS X) - Windows 10 (Oracle, Windows) - Ubuntu (Oracle, Metal)
1 parent 0a9256d commit 4c0a2aa
Copy full SHA for 4c0a2aa

File tree

2 files changed

+60
-27
lines changed
Filter options

2 files changed

+60
-27
lines changed

‎sqldev/src/main/java/org/utplsql/sqldev/ui/runner/GradientToolbar.xtend

Copy file name to clipboardExpand all lines: sqldev/src/main/java/org/utplsql/sqldev/ui/runner/GradientToolbar.xtend
+55-26Lines changed: 55 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,38 +19,67 @@ import java.awt.Color
1919
import java.awt.GradientPaint
2020
import java.awt.Graphics
2121
import java.awt.Graphics2D
22+
import java.awt.Insets
2223
import javax.swing.JToolBar
24+
import javax.swing.UIManager
25+
import javax.swing.border.BevelBorder
26+
import javax.swing.border.EmptyBorder
2327

2428
class GradientToolbar extends JToolBar {
29+
30+
private def isOracleLookAndFeel() {
31+
val laf = UIManager.lookAndFeel?.name
32+
if (laf == "Oracle Look and Feel version 2") {
33+
return true
34+
} else {
35+
return false
36+
}
37+
}
38+
39+
new() {
40+
super()
41+
if (oracleLookAndFeel) {
42+
this.border = new EmptyBorder(new Insets(2, 2, 2, 2)) // top, left, bottom, right
43+
} else {
44+
this.border = new BevelBorder(BevelBorder.RAISED)
45+
}
46+
}
47+
2548
override paintComponent(Graphics g) {
26-
// default for non-opaque components
27-
if (!opaque) {
49+
if (oracleLookAndFeel) {
50+
// emulate Oracle toolbar
51+
// 1. default for non-opaque components
52+
if (!opaque) {
53+
super.paintComponent(g)
54+
return
55+
}
56+
57+
// 2. paint gradient background from top to bottom with separator line at the bottom
58+
val g2d = g as Graphics2D
59+
val w = width
60+
val h = height - 1
61+
val h2 = height / 2 as int
62+
val colorTop = new Color(237, 237, 237)
63+
val colorMiddle = new Color(244, 244, 244)
64+
val colorBottom = new Color(254, 254, 254)
65+
val colorBottomLine = Color.LIGHT_GRAY
66+
val gp1 = new GradientPaint(0, 0, colorTop, 0, h2, colorMiddle)
67+
g2d.paint = gp1
68+
g2d.fillRect(0, 0, w, h2)
69+
val gp2 = new GradientPaint(0, h2, colorMiddle, 0, h, colorBottom)
70+
g2d.paint = gp2
71+
g2d.fillRect(0, h2, w, h)
72+
g2d.paint = colorBottomLine
73+
g2d.fillRect(0, h, w, h+1)
74+
75+
// 3. do rest, changing opaque to ensure background is not overwritten
76+
setOpaque(false)
77+
super.paintComponent(g)
78+
setOpaque(true)
79+
} else {
80+
// default logic
2881
super.paintComponent(g)
29-
return
3082
}
31-
32-
// paint gradient background from top to bottom with separator line at the bottom
33-
val g2d = g as Graphics2D
34-
val w = width
35-
val h = height - 1
36-
val h2 = height / 2 as int
37-
val colorTop = new Color(237, 237, 237)
38-
val colorMiddle = new Color(244, 244, 244)
39-
val colorBottom = new Color(254, 254, 254)
40-
val colorBottomLine = Color.LIGHT_GRAY
41-
val gp1 = new GradientPaint(0, 0, colorTop, 0, h2, colorMiddle)
42-
g2d.paint = gp1
43-
g2d.fillRect(0, 0, w, h2)
44-
val gp2 = new GradientPaint(0, h2, colorMiddle, 0, h, colorBottom)
45-
g2d.paint = gp2
46-
g2d.fillRect(0, h2, w, h)
47-
g2d.paint = colorBottomLine
48-
g2d.fillRect(0, h, w, h+1)
49-
50-
// do rest, changing opaque to ensure background is not overwritten
51-
setOpaque(false)
52-
super.paintComponent(g)
53-
setOpaque(true)
5483
}
5584

5685
}

‎sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.xtend

Copy file name to clipboardExpand all lines: sqldev/src/main/java/org/utplsql/sqldev/ui/runner/RunnerPanel.xtend
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,17 +726,20 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
726726
// Toolbar
727727
var toolbar = new GradientToolbar
728728
toolbar.floatable = false
729-
toolbar.border = new EmptyBorder(new Insets(2, 2, 2, 2)) // top, left, bottom, right
729+
val buttonBorder = new EmptyBorder(new Insets(2, 4, 2, 4)) // top, left, bottom, right
730730
refreshButton = new ToolbarButton(UtplsqlResources.getIcon("REFRESH_ICON"))
731731
refreshButton.toolTipText = UtplsqlResources.getString("RUNNER_REFRESH_TOOLTIP")
732+
refreshButton.border = buttonBorder
732733
refreshButton.addActionListener(this)
733734
toolbar.add(refreshButton)
734735
rerunButton = new ToolbarButton(UtplsqlResources.getIcon("RUN_ICON"))
735736
rerunButton.toolTipText = UtplsqlResources.getString("RUNNER_RERUN_TOOLTIP")
737+
rerunButton.border = buttonBorder
736738
rerunButton.addActionListener(this)
737739
toolbar.add(rerunButton)
738740
rerunWorksheetButton = new ToolbarButton(UtplsqlResources.getIcon("RUN_WORKSHEET_ICON"))
739741
rerunWorksheetButton.toolTipText = UtplsqlResources.getString("RUNNER_RERUN_WORKSHEET_TOOLTIP")
742+
rerunWorksheetButton.border = buttonBorder
740743
rerunWorksheetButton.addActionListener(this)
741744
toolbar.add(rerunWorksheetButton)
742745
toolbar.add(Box.createHorizontalGlue())
@@ -749,6 +752,7 @@ class RunnerPanel implements ActionListener, MouseListener, HyperlinkListener {
749752
toolbar.add(runComboBox)
750753
clearButton = new ToolbarButton(UtplsqlResources.getIcon("CLEAR_ICON"))
751754
clearButton.toolTipText = UtplsqlResources.getString("RUNNER_CLEAR_HISTORY_BUTTON")
755+
clearButton.border = buttonBorder
752756
clearButton.addActionListener(this)
753757
toolbar.add(clearButton)
754758
c.gridx = 0

0 commit comments

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