Burp Suite User Forum

Create new post

Extension - Closeable Tab UI element like in the Repeater

floyd | Last updated: 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?

PortSwigger Agent | Last updated: Jun 27, 2017 01:35PM UTC

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.

PortSwigger Agent | Last updated: Jun 29, 2017 08:07AM UTC

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.

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.