suggs: condense file sizes to MB, better selection handling
This commit is contained in:
parent
851223fa9f
commit
13f82e3866
|
@ -125,7 +125,9 @@
|
|||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<disabledTextColor color="-10124141"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f7802" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
|
@ -143,7 +145,9 @@
|
|||
<preferred-size width="150" height="-1"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<properties>
|
||||
<disabledTextColor color="-10124141"/>
|
||||
</properties>
|
||||
</component>
|
||||
<grid id="27515" layout-manager="GridLayoutManager" row-count="1" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
|
|
|
@ -126,6 +126,13 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||
}
|
||||
});
|
||||
|
||||
fTitle.setText("");
|
||||
fArtist.setText("");
|
||||
dTrackNo.setText("\u200E");
|
||||
dFileSize.setText("\u200E");
|
||||
fTitle.setEnabled(false);
|
||||
fArtist.setEnabled(false);
|
||||
|
||||
frame.setVisible(true);
|
||||
}
|
||||
|
||||
|
@ -184,16 +191,26 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||
public void valueChanged(ListSelectionEvent listSelectionEvent) {
|
||||
curIndex = dSongList.getSelectedIndex();
|
||||
if (curIndex >= 0) {
|
||||
fTitle.setEnabled(true);
|
||||
fArtist.setEnabled(true);
|
||||
AudioTrack at = tracklist.get(curIndex);
|
||||
fTitle.setText(at.title);
|
||||
fArtist.setText(at.artist);
|
||||
dTrackNo.setText(String.format("MT_%02d", curIndex+1));
|
||||
dFileSize.setText((at.size / 1000) + "kb");
|
||||
dFileSize.setText(at.size + " B");
|
||||
if (at.size > 1023) {
|
||||
dFileSize.setText((at.size / 1024) + " KB");
|
||||
}
|
||||
if (at.size > 1048575) {
|
||||
dFileSize.setText((at.size / 1048576) + " MB");
|
||||
}
|
||||
} else {
|
||||
fTitle.setEnabled(false);
|
||||
fArtist.setEnabled(false);
|
||||
fTitle.setText("");
|
||||
fArtist.setText("");
|
||||
dTrackNo.setText("--");
|
||||
dFileSize.setText("-kb");
|
||||
dTrackNo.setText("\u200E");
|
||||
dFileSize.setText("\u200E");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -251,7 +268,13 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
|||
File selectedFile = fileChooser.getSelectedFile();
|
||||
sptrack = selectedFile;
|
||||
dSTitle.setText(selectedFile.getName());
|
||||
dSSize.setText((selectedFile.length() / 1000) + "kb");
|
||||
dSSize.setText(selectedFile.length() + " B");
|
||||
if (selectedFile.length() > 1023) {
|
||||
dSSize.setText((selectedFile.length() / 1024) + " KB");
|
||||
}
|
||||
if (selectedFile.length() > 1048575) {
|
||||
dSSize.setText((selectedFile.length() / 1048576) + " MB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user