mirror of
https://github.com/java-decompiler/jd-gui.git
synced 2025-01-22 03:55:01 +00:00
Adds icon on tabs
This commit is contained in:
parent
85d4eb647f
commit
aa7c08bfa5
@ -110,15 +110,10 @@ class TabbedPanel extends JPanel implements PreferencesChangeListener {
|
||||
})
|
||||
|
||||
JPanel tab = new JPanel(new BorderLayout())
|
||||
if (PlatformService.instance.isMac) {
|
||||
tab.border = BorderFactory.createEmptyBorder(2, 0, 3, 0)
|
||||
} else {
|
||||
tab.border = BorderFactory.createEmptyBorder(1, 0, 1, 0)
|
||||
}
|
||||
tab.opaque = false
|
||||
tab.toolTipText = tip
|
||||
// Show label and icon: panel.add(new JLabel(title, icon, JLabel.LEADING), BorderLayout.CENTER)
|
||||
tab.add(new JLabel(title), BorderLayout.CENTER)
|
||||
tab.add(new JLabel(title, icon, JLabel.LEADING), BorderLayout.CENTER)
|
||||
tab.add(tabCloseButton, BorderLayout.EAST)
|
||||
ToolTipManager.sharedInstance().unregisterComponent(tab)
|
||||
|
||||
@ -189,7 +184,9 @@ class TabbedPanel extends JPanel implements PreferencesChangeListener {
|
||||
int count = tabbedPane.tabCount
|
||||
|
||||
for (int i=0; i<count; i++) {
|
||||
def subMenuItem = new JMenuItem(tabbedPane.getTitleAt(i), null)
|
||||
JPanel tab = tabbedPane.getTabComponentAt(i)
|
||||
JLabel label = tab.getComponent(0)
|
||||
JMenuItem subMenuItem = new JMenuItem(label.text, label.icon)
|
||||
subMenuItem.addActionListener(new ActionListener() {
|
||||
final int index = i
|
||||
void actionPerformed(ActionEvent e) { tabbedPane.setSelectedIndex(index) }
|
||||
|
@ -8,6 +8,7 @@ package org.jd.gui.service.fileloader
|
||||
import org.jd.gui.api.API
|
||||
import org.jd.gui.api.feature.UriGettable
|
||||
import org.jd.gui.api.model.Container
|
||||
import org.jd.gui.api.model.TreeNodeData
|
||||
import org.jd.gui.spi.FileLoader
|
||||
|
||||
import javax.swing.*
|
||||
@ -46,7 +47,10 @@ abstract class AbstractFileLoaderProvider implements FileLoader {
|
||||
|
||||
def mainPanel = api.getMainPanelFactory(container)?.make(api, container)
|
||||
if (mainPanel) {
|
||||
api.addPanel(file.name, null, 'Location: ' + file.absolutePath, mainPanel)
|
||||
def data = api.getTreeNodeFactory(parentEntry)?.make(api, parentEntry).userObject
|
||||
def icon = (data instanceof TreeNodeData) ? data.icon : null
|
||||
|
||||
api.addPanel(file.name, icon, 'Location: ' + file.absolutePath, mainPanel)
|
||||
return mainPanel
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user