Dropdown available for kb versus kB issues.

Bandwidth calculation available from 2 directions (added from GB -> kbps).
Layout manager switched for easier development.
This commit is contained in:
mathiasdm
2009-04-09 20:36:22 +00:00
parent 8f690a8f67
commit 977d6eec88
14 changed files with 809 additions and 436 deletions

View File

@ -1,51 +1,115 @@
<project name="desktopgui" default="compile" basedir=".">
<description>
A desktopgui for I2P
</description>
<!-- set global properties for this build -->
<property name="src" location="src"/>
<property name="bin" location="bin"/>
<property name="dist" location="dist"/>
<property name="lib" location="lib"/>
<property name="i2pref" location="../../build"/>
<path id="classpath">
<fileset dir="${lib}" includes="**/*.jar"/>
<fileset dir="${i2pref}" includes="**/*.jar"/>
</path>
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="desktopgui" default="default" basedir=".">
<description>Builds, tests, and runs the project desktopgui.</description>
<import file="nbproject/build-impl.xml"/>
<!--
<target name="init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="${dist}"/>
<mkdir dir="${bin}"/>
</target>
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
<target name="compile" depends="init"
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="BOB-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
<property name="build_src" location="src"/>
<property name="build_bin" location="bin"/>
<property name="build_dist" location="dist"/>
<property name="build_lib" location="lib"/>
<property name="build_i2pref" location="../../build"/>
<path id="build_classpath">
<fileset dir="${build_lib}" includes="**/*.jar"/>
<fileset dir="${build_i2pref}" includes="**/*.jar"/>
</path>
<target name="build_init">
<!-- Create the time stamp -->
<tstamp/>
<mkdir dir="${build_dist}"/>
<mkdir dir="${build_bin}"/>
</target>
<target name="build_compile" depends="build_init"
description="compile the source " >
<!-- Compile the java code from ${src} into ${bin} -->
<javac srcdir="${src}" destdir="${bin}" classpathref="classpath"/>
<copy todir="${bin}">
<fileset dir="${src}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="jar" depends="compile"
<!-- Compile the java code from ${src} into ${bin} -->
<javac srcdir="${build_src}" destdir="${build_bin}" classpathref="build_classpath"/>
<copy todir="${build_bin}">
<fileset dir="${build_src}">
<exclude name="**/*.java"/>
</fileset>
</copy>
</target>
<target name="build_jar" depends="build_compile"
description="generate the distribution" >
<!-- Create the distribution directory -->
<mkdir dir="${dist}/lib"/>
<!-- Create the distribution directory -->
<mkdir dir="${build_dist}/lib"/>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<zip destfile="${dist}/desktopgui.jar" basedir="${bin}" />
</target>
<!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
<zip destfile="${build_dist}/desktopgui.jar" basedir="${build_bin}" />
</target>
<target name="clean"
<target name="build_clean"
description="clean up" >
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${bin}"/>
<delete dir="${dist}"/>
</target>
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build_bin}"/>
<delete dir="${build_dist}"/>
</target>
</project>

View File

