Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jdk17u
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
einsteinathome
openjdk
jdk17u
Commits
eb464423
Commit
eb464423
authored
6 months ago
by
Goetz Lindenmaier
Browse files
Options
Downloads
Patches
Plain Diff
8340799: Add border inside instruction frame in PassFailJFrame
Backport-of: 520060f79a3cedb8f93e6bbd0e9b2823eaabf79a
parent
d1be3c9f
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
+47
-13
47 additions, 13 deletions
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
with
47 additions
and
13 deletions
test/jdk/java/awt/regtesthelpers/PassFailJFrame.java
+
47
−
13
View file @
eb464423
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
import
java.awt.AWTException
;
import
java.awt.AWTException
;
import
java.awt.BorderLayout
;
import
java.awt.BorderLayout
;
import
java.awt.Dimension
;
import
java.awt.Dimension
;
import
java.awt.FlowLayout
;
import
java.awt.Font
;
import
java.awt.Font
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsConfiguration
;
import
java.awt.GraphicsDevice
;
import
java.awt.GraphicsDevice
;
...
@@ -69,6 +70,7 @@ import javax.swing.JScrollPane;
...
@@ -69,6 +70,7 @@ import javax.swing.JScrollPane;
import
javax.swing.JSplitPane
;
import
javax.swing.JSplitPane
;
import
javax.swing.JTextArea
;
import
javax.swing.JTextArea
;
import
javax.swing.Timer
;
import
javax.swing.Timer
;
import
javax.swing.border.Border
;
import
javax.swing.text.JTextComponent
;
import
javax.swing.text.JTextComponent
;
import
javax.swing.text.html.HTMLEditorKit
;
import
javax.swing.text.html.HTMLEditorKit
;
import
javax.swing.text.html.StyleSheet
;
import
javax.swing.text.html.StyleSheet
;
...
@@ -655,6 +657,8 @@ public final class PassFailJFrame {
...
@@ -655,6 +657,8 @@ public final class PassFailJFrame {
boolean
addLogArea
,
boolean
addLogArea
,
int
logAreaRows
)
{
int
logAreaRows
)
{
JPanel
main
=
new
JPanel
(
new
BorderLayout
());
JPanel
main
=
new
JPanel
(
new
BorderLayout
());
main
.
setBorder
(
createFrameBorder
());
timeoutHandlerPanel
=
new
TimeoutHandlerPanel
(
testTimeOut
);
timeoutHandlerPanel
=
new
TimeoutHandlerPanel
(
testTimeOut
);
main
.
add
(
timeoutHandlerPanel
,
BorderLayout
.
NORTH
);
main
.
add
(
timeoutHandlerPanel
,
BorderLayout
.
NORTH
);
...
@@ -664,7 +668,7 @@ public final class PassFailJFrame {
...
@@ -664,7 +668,7 @@ public final class PassFailJFrame {
text
.
setEditable
(
false
);
text
.
setEditable
(
false
);
JPanel
textPanel
=
new
JPanel
(
new
BorderLayout
());
JPanel
textPanel
=
new
JPanel
(
new
BorderLayout
());
textPanel
.
setBorder
(
createEmptyBorder
(
4
,
0
,
0
,
0
));
textPanel
.
setBorder
(
createEmptyBorder
(
GAP
,
0
,
GAP
,
0
));
textPanel
.
add
(
new
JScrollPane
(
text
),
BorderLayout
.
CENTER
);
textPanel
.
add
(
new
JScrollPane
(
text
),
BorderLayout
.
CENTER
);
main
.
add
(
textPanel
,
BorderLayout
.
CENTER
);
main
.
add
(
textPanel
,
BorderLayout
.
CENTER
);
...
@@ -681,7 +685,8 @@ public final class PassFailJFrame {
...
@@ -681,7 +685,8 @@ public final class PassFailJFrame {
timeoutHandlerPanel
.
stop
();
timeoutHandlerPanel
.
stop
();
});
});
JPanel
buttonsPanel
=
new
JPanel
();
JPanel
buttonsPanel
=
new
JPanel
(
new
FlowLayout
(
FlowLayout
.
CENTER
,
GAP
,
0
));
buttonsPanel
.
add
(
btnPass
);
buttonsPanel
.
add
(
btnPass
);
buttonsPanel
.
add
(
btnFail
);
buttonsPanel
.
add
(
btnFail
);
...
@@ -692,10 +697,12 @@ public final class PassFailJFrame {
...
@@ -692,10 +697,12 @@ public final class PassFailJFrame {
if
(
addLogArea
)
{
if
(
addLogArea
)
{
logArea
=
new
JTextArea
(
logAreaRows
,
columns
);
logArea
=
new
JTextArea
(
logAreaRows
,
columns
);
logArea
.
setEditable
(
false
);
logArea
.
setEditable
(
false
);
logArea
.
setBorder
(
createTextBorder
());
Box
buttonsLogPanel
=
Box
.
createVerticalBox
();
Box
buttonsLogPanel
=
Box
.
createVerticalBox
();
buttonsLogPanel
.
add
(
buttonsPanel
);
buttonsLogPanel
.
add
(
buttonsPanel
);
buttonsLogPanel
.
add
(
Box
.
createVerticalStrut
(
GAP
));
buttonsLogPanel
.
add
(
new
JScrollPane
(
logArea
));
buttonsLogPanel
.
add
(
new
JScrollPane
(
logArea
));
main
.
add
(
buttonsLogPanel
,
BorderLayout
.
SOUTH
);
main
.
add
(
buttonsLogPanel
,
BorderLayout
.
SOUTH
);
...
@@ -713,7 +720,7 @@ public final class PassFailJFrame {
...
@@ -713,7 +720,7 @@ public final class PassFailJFrame {
JTextArea
text
=
new
JTextArea
(
instructions
,
rows
,
columns
);
JTextArea
text
=
new
JTextArea
(
instructions
,
rows
,
columns
);
text
.
setLineWrap
(
true
);
text
.
setLineWrap
(
true
);
text
.
setWrapStyleWord
(
true
);
text
.
setWrapStyleWord
(
true
);
text
.
setBorder
(
create
Empty
Border
(
4
,
4
,
4
,
4
));
text
.
setBorder
(
create
Text
Border
());
return
text
;
return
text
;
}
}
...
@@ -735,6 +742,29 @@ public final class PassFailJFrame {
...
@@ -735,6 +742,29 @@ public final class PassFailJFrame {
return
text
;
return
text
;
}
}
/** A default gap between components. */
private
static
final
int
GAP
=
4
;
/**
* Creates a default border for frames or dialogs.
* It uses the default gap of {@value GAP}.
*
* @return the border for frames and dialogs
*/
private
static
Border
createFrameBorder
()
{
return
createEmptyBorder
(
GAP
,
GAP
,
GAP
,
GAP
);
}
/**
* Creates a border set to text area.
* It uses the default gap of {@value GAP}.
*
* @return the border for text area
*/
private
static
Border
createTextBorder
()
{
return
createEmptyBorder
(
GAP
,
GAP
,
GAP
,
GAP
);
}
/**
/**
* Creates a test UI window.
* Creates a test UI window.
...
@@ -1086,26 +1116,30 @@ public final class PassFailJFrame {
...
@@ -1086,26 +1116,30 @@ public final class PassFailJFrame {
* Requests the description of the test failure reason from the tester.
* Requests the description of the test failure reason from the tester.
*/
*/
private
static
void
requestFailureReason
()
{
private
static
void
requestFailureReason
()
{
final
JDialog
dialog
=
new
JDialog
(
frame
,
"
Test
Failure "
,
true
);
final
JDialog
dialog
=
new
JDialog
(
frame
,
"Failure
reason
"
,
true
);
dialog
.
setTitle
(
"Failure reason"
);
J
Panel
jPanel
=
new
JPanel
(
new
BorderLayout
()
);
J
TextArea
reason
=
new
JTextArea
(
5
,
20
);
JTextArea
jTextArea
=
new
JTextArea
(
5
,
20
);
reason
.
setBorder
(
createTextBorder
()
);
JButton
okButton
=
new
JButton
(
"OK"
);
JButton
okButton
=
new
JButton
(
"OK"
);
okButton
.
addActionListener
((
ae
)
->
{
okButton
.
addActionListener
((
ae
)
->
{
String
text
=
jTextA
rea
.
getText
();
String
text
=
rea
son
.
getText
();
setFailureReason
(
FAILURE_REASON
setFailureReason
(
FAILURE_REASON
+
(!
text
.
isEmpty
()
?
text
:
EMPTY_REASON
));
+
(!
text
.
isEmpty
()
?
text
:
EMPTY_REASON
));
dialog
.
setVisible
(
false
);
dialog
.
setVisible
(
false
);
});
});
j
Panel
.
add
(
new
JScrollPane
(
jTextArea
),
Border
Layout
.
CENTER
);
J
Panel
okayBtnPanel
=
new
JPanel
(
new
FlowLayout
(
Flow
Layout
.
CENTER
,
GAP
,
0
));
JPanel
okayBtnPanel
=
new
JPanel
(
);
okayBtnPanel
.
setBorder
(
createEmptyBorder
(
GAP
,
0
,
0
,
0
)
);
okayBtnPanel
.
add
(
okButton
);
okayBtnPanel
.
add
(
okButton
);
jPanel
.
add
(
okayBtnPanel
,
BorderLayout
.
SOUTH
);
JPanel
main
=
new
JPanel
(
new
BorderLayout
());
dialog
.
add
(
jPanel
);
main
.
setBorder
(
createFrameBorder
());
main
.
add
(
new
JScrollPane
(
reason
),
BorderLayout
.
CENTER
);
main
.
add
(
okayBtnPanel
,
BorderLayout
.
SOUTH
);
dialog
.
add
(
main
);
dialog
.
setLocationRelativeTo
(
frame
);
dialog
.
setLocationRelativeTo
(
frame
);
dialog
.
pack
();
dialog
.
pack
();
dialog
.
setVisible
(
true
);
dialog
.
setVisible
(
true
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment