Skip to content

Commit

Permalink
refactor(kotlin): simplify IconButtonTableCellEditor class initializa…
Browse files Browse the repository at this point in the history
…tion #86
  • Loading branch information
phodal committed Sep 14, 2024
1 parent e868010 commit 4269591
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,12 @@ import javax.swing.JTable
import javax.swing.event.ChangeEvent
import javax.swing.table.TableCellEditor

open class IconButtonTableCellEditor protected constructor(
value: Any,
icon: Icon,
tooltipText: String,
) :
AbstractCellEditor(), TableCellEditor {
protected val myButton: IconButton
protected var myValue: Any?

init {
myButton = IconButton(icon)

myButton.setOpaque(true)
myButton.setToolTipText(tooltipText)

myValue = value
open class IconButtonTableCellEditor(value: Any, icon: Icon, tooltipText: String) : AbstractCellEditor(),
TableCellEditor {
protected var myValue: Any = value
protected val myButton: IconButton = IconButton(icon).apply {
setOpaque(true)
setToolTipText(tooltipText)
}

@get:VisibleForTesting
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ interface IconTableCell {
fun setIcon(icon: Icon?)
}

class IconButton internal constructor(defaultIcon: Icon) : JButton(defaultIcon), IconTableCell {
class IconButton(defaultIcon: Icon) : JButton(defaultIcon), IconTableCell {
private var myDefaultIcon: Icon

init {
Expand Down

0 comments on commit 4269591

Please sign in to comment.