Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add off-state icons to VBL tools #3181

Merged
merged 2 commits into from
Nov 16, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,25 @@ public TopologyModeSelectionPanel() {
createAndAddModeButton(
Zone.TopologyType.WALL_VBL,
"net/rptools/maptool/client/image/tool/wall-vbl-only.png",
"net/rptools/maptool/client/image/tool/wall-vbl-only-off.png",
"tools.topology_mode_selection.vbl.tooltip",
initiallySelectedTypes);
createAndAddModeButton(
Zone.TopologyType.HILL_VBL,
"net/rptools/maptool/client/image/tool/hill-vbl-only.png",
"net/rptools/maptool/client/image/tool/hill-vbl-only-off.png",
"tools.topology_mode_selection.hill_vbl.tooltip",
initiallySelectedTypes);
createAndAddModeButton(
Zone.TopologyType.PIT_VBL,
"net/rptools/maptool/client/image/tool/pit-vbl-only.png",
"net/rptools/maptool/client/image/tool/pit-vbl-only-off.png",
"tools.topology_mode_selection.pit_vbl.tooltip",
initiallySelectedTypes);
createAndAddModeButton(
Zone.TopologyType.MBL,
"net/rptools/maptool/client/image/tool/mbl-only.png",
"net/rptools/maptool/client/image/tool/mbl-only-off.png",
"tools.topology_mode_selection.mbl.tooltip",
initiallySelectedTypes);
} catch (IOException ioe) {
Expand All @@ -81,12 +85,16 @@ public TopologyModeSelectionPanel() {

private void createAndAddModeButton(
Zone.TopologyType type,
String imageFile,
String imageFileOn,
String imageFileOff,
String toolTipKey,
Zone.TopologyTypeSet initiallySelectedTypes)
throws IOException {
final var button = new JToggleButton(new ImageIcon(ImageUtil.getImage(imageFile)));
final var button = new JToggleButton();
if (imageFileOff != null && !imageFileOff.isEmpty())
button.setIcon(new ImageIcon(ImageUtil.getImage(imageFileOff)));
button.setToolTipText(I18N.getText(toolTipKey));
button.setSelectedIcon(new ImageIcon(ImageUtil.getImage(imageFileOn)));
button.setSelected(initiallySelectedTypes.contains(type));
this.add(button);
modeButtons.put(type, button);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.