Skip to content

Commit 48ca792

Browse files
Merge pull request #60 from EatSleepProgramRepeat/59-table-only-highlights-columns-blue-after-2nd-search
fixed blue highlighting, updated version
2 parents 0692147 + 6ae36ff commit 48ca792

2 files changed

Lines changed: 10 additions & 11 deletions

File tree

src/main/java/com/CDPrintable/ProgramWindow.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ public void mouseClicked(MouseEvent e) {
129129
selectedItem = "";
130130
}
131131

132-
setSearchStatus("Preforming search...", "blue");
132+
setSearchStatus("Performing search...", "blue");
133133
clearIdList();
134134
String finalSelectedItem = selectedItem;
135135
Constants.THREAD_MANAGER.submit(() -> {
@@ -138,7 +138,6 @@ public void mouseClicked(MouseEvent e) {
138138
switch (finalSelectedItem) {
139139
case "CDStub" -> {
140140
columnsToHighlight = new int[]{0, 1};
141-
// Get CDStubs and set the table model
142141
MusicBrainzCDStub[] cdStubs = reader.getCDStubs();
143142
for (MusicBrainzCDStub cdStub : cdStubs) {
144143
addId(cdStub.getId());
@@ -147,7 +146,6 @@ public void mouseClicked(MouseEvent e) {
147146
searchTable.setModel(reader.getCDStubsAsTableModel(cdStubs));
148147
}
149148
case "Artist" -> {
150-
// Get Artists and set the table model
151149
MusicBrainzArtist[] artists = reader.getArtists();
152150
for (MusicBrainzArtist artist : artists) {
153151
addId(artist.getId());
@@ -157,7 +155,6 @@ public void mouseClicked(MouseEvent e) {
157155
}
158156
case "Release" -> {
159157
columnsToHighlight = new int[]{0, 1};
160-
// Get Releases and set the table model
161158
MusicBrainzRelease[] releases = reader.getReleases();
162159
for (MusicBrainzRelease release : releases) {
163160
addId(release.getId());
@@ -167,13 +164,15 @@ public void mouseClicked(MouseEvent e) {
167164
}
168165
default -> JOptionPane.showMessageDialog(panel, "Please select a search type.");
169166
}
167+
168+
// Reapply the custom renderer after setting the new model
170169
if (columnsToHighlight != null) {
171170
for (int column : columnsToHighlight) {
172171
searchTable.getColumnModel().getColumn(column).setCellRenderer(new LightBlueColumnRenderer());
173172
}
174173
}
174+
resizeColumnWidths(searchTable);
175175
});
176-
resizeColumnWidths(searchTable);
177176
});
178177

179178
cdSearchPanel.setLayout(new FlowLayout());
@@ -343,7 +342,7 @@ public void changedUpdate(DocumentEvent e) {} // Not used
343342
userAgentPanel.add(fullAgentPanel, BorderLayout.NORTH);
344343
userAgentPanel.add(userAgentInputPanel, BorderLayout.CENTER);
345344

346-
// Add sub-panels to the main panel
345+
// Add subpanels to the main panel
347346
panel.add(userAgentPanel);
348347
panel.add(fontPanel);
349348

@@ -455,13 +454,13 @@ private void createTrackDialog(String title, String artist, int trackCount, Stri
455454
panel.add(new JLabel("Date: " + date));
456455
}
457456

458-
// Add label panel to main panel
457+
// Add the label panel to the main panel
459458
mainPanel.add(panel, BorderLayout.NORTH);
460-
// Add table to main panel
459+
// Add table to the main panel
461460
JTable trackTable = new JTable(model);
462461
JScrollPane trackScrollPane = new JScrollPane(trackTable);
463462
mainPanel.add(trackScrollPane, BorderLayout.CENTER);
464-
// Add bottom (question) label to main panel
463+
// Add bottom (question) label to the main panel
465464
mainPanel.add(new JLabel("Would you like to add this record to your CD label?"), BorderLayout.SOUTH);
466465
setSearchStatus("All done!", "green");
467466

@@ -470,7 +469,7 @@ private void createTrackDialog(String title, String artist, int trackCount, Stri
470469
if (result == JOptionPane.YES_OPTION) {
471470
System.out.println("ask her out");
472471
} else if (result == JOptionPane.NO_OPTION) {
473-
System.out.println("get rejected idiot");
472+
System.out.println("she rejected you...");
474473
}
475474
}
476475

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# Application version.
22

33
# MAJOR MINOR PATCH
4-
version=1.10.7
4+
version=1.10.8

0 commit comments

Comments
 (0)