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"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties>
|
||||||
|
<disabledTextColor color="-10124141"/>
|
||||||
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="f7802" class="javax.swing.JLabel">
|
<component id="f7802" class="javax.swing.JLabel">
|
||||||
<constraints>
|
<constraints>
|
||||||
|
@ -143,7 +145,9 @@
|
||||||
<preferred-size width="150" height="-1"/>
|
<preferred-size width="150" height="-1"/>
|
||||||
</grid>
|
</grid>
|
||||||
</constraints>
|
</constraints>
|
||||||
<properties/>
|
<properties>
|
||||||
|
<disabledTextColor color="-10124141"/>
|
||||||
|
</properties>
|
||||||
</component>
|
</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">
|
<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"/>
|
<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);
|
frame.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,16 +191,26 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
public void valueChanged(ListSelectionEvent listSelectionEvent) {
|
public void valueChanged(ListSelectionEvent listSelectionEvent) {
|
||||||
curIndex = dSongList.getSelectedIndex();
|
curIndex = dSongList.getSelectedIndex();
|
||||||
if (curIndex >= 0) {
|
if (curIndex >= 0) {
|
||||||
|
fTitle.setEnabled(true);
|
||||||
|
fArtist.setEnabled(true);
|
||||||
AudioTrack at = tracklist.get(curIndex);
|
AudioTrack at = tracklist.get(curIndex);
|
||||||
fTitle.setText(at.title);
|
fTitle.setText(at.title);
|
||||||
fArtist.setText(at.artist);
|
fArtist.setText(at.artist);
|
||||||
dTrackNo.setText(String.format("MT_%02d", curIndex+1));
|
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 {
|
} else {
|
||||||
|
fTitle.setEnabled(false);
|
||||||
|
fArtist.setEnabled(false);
|
||||||
fTitle.setText("");
|
fTitle.setText("");
|
||||||
fArtist.setText("");
|
fArtist.setText("");
|
||||||
dTrackNo.setText("--");
|
dTrackNo.setText("\u200E");
|
||||||
dFileSize.setText("-kb");
|
dFileSize.setText("\u200E");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +268,13 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
File selectedFile = fileChooser.getSelectedFile();
|
File selectedFile = fileChooser.getSelectedFile();
|
||||||
sptrack = selectedFile;
|
sptrack = selectedFile;
|
||||||
dSTitle.setText(selectedFile.getName());
|
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