Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Extension - Closeable Tab UI element like in the Repeater

floyd Jun 27, 2017 01:32PM UTC

I'm writing a Burp extension that has a UI and adds "closeable" tabs, exactly like in the Repeater tab, where there are small "x" to close a tab. However, mine look horrible, as I use a JButton (in Python):

class CloseableTab(JPanel, ActionListener):
def __init__(self, title, pyparent, content, customize_callback):
self.title = title
self.pyparent = pyparent
self.pyparent.add(title, content)
index = pyparent.indexOfTab(title)
self.lbl_title = JLabel(title)
customize_callback(self.lbl_title)
self.btn_close = JButton("x")
self.btn_close.setPreferredSize(Dimension(10, 10))
self.btn_close.setMaximumSize(Dimension(10, 10))
customize_callback(self.btn_close)
self.gbc = GridBagConstraints()
self.gbc.gridx = 0
self.gbc.gridy = 0
self.gbc.weightx = 0
self.gbc.weighty = 0
self.add(self.lbl_title, self.gbc)
self.gbc.gridx += 1
self.gbc.weightx = 0
self.add(self.btn_close, self.gbc)
self.btn_close.addActionListener(self)
self.pyparent.setTabComponentAt(index, self)
customize_callback(self.pyparent)

def actionPerformed(self, evt):
self.pyparent.removeTabAt(self.pyparent.indexOfTab(self.title))

Can you tell me how I could make such nice little "x" to close a tab like in the repeater?


Paul Johnston Jun 27, 2017 01:48PM UTC Support Center agent

We use a custom JComponent that overrides the paint method and uses Graphics methods to draw the cross.

I’m afraid this isn’t available to extensions.

Please let us know if you need any further assistance.


Paul Johnston Jun 29, 2017 08:08AM UTC Support Center agent

This extension does a good job of a closeable tab: https://github.com/PortSwigger/json-web-token-attacker

I’ve not checked how it does it, but you could use their approach.


Post Your public answer

Your name
Your email address
Answer