@ -44,6 +44,7 @@ javac.test.classpath=\
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.encoding.used=${javadoc.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
@ -53,6 +54,7 @@ javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
jnlp.codebase.type=local
jnlp.codebase.url=file:/home/mathias/Documenten/Programmeren/i2p_monotone/repo/i2p.i2p/apps/desktopgui/dist/
jnlp.enabled=false
jnlp.offline-allowed=false
jnlp.signed=false

View File

@ -0,0 +1,11 @@
# Application global resources
Application.name = desktopgui
Application.title = I2P Desktop GUI
Application.version = 0.7.1
Application.vendor = I2P Ontwikkelaars
Application.homepage = http://www.i2p2.de
Application.description = Een anoniem communicatienetwerk.
Application.vendorId = I2P
Application.id = desktopgui
Application.lookAndFeel = system

View File

@ -4,7 +4,11 @@
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[610, 330]"/>
</Property>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
@ -20,85 +24,51 @@
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="49" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="downloadLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="uploadLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Component id="downloadChoice" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="kbps2" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="103" alignment="0" groupAlignment="0" max="-2" attributes="0">
<Group type="102" alignment="0" attributes="1">
<Component id="uploadChoice" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="kbps1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="nextButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="34" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace min="-2" pref="40" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="67" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="uploadLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="uploadChoice" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="kbps1" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="downloadLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadChoice" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="kbps2" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="173" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="271" max="32767" attributes="0"/>
<Component id="nextButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="nextButton">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="nextButton.text"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[72, 29]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[72, 29]"/>
</Property>
<Property name="name" type="java.lang.String" value="nextButton" noResource="true"/>
</Properties>
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="nextButtonMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="250" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="uploadLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="uploadLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="60" width="-1" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="downloadLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="downloadLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="110" width="-1" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="uploadChoice">
<Properties>
@ -121,6 +91,11 @@
<Property name="selectedIndex" type="int" value="3"/>
<Property name="name" type="java.lang.String" value="uploadChoice" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="300" y="60" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="downloadChoice">
<Properties>
@ -143,18 +118,60 @@
<Property name="selectedIndex" type="int" value="3"/>
<Property name="name" type="java.lang.String" value="downloadChoice" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="300" y="110" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="kbps1">
<Component class="javax.swing.JLabel" name="speedExplanation">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="kbps1.text"/>
<Property name="name" type="java.lang.String" value="kbps1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="speedExplanation.text"/>
<Property name="name" type="java.lang.String" value="speedExplanation" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="160" width="570" height="60"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="kbps2">
<Component class="javax.swing.JComboBox" name="uploadkbps">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="kbps2.text"/>
<Property name="name" type="java.lang.String" value="kbps2" noResource="true"/>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="uploadKbit" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="uploadkbpsActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="470" y="60" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="downloadkbps">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="downloadKbit" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadkbpsActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="470" y="110" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -9,6 +9,7 @@ package gui;
import java.awt.Dimension;
import java.awt.Point;
import java.util.Properties;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import persistence.PropertyManager;
import util.IntegerVerifier;
@ -26,12 +27,13 @@ public class SpeedSelector extends javax.swing.JFrame {
initComponentsCustom();
initSpeeds(props);
this.setVisible(true);
this.setLocationRelativeTo(null);
this.requestFocus();
}
public SpeedSelector(Point point, Dimension dimension) {
public SpeedSelector(Point point) {
this();
this.setLocation(point);
this.setSize(dimension);
}
public void initComponentsCustom() {
@ -53,101 +55,115 @@ public class SpeedSelector extends javax.swing.JFrame {
downloadLabel = new javax.swing.JLabel();
uploadChoice = new javax.swing.JComboBox();
downloadChoice = new javax.swing.JComboBox();
kbps1 = new javax.swing.JLabel();
kbps2 = new javax.swing.JLabel();
speedExplanation = new javax.swing.JLabel();
uploadkbps = new javax.swing.JComboBox();
downloadkbps = new javax.swing.JComboBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(SpeedSelector.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setMinimumSize(new java.awt.Dimension(610, 330));
setName("Form"); // NOI18N
setResizable(false);
getContentPane().setLayout(null);
nextButton.setText(resourceMap.getString("nextButton.text")); // NOI18N
nextButton.setMaximumSize(new java.awt.Dimension(72, 29));
nextButton.setMinimumSize(new java.awt.Dimension(72, 29));
nextButton.setName("nextButton"); // NOI18N
nextButton.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
nextButtonMouseClicked(evt);
}
});
getContentPane().add(nextButton);
nextButton.setBounds(440, 250, 90, 29);
uploadLabel.setText(resourceMap.getString("uploadLabel.text")); // NOI18N
uploadLabel.setName("uploadLabel"); // NOI18N
getContentPane().add(uploadLabel);
uploadLabel.setBounds(20, 60, 246, 30);
downloadLabel.setText(resourceMap.getString("downloadLabel.text")); // NOI18N
downloadLabel.setName("downloadLabel"); // NOI18N
getContentPane().add(downloadLabel);
downloadLabel.setBounds(20, 110, 263, 30);
uploadChoice.setEditable(true);
uploadChoice.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "100", "200", "500", "1000", "2000", "4000", "8000", "10000", "20000", "50000", "100000" }));
uploadChoice.setSelectedIndex(3);
uploadChoice.setName("uploadChoice"); // NOI18N
getContentPane().add(uploadChoice);
uploadChoice.setBounds(300, 60, 154, 27);
downloadChoice.setEditable(true);
downloadChoice.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "100", "200", "500", "1000", "2000", "4000", "8000", "10000", "20000", "50000", "100000" }));
downloadChoice.setSelectedIndex(3);
downloadChoice.setName("downloadChoice"); // NOI18N
getContentPane().add(downloadChoice);
downloadChoice.setBounds(300, 110, 154, 27);
kbps1.setText(resourceMap.getString("kbps1.text")); // NOI18N
kbps1.setName("kbps1"); // NOI18N
speedExplanation.setText(resourceMap.getString("speedExplanation.text")); // NOI18N
speedExplanation.setName("speedExplanation"); // NOI18N
getContentPane().add(speedExplanation);
speedExplanation.setBounds(20, 160, 570, 60);
kbps2.setText(resourceMap.getString("kbps2.text")); // NOI18N
kbps2.setName("kbps2"); // NOI18N
uploadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
uploadkbps.setName("uploadKbit"); // NOI18N
uploadkbps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
uploadkbpsActionPerformed(evt);
}
});
getContentPane().add(uploadkbps);
uploadkbps.setBounds(470, 60, 68, 27);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(49, 49, 49)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(downloadLabel)
.addComponent(uploadLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(downloadChoice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(kbps2))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(uploadChoice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(kbps1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(nextButton)
.addGap(34, 34, 34))))
.addGap(40, 40, 40))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(67, 67, 67)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(uploadLabel)
.addComponent(uploadChoice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(kbps1))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(downloadLabel)
.addComponent(downloadChoice, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(kbps2))
.addContainerGap(173, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(271, Short.MAX_VALUE)
.addComponent(nextButton)
.addContainerGap())
);
downloadkbps.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
downloadkbps.setName("downloadKbit"); // NOI18N
downloadkbps.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
downloadkbpsActionPerformed(evt);
}
});
getContentPane().add(downloadkbps);
downloadkbps.setBounds(470, 110, 68, 27);
pack();
}// </editor-fold>//GEN-END:initComponents
private void nextButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nextButtonMouseClicked
props.setProperty(SpeedSelectorConstants.MAXUPLOADCAPABLE, uploadChoice.getSelectedItem().toString());
props.setProperty(SpeedSelectorConstants.MAXDOWNLOADCAPABLE, downloadChoice.getSelectedItem().toString());
if(uploadkbps.getSelectedIndex() == KILOBIT)
props.setProperty(SpeedSelectorConstants.MAXUPLOADCAPABLE, uploadChoice.getSelectedItem().toString());
else
props.setProperty(SpeedSelectorConstants.MAXUPLOADCAPABLE, "" + Integer.parseInt(uploadChoice.getSelectedItem().toString())*8);
if(downloadkbps.getSelectedIndex() == KILOBIT)
props.setProperty(SpeedSelectorConstants.MAXDOWNLOADCAPABLE, downloadChoice.getSelectedItem().toString());
else
props.setProperty(SpeedSelectorConstants.MAXDOWNLOADCAPABLE, "" + Integer.parseInt(downloadChoice.getSelectedItem().toString())*8);
PropertyManager.saveProps(props);
new SpeedSelector2(this.getLocationOnScreen(), this.getSize());
new SpeedSelector2(this.getLocationOnScreen());
this.dispose();
}//GEN-LAST:event_nextButtonMouseClicked
private void uploadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_uploadkbpsActionPerformed
kbpsSwitchPerformed(uploadkbps, uploadChoice);
}//GEN-LAST:event_uploadkbpsActionPerformed
private void downloadkbpsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_downloadkbpsActionPerformed
kbpsSwitchPerformed(downloadkbps, downloadChoice);
}//GEN-LAST:event_downloadkbpsActionPerformed
private void kbpsSwitchPerformed(JComboBox kbps, JComboBox speed) {
int index = kbps.getSelectedIndex();
int previous = Integer.parseInt(speed.getSelectedItem().toString());
if(index == KILOBIT) {
speed.setSelectedItem("" + previous*8);
}
else {
speed.setSelectedItem("" + previous/8);
}
}
private void initSpeeds(Properties props) {
String up = props.getProperty(SpeedSelectorConstants.MAXUPLOADCAPABLE);
String down = props.getProperty(SpeedSelectorConstants.MAXDOWNLOADCAPABLE);
@ -165,12 +181,15 @@ private void initSpeeds(Properties props) {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JComboBox downloadChoice;
private javax.swing.JLabel downloadLabel;
private javax.swing.JLabel kbps1;
private javax.swing.JLabel kbps2;
private javax.swing.JComboBox downloadkbps;
private javax.swing.JButton nextButton;
private javax.swing.JLabel speedExplanation;
private javax.swing.JComboBox uploadChoice;
private javax.swing.JLabel uploadLabel;
private javax.swing.JComboBox uploadkbps;
// End of variables declaration//GEN-END:variables
Properties props;
private static final int KILOBIT = 0;
private static final int KILOBYTE = 1;
}

View File

@ -8,7 +8,11 @@
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[610, 330]"/>
</Property>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
@ -24,50 +28,8 @@
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace pref="406" max="32767" attributes="0"/>
<Component id="returnButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="nextButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="74" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="42" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="questionLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="12" pref="12" max="12" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="downloadButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="browseButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="32" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="54" max="-2" attributes="0"/>
<Component id="questionLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="browseButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="downloadButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="120" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nextButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="returnButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="nextButton">
@ -78,6 +40,11 @@
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="nextButtonMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="250" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="returnButton">
<Properties>
@ -87,12 +54,22 @@
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="returnButtonMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="336" y="250" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="questionLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="questionLabel.text"/>
<Property name="name" type="java.lang.String" value="questionLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="30" y="40" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="browseButton">
<Properties>
@ -100,8 +77,14 @@
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="browseButton.text"/>
<Property name="actionCommand" type="java.lang.String" resourceKey="browseButton.actionCommand"/>
<Property name="name" type="java.lang.String" value="browseButton" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="40" y="130" width="-1" height="40"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JRadioButton" name="downloadButton">
<Properties>
@ -109,8 +92,25 @@
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" resourceKey="downloadButton.text"/>
<Property name="actionCommand" type="java.lang.String" resourceKey="downloadButton.actionCommand"/>
<Property name="name" type="java.lang.String" value="downloadButton" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="40" y="80" width="-1" height="40"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="30" y="190" width="530" height="50"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -21,13 +21,13 @@ public class SpeedSelector2 extends javax.swing.JFrame {
Properties props;
/** Creates new form ProfileSelector2 */
public SpeedSelector2(Point point, Dimension dimension) {
public SpeedSelector2(Point point) {
this.props = PropertyManager.getProps();
initComponents();
this.setLocation(point);
this.setSize(dimension);
loadButtonSelection();
this.setVisible(true);
this.requestFocus();
}
/** This method is called from within the constructor to
@ -45,11 +45,15 @@ public class SpeedSelector2 extends javax.swing.JFrame {
questionLabel = new javax.swing.JLabel();
browseButton = new javax.swing.JRadioButton();
downloadButton = new javax.swing.JRadioButton();
jLabel1 = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(SpeedSelector2.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setMinimumSize(new java.awt.Dimension(610, 330));
setName("Form"); // NOI18N
setResizable(false);
getContentPane().setLayout(null);
nextButton.setText(resourceMap.getString("nextButton.text")); // NOI18N
nextButton.setName("nextButton"); // NOI18N
@ -58,6 +62,8 @@ public class SpeedSelector2 extends javax.swing.JFrame {
nextButtonMouseClicked(evt);
}
});
getContentPane().add(nextButton);
nextButton.setBounds(440, 250, 90, 29);
returnButton.setText(resourceMap.getString("returnButton.text")); // NOI18N
returnButton.setName("returnButton"); // NOI18N
@ -66,54 +72,32 @@ public class SpeedSelector2 extends javax.swing.JFrame {
returnButtonMouseClicked(evt);
}
});
getContentPane().add(returnButton);
returnButton.setBounds(336, 250, 90, 29);
questionLabel.setText(resourceMap.getString("questionLabel.text")); // NOI18N
questionLabel.setName("questionLabel"); // NOI18N
getContentPane().add(questionLabel);
questionLabel.setBounds(30, 40, 265, 17);
buttonGroup1.add(browseButton);
browseButton.setText(resourceMap.getString("browseButton.text")); // NOI18N
browseButton.setActionCommand(resourceMap.getString("browseButton.actionCommand")); // NOI18N
browseButton.setName("browseButton"); // NOI18N
getContentPane().add(browseButton);
browseButton.setBounds(40, 130, 520, 40);
buttonGroup1.add(downloadButton);
downloadButton.setText(resourceMap.getString("downloadButton.text")); // NOI18N
downloadButton.setActionCommand(resourceMap.getString("downloadButton.actionCommand")); // NOI18N
downloadButton.setName("downloadButton"); // NOI18N
getContentPane().add(downloadButton);
downloadButton.setBounds(40, 80, 499, 40);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addContainerGap(406, Short.MAX_VALUE)
.addComponent(returnButton)
.addGap(18, 18, 18)
.addComponent(nextButton)
.addGap(74, 74, 74))
.addGroup(layout.createSequentialGroup()
.addGap(42, 42, 42)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(questionLabel)
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(downloadButton)
.addComponent(browseButton))))
.addContainerGap(32, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGap(54, 54, 54)
.addComponent(questionLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(browseButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(downloadButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 120, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nextButton)
.addComponent(returnButton))
.addContainerGap())
);
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
getContentPane().add(jLabel1);
jLabel1.setBounds(30, 190, 530, 50);
pack();
}// </editor-fold>//GEN-END:initComponents
@ -121,18 +105,19 @@ public class SpeedSelector2 extends javax.swing.JFrame {
private void returnButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_returnButtonMouseClicked
saveButtonSelection();
PropertyManager.saveProps(props);
new SpeedSelector(this.getLocationOnScreen(), this.getSize()).setVisible(true);
new SpeedSelector(this.getLocationOnScreen());
this.dispose();
}//GEN-LAST:event_returnButtonMouseClicked
private void nextButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_nextButtonMouseClicked
saveButtonSelection();
PropertyManager.saveProps(props);
new SpeedSelector3(this.getLocationOnScreen(), this.getSize()).setVisible(true);
new SpeedSelector3(this.getLocationOnScreen(), this.getSize());
this.dispose();
}//GEN-LAST:event_nextButtonMouseClicked
private void loadButtonSelection() {
Enumeration<AbstractButton> elements = buttonGroup1.getElements();
while(elements.hasMoreElements()) {
AbstractButton button = elements.nextElement();
@ -140,7 +125,7 @@ private void loadButtonSelection() {
continue;
if(props.getProperty(SpeedSelectorConstants.USERTYPE) == null)
break;
String type = button.getText().split(":")[0];
String type = button.getActionCommand();
if(type.equals(props.getProperty(SpeedSelectorConstants.USERTYPE))) {
button.setSelected(true);
break;
@ -155,7 +140,7 @@ private void saveButtonSelection() {
if(button == null)
continue;
if(button.isSelected()) {
String type = button.getText().split(":")[0];
String type = button.getActionCommand();
props.setProperty(SpeedSelectorConstants.USERTYPE, type);
break;
}
@ -166,6 +151,7 @@ private void saveButtonSelection() {
private javax.swing.JRadioButton browseButton;
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JRadioButton downloadButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JButton nextButton;
private javax.swing.JLabel questionLabel;
private javax.swing.JButton returnButton;

View File

@ -4,7 +4,11 @@
<Properties>
<Property name="defaultCloseOperation" type="int" value="2"/>
<Property name="title" type="java.lang.String" resourceKey="Form.title"/>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[670, 330]"/>
</Property>
<Property name="name" type="java.lang.String" value="Form" noResource="true"/>
<Property name="resizable" type="boolean" value="false"/>
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
@ -18,91 +22,11 @@
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
<AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,74,0,0,2,-108"/>
</AuxValues>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel1" alignment="1" min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="uploadLabel" min="-2" max="-2" attributes="0"/>
<Component id="uploadBurstLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="uploadUsageLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="uploadBurstField" alignment="0" max="32767" attributes="1"/>
<Component id="uploadField" alignment="0" max="32767" attributes="1"/>
<Component id="uploadMonth" alignment="0" max="32767" attributes="1"/>
</Group>
<EmptySpace min="-2" pref="46" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="downloadLabel" min="-2" max="-2" attributes="0"/>
<Component id="downloadBurstLabel" min="-2" max="-2" attributes="0"/>
<Component id="downloadUsageLabel" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" max="-2" attributes="0">
<Component id="downloadField" max="32767" attributes="1"/>
<Component id="downloadMonth" alignment="0" max="32767" attributes="1"/>
<Component id="downloadBurstField" alignment="0" max="32767" attributes="1"/>
</Group>
</Group>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="previousButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="finishButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="33" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="400" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="81" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="uploadLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="uploadField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="uploadBurstLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadBurstLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadBurstField" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="uploadBurstField" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="uploadUsageLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadUsageLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="uploadMonth" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="downloadMonth" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="48" max="32767" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="previousButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="finishButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout">
<Property name="useNullLayout" type="boolean" value="true"/>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="finishButton">
@ -113,6 +37,11 @@
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="finishButtonMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="440" y="250" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JButton" name="previousButton">
<Properties>
@ -122,48 +51,88 @@
<Events>
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="previousButtonMouseClicked"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="336" y="250" width="90" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="jLabel1">
<Component class="javax.swing.JLabel" name="settingsInfo">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="jLabel1.text"/>
<Property name="name" type="java.lang.String" value="jLabel1" noResource="true"/>
<Property name="text" type="java.lang.String" resourceKey="settingsInfo.text"/>
<Property name="name" type="java.lang.String" value="settingsInfo" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="30" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="uploadLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="uploadLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="70" width="140" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="downloadLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="downloadLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="340" y="70" width="160" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="uploadBurstLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="uploadBurstLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadBurstLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="110" width="140" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="downloadBurstLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="downloadBurstLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadBurstLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="340" y="110" width="160" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="uploadUsageLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="uploadUsageLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadUsageLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="150" width="-1" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="downloadUsageLabel">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="downloadUsageLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadUsageLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="340" y="150" width="-1" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="uploadField">
<Properties>
@ -176,6 +145,11 @@
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedFieldKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="70" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="uploadBurstField">
<Properties>
@ -185,6 +159,11 @@
</Property>
<Property name="name" type="java.lang.String" value="uploadBurstField" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="110" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="downloadField">
<Properties>
@ -197,6 +176,11 @@
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="speedFieldKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="500" y="70" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="downloadBurstField">
<Properties>
@ -206,18 +190,148 @@
</Property>
<Property name="name" type="java.lang.String" value="downloadBurstField" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="500" y="110" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="uploadMonth">
<Component class="javax.swing.JComboBox" name="kbpsBurstDownload">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="kbpsBurstDownload" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="kbpsBurstDownloadActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="580" y="110" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="kbpsUpload">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="kbpsUpload" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="kbpsUploadActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="70" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="kbpsBurstUpload">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="kbpsBurstUpload" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="kbpsBurstUploadActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="110" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JComboBox" name="kbpsDownload">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="2">
<StringItem index="0" value="kbps"/>
<StringItem index="1" value="kBps"/>
</StringArray>
</Property>
<Property name="name" type="java.lang.String" value="kbpsDownload" noResource="true"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="kbpsDownloadActionPerformed"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="580" y="70" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="uploadGB">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="uploadUsageLabel.text"/>
<Property name="name" type="java.lang.String" value="uploadUsageLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="240" y="150" width="45" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JTextField" name="uploadMonth">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="uploadMonth.text"/>
<Property name="name" type="java.lang.String" value="uploadMonth" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="160" y="150" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="downloadMonth">
<Component class="javax.swing.JTextField" name="downloadMonth">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="downloadMonth.text"/>
<Property name="name" type="java.lang.String" value="downloadMonth" noResource="true"/>
</Properties>
<Events>
<EventHandler event="keyReleased" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent" handler="monthKeyReleased"/>
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="500" y="150" width="-1" height="-1"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="downloadGB">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="downloadUsageLabel.text"/>
<Property name="name" type="java.lang.String" value="downloadUsageLabel" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="580" y="150" width="-1" height="30"/>
</Constraint>
</Constraints>
</Component>
<Component class="javax.swing.JLabel" name="explanation">
<Properties>
<Property name="text" type="java.lang.String" resourceKey="explanation.text"/>
<Property name="name" type="java.lang.String" value="explanation" noResource="true"/>
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout" value="org.netbeans.modules.form.compat2.layouts.DesignAbsoluteLayout$AbsoluteConstraintsDescription">
<AbsoluteConstraints x="20" y="200" width="600" height="40"/>
</Constraint>
</Constraints>
</Component>
</SubComponents>
</Form>

View File

@ -9,6 +9,8 @@ package gui;
import java.awt.Dimension;
import java.awt.Point;
import java.util.Properties;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import persistence.PropertyManager;
import router.configuration.SpeedHandler;
import router.configuration.SpeedHelper;
@ -27,7 +29,9 @@ public class SpeedSelector3 extends javax.swing.JFrame {
this.setLocation(point);
this.setSize(dimension);
initSpeeds();
initUsage();
this.setVisible(true);
this.requestFocus();
}
/** This method is called from within the constructor to
@ -41,7 +45,7 @@ public class SpeedSelector3 extends javax.swing.JFrame {
finishButton = new javax.swing.JButton();
previousButton = new javax.swing.JButton();
jLabel1 = new javax.swing.JLabel();
settingsInfo = new javax.swing.JLabel();
uploadLabel = new javax.swing.JLabel();
downloadLabel = new javax.swing.JLabel();
uploadBurstLabel = new javax.swing.JLabel();
@ -52,13 +56,23 @@ public class SpeedSelector3 extends javax.swing.JFrame {
uploadBurstField = new javax.swing.JTextField();
downloadField = new javax.swing.JTextField();
downloadBurstField = new javax.swing.JTextField();
uploadMonth = new javax.swing.JLabel();
downloadMonth = new javax.swing.JLabel();
kbpsBurstDownload = new javax.swing.JComboBox();
kbpsUpload = new javax.swing.JComboBox();
kbpsBurstUpload = new javax.swing.JComboBox();
kbpsDownload = new javax.swing.JComboBox();
uploadGB = new javax.swing.JLabel();
uploadMonth = new javax.swing.JTextField();
downloadMonth = new javax.swing.JTextField();
downloadGB = new javax.swing.JLabel();
explanation = new javax.swing.JLabel();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(desktopgui.Main.class).getContext().getResourceMap(SpeedSelector3.class);
setTitle(resourceMap.getString("Form.title")); // NOI18N
setMinimumSize(new java.awt.Dimension(670, 330));
setName("Form"); // NOI18N
setResizable(false);
getContentPane().setLayout(null);
finishButton.setText(resourceMap.getString("finishButton.text")); // NOI18N
finishButton.setName("finishButton"); // NOI18N
@ -67,6 +81,8 @@ public class SpeedSelector3 extends javax.swing.JFrame {
finishButtonMouseClicked(evt);
}
});
getContentPane().add(finishButton);
finishButton.setBounds(440, 250, 90, 29);
previousButton.setText(resourceMap.getString("previousButton.text")); // NOI18N
previousButton.setName("previousButton"); // NOI18N
@ -75,27 +91,43 @@ public class SpeedSelector3 extends javax.swing.JFrame {
previousButtonMouseClicked(evt);
}
});
getContentPane().add(previousButton);
previousButton.setBounds(336, 250, 90, 29);
jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
jLabel1.setName("jLabel1"); // NOI18N
settingsInfo.setText(resourceMap.getString("settingsInfo.text")); // NOI18N
settingsInfo.setName("settingsInfo"); // NOI18N
getContentPane().add(settingsInfo);
settingsInfo.setBounds(20, 30, 532, 17);
uploadLabel.setText(resourceMap.getString("uploadLabel.text")); // NOI18N
uploadLabel.setName("uploadLabel"); // NOI18N
getContentPane().add(uploadLabel);
uploadLabel.setBounds(20, 70, 140, 30);
downloadLabel.setText(resourceMap.getString("downloadLabel.text")); // NOI18N
downloadLabel.setName("downloadLabel"); // NOI18N
getContentPane().add(downloadLabel);
downloadLabel.setBounds(340, 70, 160, 30);
uploadBurstLabel.setText(resourceMap.getString("uploadBurstLabel.text")); // NOI18N
uploadBurstLabel.setName("uploadBurstLabel"); // NOI18N
getContentPane().add(uploadBurstLabel);
uploadBurstLabel.setBounds(20, 110, 140, 30);
downloadBurstLabel.setText(resourceMap.getString("downloadBurstLabel.text")); // NOI18N
downloadBurstLabel.setName("downloadBurstLabel"); // NOI18N
getContentPane().add(downloadBurstLabel);
downloadBurstLabel.setBounds(340, 110, 160, 30);
uploadUsageLabel.setText(resourceMap.getString("uploadUsageLabel.text")); // NOI18N
uploadUsageLabel.setName("uploadUsageLabel"); // NOI18N
getContentPane().add(uploadUsageLabel);
uploadUsageLabel.setBounds(20, 150, 141, 30);
downloadUsageLabel.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
downloadUsageLabel.setName("downloadUsageLabel"); // NOI18N
getContentPane().add(downloadUsageLabel);
downloadUsageLabel.setBounds(340, 150, 162, 30);
uploadField.setText(resourceMap.getString("uploadField.text")); // NOI18N
uploadField.setMinimumSize(new java.awt.Dimension(77, 27));
@ -105,10 +137,14 @@ public class SpeedSelector3 extends javax.swing.JFrame {
speedFieldKeyReleased(evt);
}
});
getContentPane().add(uploadField);
uploadField.setBounds(160, 70, 77, 27);
uploadBurstField.setText(resourceMap.getString("uploadBurstField.text")); // NOI18N
uploadBurstField.setMinimumSize(new java.awt.Dimension(77, 27));
uploadBurstField.setName("uploadBurstField"); // NOI18N
getContentPane().add(uploadBurstField);
uploadBurstField.setBounds(160, 110, 77, 27);
downloadField.setText(resourceMap.getString("downloadField.text")); // NOI18N
downloadField.setMinimumSize(new java.awt.Dimension(77, 27));
@ -118,84 +154,89 @@ public class SpeedSelector3 extends javax.swing.JFrame {
speedFieldKeyReleased(evt);
}
});
getContentPane().add(downloadField);
downloadField.setBounds(500, 70, 77, 27);
downloadBurstField.setText(resourceMap.getString("downloadBurstField.text")); // NOI18N
downloadBurstField.setMinimumSize(new java.awt.Dimension(77, 27));
downloadBurstField.setName("downloadBurstField"); // NOI18N
getContentPane().add(downloadBurstField);
downloadBurstField.setBounds(500, 110, 77, 27);
kbpsBurstDownload.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
kbpsBurstDownload.setName("kbpsBurstDownload"); // NOI18N
kbpsBurstDownload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kbpsBurstDownloadActionPerformed(evt);
}
});
getContentPane().add(kbpsBurstDownload);
kbpsBurstDownload.setBounds(580, 110, 68, 27);
kbpsUpload.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
kbpsUpload.setName("kbpsUpload"); // NOI18N
kbpsUpload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kbpsUploadActionPerformed(evt);
}
});
getContentPane().add(kbpsUpload);
kbpsUpload.setBounds(240, 70, 68, 27);
kbpsBurstUpload.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
kbpsBurstUpload.setName("kbpsBurstUpload"); // NOI18N
kbpsBurstUpload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kbpsBurstUploadActionPerformed(evt);
}
});
getContentPane().add(kbpsBurstUpload);
kbpsBurstUpload.setBounds(240, 110, 68, 27);
kbpsDownload.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "kbps", "kBps" }));
kbpsDownload.setName("kbpsDownload"); // NOI18N
kbpsDownload.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
kbpsDownloadActionPerformed(evt);
}
});
getContentPane().add(kbpsDownload);
kbpsDownload.setBounds(580, 70, 68, 27);
uploadGB.setText(resourceMap.getString("uploadUsageLabel.text")); // NOI18N
uploadGB.setName("uploadUsageLabel"); // NOI18N
getContentPane().add(uploadGB);
uploadGB.setBounds(240, 150, 45, 30);
uploadMonth.setText(resourceMap.getString("uploadMonth.text")); // NOI18N
uploadMonth.setName("uploadMonth"); // NOI18N
uploadMonth.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
monthKeyReleased(evt);
}
});
getContentPane().add(uploadMonth);
uploadMonth.setBounds(160, 150, 77, 27);
downloadMonth.setText(resourceMap.getString("downloadMonth.text")); // NOI18N
downloadMonth.setName("downloadMonth"); // NOI18N
downloadMonth.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
monthKeyReleased(evt);
}
});
getContentPane().add(downloadMonth);
downloadMonth.setBounds(500, 150, 77, 27);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(uploadLabel)
.addComponent(uploadBurstLabel)
.addComponent(uploadUsageLabel))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(uploadBurstField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(uploadField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(uploadMonth, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGap(46, 46, 46)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(downloadLabel)
.addComponent(downloadBurstLabel)
.addComponent(downloadUsageLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addComponent(downloadField, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(downloadMonth, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(downloadBurstField, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addGap(18, 18, 18))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(previousButton)
.addGap(18, 18, 18)
.addComponent(finishButton)
.addGap(33, 33, 33)))
.addGap(400, 400, 400))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(81, 81, 81)
.addComponent(jLabel1)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(uploadLabel)
.addComponent(downloadLabel)
.addComponent(uploadField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(downloadField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(uploadBurstLabel)
.addComponent(downloadBurstLabel)
.addComponent(downloadBurstField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(uploadBurstField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(uploadUsageLabel)
.addComponent(downloadUsageLabel)
.addComponent(uploadMonth)
.addComponent(downloadMonth))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(previousButton)
.addComponent(finishButton))
.addContainerGap())
);
downloadGB.setText(resourceMap.getString("downloadUsageLabel.text")); // NOI18N
downloadGB.setName("downloadUsageLabel"); // NOI18N
getContentPane().add(downloadGB);
downloadGB.setBounds(580, 150, 19, 30);
explanation.setText(resourceMap.getString("explanation.text")); // NOI18N
explanation.setName("explanation"); // NOI18N
getContentPane().add(explanation);
explanation.setBounds(20, 200, 600, 40);
pack();
}// </editor-fold>//GEN-END:initComponents
@ -203,7 +244,7 @@ public class SpeedSelector3 extends javax.swing.JFrame {
private void previousButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_previousButtonMouseClicked
saveSpeeds();
PropertyManager.saveProps(props);
new SpeedSelector2(this.getLocationOnScreen(), this.getSize()).setVisible(true);
new SpeedSelector2(this.getLocationOnScreen());
this.dispose();
}//GEN-LAST:event_previousButtonMouseClicked
@ -219,7 +260,7 @@ private void finishButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRS
//Working in kB, not kb!
SpeedHandler.setInboundBandwidth(maxDownload/8);
SpeedHandler.setOutboundBandwidth(maxUpload/8);
SpeedHandler.setInboundBurstBandwidth(maxDownloadBurst);
SpeedHandler.setInboundBurstBandwidth(maxDownloadBurst/8);
SpeedHandler.setOutboundBurstBandwidth(maxUploadBurst/8);
this.dispose();
@ -227,13 +268,88 @@ private void finishButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRS
private void speedFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_speedFieldKeyReleased
try {
initUsage(uploadField.getText(), downloadField.getText());
String upload = "";
if(kbpsUpload.getSelectedIndex() == KILOBIT)
upload = uploadField.getText();
else
upload = "" + Integer.parseInt(uploadField.getText())*8;
String download = "";
if(kbpsDownload.getSelectedIndex() == KILOBIT)
download = downloadField.getText();
else
download = "" + Integer.parseInt(downloadField.getText())*8;
initUsage(upload, download);
}
catch(NumberFormatException e) {
return;
}
}//GEN-LAST:event_speedFieldKeyReleased
private void kbpsUploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kbpsUploadActionPerformed
kbpsSwitchPerformed(kbpsUpload, uploadField);
}//GEN-LAST:event_kbpsUploadActionPerformed
private void kbpsBurstUploadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kbpsBurstUploadActionPerformed
kbpsSwitchPerformed(kbpsBurstUpload, uploadBurstField);
}//GEN-LAST:event_kbpsBurstUploadActionPerformed
private void kbpsDownloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kbpsDownloadActionPerformed
kbpsSwitchPerformed(kbpsDownload, downloadField);
}//GEN-LAST:event_kbpsDownloadActionPerformed
private void kbpsBurstDownloadActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_kbpsBurstDownloadActionPerformed
kbpsSwitchPerformed(kbpsBurstDownload, downloadBurstField);
}//GEN-LAST:event_kbpsBurstDownloadActionPerformed
private void monthKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_monthKeyReleased
try {
int uploadMonthValue = Integer.parseInt(uploadMonth.getText());
int downloadMonthValue = Integer.parseInt(downloadMonth.getText());
String upload = "";
String burstUpload = "";
String download = "";
String burstDownload = "";
if(kbpsUpload.getSelectedIndex() == KILOBIT)
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue)*8; //kbit
else
upload = "" + SpeedHelper.calculateSpeed(uploadMonthValue); //kbyte
if(kbpsBurstUpload.getSelectedIndex() == KILOBIT)
burstUpload = "" + SpeedHelper.calculateSpeed(uploadMonthValue)*8; //kbit
else
burstUpload = "" + SpeedHelper.calculateSpeed(uploadMonthValue); //kbyte
if(kbpsDownload.getSelectedIndex() == KILOBIT)
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue)*8; //kbit
else
download = "" + SpeedHelper.calculateSpeed(downloadMonthValue); //kbyte
if(kbpsBurstDownload.getSelectedIndex() == KILOBIT)
burstDownload = "" + SpeedHelper.calculateSpeed(downloadMonthValue)*8; //kbit
else
burstDownload = "" + SpeedHelper.calculateSpeed(downloadMonthValue); //kbyte
initSpeeds(upload, burstUpload, download, burstDownload);
}
catch(NumberFormatException e) {
e.printStackTrace();
return;
}
}//GEN-LAST:event_monthKeyReleased
private void kbpsSwitchPerformed(JComboBox kbps, JTextField speed) {
int index = kbps.getSelectedIndex();
int previous = Integer.parseInt(speed.getText());
if(index == KILOBIT) {
speed.setText("" + previous*8);
}
else {
speed.setText("" + previous/8);
}
}
protected void initSpeeds() {
String up = "" + SpeedHelper.calculateSpeed(
props.getProperty(SpeedSelectorConstants.MAXUPLOADCAPABLE), props.getProperty(SpeedSelectorConstants.USERTYPE));
@ -245,42 +361,79 @@ private void speedFieldKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:eve
props.getProperty(SpeedSelectorConstants.MAXDOWNLOADCAPABLE), props.getProperty(SpeedSelectorConstants.USERTYPE));
String userType = props.getProperty(SpeedSelectorConstants.USERTYPE);
initSpeeds(up, upBurst, down, downBurst);
}
protected void initSpeeds(String up, String upBurst, String down, String downBurst) {
uploadField.setText(up);
uploadBurstField.setText(upBurst);
downloadField.setText(down);
downloadBurstField.setText(downBurst);
initUsage(up, down);
}
protected void saveSpeeds() {
props.setProperty(SpeedSelectorConstants.MAXUPLOAD, uploadField.getText());
props.setProperty(SpeedSelectorConstants.MAXUPLOADBURST, uploadBurstField.getText());
props.setProperty(SpeedSelectorConstants.MAXDOWNLOAD, downloadField.getText());
props.setProperty(SpeedSelectorConstants.MAXDOWNLOADBURST, downloadBurstField.getText());
if(kbpsUpload.getSelectedIndex() == KILOBIT)
props.setProperty(SpeedSelectorConstants.MAXUPLOAD, uploadField.getText());
else
props.setProperty(SpeedSelectorConstants.MAXUPLOAD, "" + Integer.parseInt(uploadField.getText())*8);
if(kbpsBurstUpload.getSelectedIndex() == KILOBIT)
props.setProperty(SpeedSelectorConstants.MAXUPLOADBURST, uploadBurstField.getText());
else
props.setProperty(SpeedSelectorConstants.MAXUPLOADBURST, "" + Integer.parseInt(uploadBurstField.getText())*8);
if(kbpsDownload.getSelectedIndex() == KILOBIT)
props.setProperty(SpeedSelectorConstants.MAXDOWNLOAD, downloadField.getText());
else
props.setProperty(SpeedSelectorConstants.MAXDOWNLOAD, "" + Integer.parseInt(downloadField.getText())*8);
if(kbpsBurstDownload.getSelectedIndex() == KILOBIT)
props.setProperty(SpeedSelectorConstants.MAXDOWNLOADBURST, downloadBurstField.getText());
else
props.setProperty(SpeedSelectorConstants.MAXDOWNLOADBURST, "" + Integer.parseInt(downloadBurstField.getText())*8);
}
protected void initUsage(String upload, String download) {
uploadMonth.setText(SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)/8) + " GB");
downloadMonth.setText(SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)/8) + " GB");
uploadMonth.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(upload)/8));
downloadMonth.setText("" + SpeedHelper.calculateMonthlyUsage(Integer.parseInt(download)/8));
}
protected void initUsage() {
String upload = "";
if(kbpsUpload.getSelectedIndex() == KILOBIT)
upload = uploadField.getText();
else
upload = "" + Integer.parseInt(uploadField.getText())/8;
String download = "";
if(kbpsDownload.getSelectedIndex() == KILOBIT)
download = downloadField.getText();
else
download = "" + Integer.parseInt(downloadField.getText())/8;
initUsage(upload, download);
}
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField downloadBurstField;
private javax.swing.JLabel downloadBurstLabel;
private javax.swing.JTextField downloadField;
private javax.swing.JLabel downloadGB;
private javax.swing.JLabel downloadLabel;
private javax.swing.JLabel downloadMonth;
private javax.swing.JTextField downloadMonth;
private javax.swing.JLabel downloadUsageLabel;
private javax.swing.JLabel explanation;
private javax.swing.JButton finishButton;
private javax.swing.JLabel jLabel1;
private javax.swing.JComboBox kbpsBurstDownload;
private javax.swing.JComboBox kbpsBurstUpload;
private javax.swing.JComboBox kbpsDownload;
private javax.swing.JComboBox kbpsUpload;
private javax.swing.JButton previousButton;
private javax.swing.JLabel settingsInfo;
private javax.swing.JTextField uploadBurstField;
private javax.swing.JLabel uploadBurstLabel;
private javax.swing.JTextField uploadField;
private javax.swing.JLabel uploadGB;
private javax.swing.JLabel uploadLabel;
private javax.swing.JLabel uploadMonth;
private javax.swing.JTextField uploadMonth;
private javax.swing.JLabel uploadUsageLabel;
// End of variables declaration//GEN-END:variables
private static final int KILOBIT = 0;
private static final int KILOBYTE = 1;
}

View File

@ -1,7 +1,6 @@
Form.title=I2P Configuration
Form.title=I2P Speed Configuration
nextButton.text=Next
uploadLabel.text=What is your maximum upload speed?
uploadLabel.text=What is your maximum upload speed?
downloadLabel.text=What is your maximum download speed?
kbps1.text=kbit/second
kbps2.text=kbit/second
speedExplanation.text=Explanation about speeds...

View File

@ -1,6 +1,9 @@
returnButton.text=Previous
Form.title=I2P Configuration
Form.title=I2P Speed Configuration
questionLabel.text=Which of these descriptions fits you best?
browseButton.text=Browsing: I want to use I2P to browse websites anonymously, no heavy usage.
downloadButton.text=Downloading: I want to use I2P for downloads and filesharing, heavy usage.
nextButton.text=Next
browseButton.actionCommand=Browsing
downloadButton.actionCommand=Downloading
jLabel1.text=Text explaining ...

View File

@ -1,16 +1,17 @@
Form.title=I2P Configuration
jLabel1.text=The profile information your entered, indicates that these are your optimal settings:
previousButton.text=Previous
finishButton.text=Finish
uploadLabel.text=Upload Speed:
uploadBurstLabel.text=Burst Upload Speed:
downloadLabel.text=Download Speed:
downloadBurstLabel.text=Burst Download Speed:
uploadUsageLabel.text=Monthy upload usage:
downloadUsageLabel.text=Monthy Download Usage:
uploadUsageLabel.text=GB
downloadUsageLabel.text=GB
uploadField.text=jTextField1
uploadBurstField.text=jTextField2
uploadMonth.text=jLabel8
downloadMonth.text=jLabel9
downloadField.text=jTextField4
downloadBurstField.text=jTextField5
uploadMonth.text=jTextField1
downloadMonth.text=jTextField2
settingsInfo.text=The profile information your entered, indicates that these are your optimal settings:
explanation.text=Text explaining ...

View File

@ -25,4 +25,8 @@ public class SpeedHelper {
public static int calculateMonthlyUsage(int kbytes) {
return (int) ((((long)kbytes)*3600*24*31)/1000000);
}
public static int calculateSpeed(int gigabytes) {
return (int) (((long)gigabytes)*1000000/31/24/3600);
}
}

View File

@ -488,7 +488,7 @@
<echo message="Findbugs output stored in findbugs.xml" />
</target>
<target name="buildWithDesktopgui" depends="buildrouter">
<ant dir="apps/desktopgui" target="jar" />
<ant dir="apps/desktopgui" target="build_jar" />
</target>
<target name="preppkgWithDesktopgui" depends="buildWithDesktopgui,preppkg">
<copy file="apps/desktopgui/dist/desktopgui.jar" todir="pkg-temp/lib/" />
@ -513,6 +513,6 @@
<target name="pkgWithDesktopgui" depends="distclean, updaterWithDesktopgui, installerWithDesktopgui, tarball" />
<target name="distWithDesktopgui" depends="pkgWithDesktopgui, javadoc" />
<target name="distcleanWithDesktopgui" depends="distclean">
<ant dir="apps/desktopgui" target="clean" />
<ant dir="apps/desktopgui" target="build_clean" />
</target>
</project>