// setup radioboxes
capacity_k_bit_s_radiobox.setText("KBit/s");
capacity_k_byte_s_radiobox.setText("KByte/s");
capacity_k_byte_s_radiobox.setSelected(true);
capacity_k_bit_s_radiobox.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent event) {
if(capacity_k_bit_s_radiobox.isSelected() && !already_marked_k_bit) {
long down = Integer.parseInt(download_capacity_text_field.getText());
long up = Integer.parseInt(upload_capacity_text_field.getText());
download_capacity_text_field.setText((down*=8) + "");
upload_capacity_text_field.setText((up*=8) + "");
already_marked_k_bit = true;
already_marked_k_byte = false;
}
}
});
capacity_k_byte_s_radiobox.addChangeListener(new ChangeListener() {
public void stateChanged(ChangeEvent event) {
if(capacity_k_byte_s_radiobox.isSelected() && !already_marked_k_byte) {
long down = Integer.parseInt(download_capacity_text_field.getText());
long up = Integer.parseInt(upload_capacity_text_field.getText());
download_capacity_text_field.setText((down/=8) + "");