Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ project.build.version=1.12.31.1
runelite.injected-client.version=1.12.31.1

glslang.path=
microbot.version=2.6.11
microbot.version=2.6.12
microbot.commit.sha=nogit
microbot.repo.url=http://138.201.81.246:8081/repository/microbot-snapshot/
microbot.repo.username=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class MicrobotPluginListItem extends JPanel implements SearchablePlugin
{
private static final ImageIcon ON_STAR;
private static final ImageIcon OFF_STAR;
private static final int MIN_ITEM_HEIGHT = 20;

private final MicrobotPluginListPanel pluginListPanel;

Expand Down Expand Up @@ -90,9 +91,10 @@ class MicrobotPluginListItem extends JPanel implements SearchablePlugin
}

setLayout(new BorderLayout(3, 0));
setPreferredSize(new Dimension(MicrobotPluginListPanel.LIST_ITEM_WIDTH, 20));

JLabel nameLabel = createNameLabel(pluginConfig);
int itemHeight = Math.max(MIN_ITEM_HEIGHT, nameLabel.getPreferredSize().height);
setPreferredSize(new Dimension(MicrobotPluginListPanel.LIST_ITEM_WIDTH, itemHeight));

pinButton = new JToggleButton(OFF_STAR);
pinButton.setSelectedIcon(ON_STAR);
Expand Down Expand Up @@ -185,19 +187,27 @@ class MicrobotPluginListItem extends JPanel implements SearchablePlugin

@NotNull
private static JLabel createNameLabel(MicrobotPluginConfigurationDescriptor pluginConfig) {
JLabel nameLabel = new JLabel(pluginConfig.getName());
int buttons = 21 /*pin*/ + 25 /*config, if present*/ + 34 /*toggle approx*/ + 12 /*margins*/;
int textWidth = MicrobotPluginListPanel.LIST_ITEM_WIDTH - buttons;
nameLabel.setText("<html><div style='width:" + textWidth + "px'>" + pluginConfig.getName() + "</div></html>");
JLabel nameLabel = new JLabel("<html><div style='width:" + textWidth + "px'>" + htmlBody(pluginConfig.getName()) + "</div></html>");
nameLabel.setForeground(Color.WHITE);
nameLabel.setHorizontalAlignment(JLabel.LEFT);
nameLabel.setVerticalAlignment(JLabel.CENTER);

if (!pluginConfig.getDescription().isEmpty())
{
nameLabel.setToolTipText("<html>" + pluginConfig.getName() + ":<br>" + pluginConfig.getDescription() + "</html>");
nameLabel.setToolTipText("<html>" + htmlBody(pluginConfig.getName()) + ":<br>" + htmlBody(pluginConfig.getDescription()) + "</html>");
}
return nameLabel;
}

private static String htmlBody(String html)
{
return html
.replaceFirst("(?i)^\\s*<html>", "")
.replaceFirst("(?i)</html>\\s*$", "");
}

@Override
public String getSearchableName()
{
Expand Down
Loading