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