runelite-client: try to fix switching between plugins
This commit is contained in:
@@ -61,7 +61,7 @@ public class DevTools extends Plugin
|
||||
|
||||
public DevTools()
|
||||
{
|
||||
navButton.getButton().addActionListener(this::expandPanel);
|
||||
navButton.getButton().addActionListener(this::setPluginPanel);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -95,10 +95,9 @@ public class DevTools extends Plugin
|
||||
return overlay;
|
||||
}
|
||||
|
||||
private void expandPanel(ActionEvent e)
|
||||
private void setPluginPanel(ActionEvent e)
|
||||
{
|
||||
ui.setPluginPanel(panel);
|
||||
ui.expand();
|
||||
ui.expand(panel);
|
||||
}
|
||||
|
||||
public Font getFont()
|
||||
|
||||
@@ -26,7 +26,6 @@ package net.runelite.client.plugins.hiscore;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import javax.imageio.ImageIO;
|
||||
@@ -40,7 +39,7 @@ import net.runelite.client.ui.overlay.Overlay;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class Hiscore extends Plugin implements ActionListener
|
||||
public class Hiscore extends Plugin
|
||||
{
|
||||
private static final Logger logger = LoggerFactory.getLogger(Hiscore.class);
|
||||
|
||||
@@ -54,7 +53,7 @@ public class Hiscore extends Plugin implements ActionListener
|
||||
|
||||
public Hiscore()
|
||||
{
|
||||
navButton.getButton().addActionListener(this);
|
||||
navButton.getButton().addActionListener(this::setPluginPanel);
|
||||
|
||||
try
|
||||
{
|
||||
@@ -77,11 +76,9 @@ public class Hiscore extends Plugin implements ActionListener
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e)
|
||||
private void setPluginPanel(ActionEvent e)
|
||||
{
|
||||
ui.setPluginPanel(hiscorePanel);
|
||||
ui.expand();
|
||||
ui.expand(hiscorePanel);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
@@ -47,7 +47,6 @@ public final class ClientUI extends JFrame
|
||||
private ClientPanel panel;
|
||||
private NavigationPanel navigationPanel;
|
||||
private PluginPanel pluginPanel;
|
||||
private boolean expanded;
|
||||
|
||||
public ClientUI() throws Exception
|
||||
{
|
||||
@@ -98,25 +97,31 @@ public final class ClientUI extends JFrame
|
||||
add(container);
|
||||
}
|
||||
|
||||
public void expand()
|
||||
public void expand(PluginPanel panel)
|
||||
{
|
||||
if (!expanded)
|
||||
{
|
||||
navContainer.add(pluginPanel, BorderLayout.WEST);
|
||||
navContainer.revalidate();
|
||||
this.setMinimumSize(new Dimension(EXPANDED_WIDTH, PANEL_HEIGHT));
|
||||
expanded = true;
|
||||
}
|
||||
else
|
||||
if (pluginPanel == panel)
|
||||
{
|
||||
navContainer.remove(1);
|
||||
navContainer.revalidate();
|
||||
container.validate();
|
||||
this.setMinimumSize(new Dimension(PANEL_WIDTH, PANEL_HEIGHT));
|
||||
if (this.getWidth() == EXPANDED_WIDTH)
|
||||
{
|
||||
this.setSize(PANEL_WIDTH, PANEL_HEIGHT);
|
||||
}
|
||||
expanded = false;
|
||||
pluginPanel = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pluginPanel != null)
|
||||
{
|
||||
navContainer.remove(1);
|
||||
container.validate();
|
||||
}
|
||||
|
||||
pluginPanel = panel;
|
||||
navContainer.add(pluginPanel, BorderLayout.WEST);
|
||||
container.validate();
|
||||
this.setMinimumSize(new Dimension(EXPANDED_WIDTH, PANEL_HEIGHT));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,9 +144,4 @@ public final class ClientUI extends JFrame
|
||||
{
|
||||
return pluginPanel;
|
||||
}
|
||||
|
||||
public void setPluginPanel(PluginPanel pluginPanel)
|
||||
{
|
||||
this.pluginPanel = pluginPanel;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user