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"/>
|
||||||
|
@ -337,7 +341,7 @@
|
||||||
<text value="no track"/>
|
<text value="no track"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="c11e8" class="javax.swing.JLabel" binding="dSSize">
|
<component id="c11e8" class="javax.swing.JLabel" binding="dSSize">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
@ -347,7 +351,7 @@
|
||||||
<text value="no size"/>
|
<text value="no size"/>
|
||||||
</properties>
|
</properties>
|
||||||
</component>
|
</component>
|
||||||
<component id="8480f" class="javax.swing.JLabel" binding="dMSize">
|
<component id="8480f" class="javax.swing.JLabel" binding="dMSize">
|
||||||
<constraints>
|
<constraints>
|
||||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||||
</constraints>
|
</constraints>
|
||||||
|
|
|
@ -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");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,11 +264,17 @@ public class Suggs implements ActionListener, ListSelectionListener {
|
||||||
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("ATRAC9", "at9"));
|
fileChooser.addChoosableFileFilter(new FileNameExtensionFilter("ATRAC9", "at9"));
|
||||||
|
|
||||||
int result = fileChooser.showOpenDialog(frame);
|
int result = fileChooser.showOpenDialog(frame);
|
||||||
if (result == JFileChooser.APPROVE_OPTION) {
|
if (result == JFileChooser.APPROVE_OPTION) {
|
||||||
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