Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JEditableCheckBox paint a border in a color #6379

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,12 @@
package org.apache.jorphan.gui

import org.apiguardian.api.API
import java.awt.Color
import java.awt.Container
import java.awt.FlowLayout
import java.awt.event.ActionEvent
import javax.swing.AbstractAction
import javax.swing.BorderFactory
import javax.swing.Box
import javax.swing.JCheckBox
import javax.swing.JComboBox
Expand Down Expand Up @@ -105,6 +107,8 @@ public open class JEditableCheckBox(

private val checkbox: JCheckBox = JCheckBox(label).apply {
val cb = this
cb.setBorderPainted(true)
cb.setBorder(BorderFactory.createLineBorder(Color(51, 204, 255))) // Very light blue
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have multiple color schemas, so I do not think hardcoding a color is the right thing to do.

Copy link
Contributor Author

@vdaburon vdaburon Nov 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I never write Kotlin code and i can't code correctly read property in jmeter.properties or user.properties with

var propBorderColor = JMeterUtils.getResStringDefault("JEditableCheckBox.border.color","51,204,255")

I get an error "Adding dependency on module 'jmeter.src.core.main' will introduce circular dependency between modules 'jmeter.src.core.main' and 'jmeter.src.jorphan.main'. Add dependency anyway?"

vlsi could you code this external configuration ?
the border color could be a new JMeter property likes :
RGB Color:
JEditableCheckBox.border.color=51,204,255
or standard Color:
JEditableCheckBox.border.color=ORANGE

Regards.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I mean is that orange might not work for all the color themes, so it should be rather something like "accent color" which is declared separately for each look and feel. I am not sure if jmeter.properties can configure different values for different look and feels.

This makes adding new colors hard, so we should rather try reusing the existing color resources.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main question is how to distinguish a standard checkbox from a special JEditableCheckBox ?
I proposed to add a colored border but if you have another proposition.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the need to mark the expression-supporting checkboxes?
Imagine we will support expressions in all the checkboxes. Why highlight all of them in the UI?

Copy link
Contributor Author

@vdaburon vdaburon Nov 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some checkbox are standards some not and you don’t know except when you right click on the checkbox. No documentation explains that you could modify the checkbox value with an expression. I think is important to visually know the nature of the checkbox (standard or Editable)

componentPopupMenu = JPopupMenu().apply {
add(useExpressionAction)
}
Expand Down
Loading