Created
January 23, 2018 08:07
-
-
Save pajswigger/fc627dda3bd7e01dd893a35d809cb785 to your computer and use it in GitHub Desktop.
Highlight a Burp Tab
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JTabbedPane tabbedPane; | |
ChangeListener changeListener; | |
// add to constructor | |
addHierarchyListener(this); | |
void highlightTab() | |
{ | |
if(tabbedPane != null) | |
{ | |
for(int i = 0; i < tabbedPane.getTabCount(); i++) | |
{ | |
if(tabbedPane.getComponentAt(i) == this) | |
{ | |
tabbedPane.setBackgroundAt(i, new Color(0xff6633)); | |
Timer timer = new Timer(3000, new ActionListener() | |
{ | |
@Override | |
public void actionPerformed(ActionEvent e) | |
{ | |
for(int j = 0; j < tabbedPane.getTabCount(); j++) | |
{ | |
if (tabbedPane.getComponentAt(j) == this) | |
{ | |
tabbedPane.setBackgroundAt(j, Color.BLACK); | |
break; | |
} | |
} | |
} | |
}); | |
timer.setRepeats(false); | |
timer.start(); | |
break; | |
} | |
} | |
} | |
} | |
@Override | |
public void hierarchyChanged(HierarchyEvent e) | |
{ | |
tabbedPane = (JTabbedPane) getParent(); | |
changeListener = new ChangeListener() { | |
public void stateChanged(ChangeEvent e) { | |
if(tabbedPane.getSelectedComponent() == this) | |
{ | |
tabbedPane.setBackgroundAt(tabbedPane.getSelectedIndex(), Color.BLACK); | |
optionsPanel.loadMacros(); | |
} | |
} | |
}; | |
tabbedPane.addChangeListener(changeListener); | |
removeHierarchyListener(this); | |
} | |
// call from extensionUnloaded | |
void removeChangeListener() | |
{ | |
if (changeListener != null) | |
{ | |
tabbedPane.removeChangeListener(changeListener); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment