fix(gui): compact TabComponent labels and TabToolTip (#1120) (PR #1121)

* Compact CodePanel labels and TabToolTip
* Remove top padding from tab title
This commit is contained in:
Surendrajat
2021-02-21 17:31:10 +05:30
committed by GitHub
parent 67def6319e
commit 4835b1b897
2 changed files with 14 additions and 3 deletions
@@ -4,6 +4,7 @@ import javax.swing.*;
import org.jetbrains.annotations.Nullable;
import jadx.gui.treemodel.JClass;
import jadx.gui.treemodel.JNode;
public abstract class ContentPanel extends JPanel {
@@ -38,6 +39,10 @@ public abstract class ContentPanel extends JPanel {
*/
@Nullable
public String getTabTooltip() {
return null;
JClass jClass = node.getRootClass();
if (jClass != null) {
return jClass.getFullName();
}
return node.getName();
}
}
@@ -47,7 +47,13 @@ public class TabComponent extends JPanel {
panel.setOpaque(false);
JNode node = contentPanel.getNode();
label = new JLabel(node.makeLongStringHtml());
String tabTitle;
if (node.getRootClass() != null) {
tabTitle = node.getRootClass().getName();
} else {
tabTitle = node.makeLongStringHtml();
}
label = new JLabel(tabTitle);
label.setFont(getLabelFont());
String toolTip = contentPanel.getTabTooltip();
if (toolTip != null) {
@@ -89,7 +95,7 @@ public class TabComponent extends JPanel {
panel.add(label);
panel.add(closeBtn);
panel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
}
private JPopupMenu createTabPopupMenu(final ContentPanel contentPanel) {