Example usage for javax.swing JLabel setAlignmentY

List of usage examples for javax.swing JLabel setAlignmentY

Introduction

In this page you can find the example usage for javax.swing JLabel setAlignmentY.

Prototype

@BeanProperty(description = "The preferred vertical alignment of the component.")
public void setAlignmentY(float alignmentY) 

Source Link

Document

Sets the vertical alignment.

Usage

From source file:Main.java

public static void main(String[] args) {
    final JTextPane pane = new JTextPane();
    pane.setText("Some text");

    JButton buttonButton = new JButton("Insert label");
    buttonButton.addActionListener(e -> {
        JLabel label = new JLabel("label");
        label.setAlignmentY(0.85f);
        pane.insertComponent(label);/*from   w  ww. j  av a  2  s.  c o m*/

    });

    JPanel panel = new JPanel(new BorderLayout());
    panel.add(buttonButton, BorderLayout.SOUTH);
    panel.add(pane, BorderLayout.CENTER);

    JFrame frame = new JFrame();
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.add(panel);
    frame.setSize(400, 200);
    frame.setVisible(true);
}

From source file:tn.mariages.gui.Accueil.java

private void formWindowOpened(java.awt.event.WindowEvent evt) {//GEN-FIRST:event_formWindowOpened
    int h = Toolkit.getDefaultToolkit().getScreenSize().height;
    int w = Toolkit.getDefaultToolkit().getScreenSize().width;

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

    this.setLocation(-27, -16);
    this.setSize(144, h + 16);
    this.setExtendedState(this.MAXIMIZED_VERT);

    System.out.println("H " + h);

    JFrame LogoFrame = new JFrame("Logo");
    LogoFrame.setSize(w - 45, h + 16);//from ww  w . j a  v  a2s . c o m
    LogoFrame.setExtendedState(this.MAXIMIZED_HORIZ);
    this.setAlwaysOnTop(true);
    //LogoFrame.setExtendedState(LogoFrame.MAXIMIZED_BOTH);
    LogoFrame.setLocation(65, -16);
    JPanel logoPanel = new JPanel();
    LogoFrame.add(logoPanel);

    ImageIcon icon;
    try {
        icon = new ImageIcon(new URL("http://www.images.tn/upload/original/1394208853.png")); /// TO CHANGE
        icon = new ImageIcon(icon.getImage().getScaledInstance(400, 400, BufferedImage.SCALE_SMOOTH));
        JLabel logoLabel = new JLabel(icon);

        logoPanel.add(logoLabel);
        logoLabel.setAlignmentX(CENTER_ALIGNMENT);
        logoLabel.setAlignmentY(400);
    } catch (MalformedURLException ex) {
        Logger.getLogger(ListeFeatProd.class.getName()).log(Level.SEVERE, null, ex);
    }
    LogoFrame.setVisible(true);
    // TODO add your handling code here:
}

From source file:au.org.ala.delta.editor.ui.ImageDetailsPanel.java

private void createUI() {
    JPanel panel = new JPanel();

    JPanel buttonPanel = new JPanel();

    JPanel panel_2 = new JPanel();
    GroupLayout groupLayout = new GroupLayout(this);
    groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(Alignment.LEADING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addComponent(panel, GroupLayout.PREFERRED_SIZE, 262, GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(buttonPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_2, GroupLayout.PREFERRED_SIZE, 265, Short.MAX_VALUE)
                    .addContainerGap()));
    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(Alignment.TRAILING)
            .addGroup(groupLayout.createSequentialGroup().addContainerGap()
                    .addGroup(groupLayout.createParallelGroup(Alignment.LEADING)
                            .addComponent(panel, GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
                            .addComponent(buttonPanel, 0, 0, Short.MAX_VALUE)
                            .addComponent(panel_2, 0, 0, Short.MAX_VALUE))
                    .addContainerGap()));

    btnSettings = new JButton();
    btnDisplay = new JButton();
    btnAdd = new JButton();
    btnDelete = new JButton();

    GroupLayout gl_buttonPanel = new GroupLayout(buttonPanel);
    gl_buttonPanel.setHorizontalGroup(gl_buttonPanel.createParallelGroup(Alignment.TRAILING).addGroup(
            Alignment.LEADING,//from   ww  w  .ja v a 2 s.c o  m
            gl_buttonPanel.createSequentialGroup().addContainerGap().addGroup(gl_buttonPanel
                    .createParallelGroup(Alignment.LEADING)
                    .addComponent(btnSettings, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                            Short.MAX_VALUE)
                    .addComponent(btnDisplay, Alignment.TRAILING, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                    .addComponent(btnAdd, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE)
                    .addComponent(btnDelete, GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_buttonPanel.setVerticalGroup(gl_buttonPanel.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_buttonPanel.createSequentialGroup().addContainerGap(119, Short.MAX_VALUE)
                    .addComponent(btnSettings).addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(btnDisplay).addPreferredGap(ComponentPlacement.RELATED).addComponent(btnAdd)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnDelete).addContainerGap()));
    buttonPanel.setLayout(gl_buttonPanel);

    JLabel lblSubjectText = new JLabel();
    lblSubjectText.setName("imageDetailsSubjectLabel");

    JScrollPane scrollPane_1 = new JScrollPane();

    JLabel lblDevelopersNotes = new JLabel();
    lblDevelopersNotes.setName("imageDetailsDevelopersNotesLabel");

    JScrollPane scrollPane_2 = new JScrollPane();

    JPanel panel_3 = new JPanel();

    String title = _resources.getString("imageDetailsSoundTitle");

    panel_3.setBorder(new TitledBorder(null, title, TitledBorder.LEADING, TitledBorder.TOP, null, null));

    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_2.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
                            .addComponent(scrollPane_2, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                            .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                            .addComponent(lblDevelopersNotes)
                            .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 245, Short.MAX_VALUE)
                            .addComponent(lblSubjectText))
                    .addContainerGap()));
    gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_2.createSequentialGroup().addContainerGap().addComponent(lblSubjectText)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(scrollPane_1, GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblDevelopersNotes)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(scrollPane_2, GroupLayout.DEFAULT_SIZE, 54, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 66, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));

    developerNotesTextPane = new RtfEditorPane();
    scrollPane_2.setViewportView(developerNotesTextPane);

    subjectTextPane = new RtfEditorPane();
    scrollPane_1.setViewportView(subjectTextPane);

    soundComboBox = new JComboBox();
    soundComboBox.setRenderer(new DefaultListCellRenderer() {
        private static final long serialVersionUID = 1L;

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            String text = "";
            ImageOverlay overlay = (ImageOverlay) value;
            if (overlay != null) {
                text = overlay.overlayText;
            }
            super.getListCellRendererComponent(list, text, index, isSelected, cellHasFocus);
            return this;
        }
    });

    deleteSoundButton = new JButton();

    playSoundButton = new JButton();

    insertSoundButton = new JButton();
    GroupLayout gl_panel_3 = new GroupLayout(panel_3);
    gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_3.createSequentialGroup().addComponent(soundComboBox, 0, 0, Short.MAX_VALUE)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(deleteSoundButton)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(playSoundButton)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(insertSoundButton)
                    .addContainerGap()));
    gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_3.createSequentialGroup().addContainerGap(5, Short.MAX_VALUE)
                    .addGroup(gl_panel_3.createParallelGroup(Alignment.BASELINE)
                            .addComponent(soundComboBox, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(deleteSoundButton).addComponent(playSoundButton)
                            .addComponent(insertSoundButton))));
    panel_3.setLayout(gl_panel_3);

    panel_2.setLayout(gl_panel_2);

    JLabel lblImageFiles = new JLabel();
    lblImageFiles.setName("imageDetailsImageFilesLabel");
    lblImageFiles.setAlignmentY(Component.TOP_ALIGNMENT);

    JScrollPane scrollPane = new JScrollPane();
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup()
                    .addGroup(gl_panel.createParallelGroup(Alignment.LEADING).addComponent(lblImageFiles)
                            .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 262, Short.MAX_VALUE))
                    .addContainerGap()));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(lblImageFiles)
                    .addPreferredGap(ComponentPlacement.RELATED)
                    .addComponent(scrollPane, GroupLayout.DEFAULT_SIZE, 236, Short.MAX_VALUE)
                    .addContainerGap()));

    imageList = new ImageList();

    scrollPane.setViewportView(imageList);
    panel.setLayout(gl_panel);
    setLayout(groupLayout);
}

From source file:Installer.java

public Installer(File targetDir) {
    ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
    this.setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));

    JPanel logoSplash = new JPanel();
    logoSplash.setLayout(new BoxLayout(logoSplash, BoxLayout.Y_AXIS));
    try {// w w w .j av  a2  s  .c  om
        // Read png
        BufferedImage image;
        image = ImageIO.read(Installer.class.getResourceAsStream("logo.png"));
        ImageIcon icon = new ImageIcon(image);
        JLabel logoLabel = new JLabel(icon);
        logoLabel.setAlignmentX(CENTER_ALIGNMENT);
        logoLabel.setAlignmentY(CENTER_ALIGNMENT);
        logoLabel.setSize(image.getWidth(), image.getHeight());
        if (!QUIET_DEV) // VIVE - hide oculus logo
            logoSplash.add(logoLabel);
    } catch (IOException e) {
    } catch (IllegalArgumentException e) {
    }

    userHomeDir = System.getProperty("user.home", ".");
    osType = System.getProperty("os.name").toLowerCase();
    if (osType.contains("win")) {
        isWindows = true;
        appDataDir = System.getenv("APPDATA");
    }

    version = "UNKNOWN";
    try {
        InputStream ver = Installer.class.getResourceAsStream("version");
        if (ver != null) {
            String[] tok = new BufferedReader(new InputStreamReader(ver)).readLine().split(":");
            if (tok.length > 0) {
                jar_id = tok[0];
                version = tok[1];
            }
        }
    } catch (IOException e) {
    }

    // Read release notes, save to file
    String tmpFileName = System.getProperty("java.io.tmpdir") + releaseNotePathAddition + "Vivecraft"
            + version.toLowerCase() + "_release_notes.txt";
    releaseNotes = new File(tmpFileName);
    InputStream is = Installer.class.getResourceAsStream("release_notes.txt");
    if (!copyInputStreamToFile(is, releaseNotes)) {
        releaseNotes = null;
    }

    JLabel tag = new JLabel("Welcome! This will install Vivecraft " + version);
    tag.setAlignmentX(CENTER_ALIGNMENT);
    tag.setAlignmentY(CENTER_ALIGNMENT);
    logoSplash.add(tag);

    logoSplash.add(Box.createRigidArea(new Dimension(5, 20)));
    tag = new JLabel("Select path to minecraft. (The default here is almost always what you want.)");
    tag.setAlignmentX(CENTER_ALIGNMENT);
    tag.setAlignmentY(CENTER_ALIGNMENT);
    logoSplash.add(tag);

    logoSplash.setAlignmentX(CENTER_ALIGNMENT);
    logoSplash.setAlignmentY(TOP_ALIGNMENT);
    this.add(logoSplash);

    JPanel entryPanel = new JPanel();
    entryPanel.setLayout(new BoxLayout(entryPanel, BoxLayout.X_AXIS));

    Installer.targetDir = targetDir;
    selectedDirText = new JTextField();
    selectedDirText.setEditable(false);
    selectedDirText.setToolTipText("Path to minecraft");
    selectedDirText.setColumns(30);
    entryPanel.add(selectedDirText);
    JButton dirSelect = new JButton();
    dirSelect.setAction(new FileSelectAction());
    dirSelect.setText("...");
    dirSelect.setToolTipText("Select an alternative minecraft directory");
    entryPanel.add(dirSelect);

    entryPanel.setAlignmentX(LEFT_ALIGNMENT);
    entryPanel.setAlignmentY(TOP_ALIGNMENT);
    infoLabel = new JLabel();
    infoLabel.setHorizontalTextPosition(JLabel.LEFT);
    infoLabel.setVerticalTextPosition(JLabel.TOP);
    infoLabel.setAlignmentX(LEFT_ALIGNMENT);
    infoLabel.setAlignmentY(TOP_ALIGNMENT);
    infoLabel.setVisible(false);

    fileEntryPanel = new JPanel();
    fileEntryPanel.setLayout(new BoxLayout(fileEntryPanel, BoxLayout.Y_AXIS));
    fileEntryPanel.add(infoLabel);
    fileEntryPanel.add(entryPanel);

    fileEntryPanel.setAlignmentX(CENTER_ALIGNMENT);
    fileEntryPanel.setAlignmentY(TOP_ALIGNMENT);
    this.add(fileEntryPanel);
    this.add(Box.createVerticalStrut(5));

    JPanel optPanel = new JPanel();
    optPanel.setLayout(new BoxLayout(optPanel, BoxLayout.Y_AXIS));
    optPanel.setAlignmentX(LEFT_ALIGNMENT);
    optPanel.setAlignmentY(TOP_ALIGNMENT);

    //Add forge options
    JPanel forgePanel = new JPanel();
    forgePanel.setLayout(new BoxLayout(forgePanel, BoxLayout.X_AXIS));
    //Create forge: no/yes buttons
    useForge = new JCheckBox();
    AbstractAction actf = new updateActionF();
    actf.putValue(AbstractAction.NAME, "Install Vivecraft with Forge " + FORGE_VERSION);
    useForge.setAction(actf);
    forgeVersion = new JComboBox();
    if (!ALLOW_FORGE_INSTALL)
        useForge.setEnabled(false);
    useForge.setToolTipText(
            "<html>" + "If checked, installs Vivecraft with Forge support. The correct version of Forge<br>"
                    + "(as displayed) must already be installed.<br>" + "</html>");

    //Add "yes" and "which version" to the forgePanel
    useForge.setAlignmentX(LEFT_ALIGNMENT);
    forgeVersion.setAlignmentX(LEFT_ALIGNMENT);
    forgePanel.add(useForge);
    //forgePanel.add(forgeVersion);

    // Profile creation / update support
    createProfile = new JCheckBox("", true);
    AbstractAction actp = new updateActionP();
    actp.putValue(AbstractAction.NAME, "Create Vivecraft launcher profile");
    createProfile.setAction(actp);
    createProfile.setAlignmentX(LEFT_ALIGNMENT);
    createProfile.setSelected(true);
    createProfile.setToolTipText("<html>"
            + "If checked, if a Vivecraft profile doesn't already exist within the Minecraft launcher<br>"
            + "one is added. Then the profile is selected, and this Vivecraft version is set as the<br>"
            + "current version.<br>" + "</html>");

    useShadersMod = new JCheckBox();
    useShadersMod.setAlignmentX(LEFT_ALIGNMENT);
    if (!ALLOW_SHADERSMOD_INSTALL)
        useShadersMod.setEnabled(false);
    AbstractAction acts = new updateActionSM();
    acts.putValue(AbstractAction.NAME, "Install Vivecraft with ShadersMod 2.3.29");
    useShadersMod.setAction(acts);
    useShadersMod.setToolTipText("<html>" + "If checked, sets the vivecraft profile to use ShadersMod <br>"
            + "support." + "</html>");

    useHydra = new JCheckBox("Razer Hydra support", false);
    useHydra.setAlignmentX(LEFT_ALIGNMENT);
    if (!ALLOW_HYDRA_INSTALL)
        useHydra.setEnabled(false);
    useHydra.setToolTipText("<html>"
            + "If checked, installs the additional Razor Hydra native library required for Razor Hydra<br>"
            + "support." + "</html>");

    useHrtf = new JCheckBox("Enable binaural audio (Only needed once per PC)", false);
    useHrtf.setToolTipText("<html>"
            + "If checked, the installer will create the configuration file needed for OpenAL HRTF<br>"
            + "ear-aware sound in Minecraft (and other games).<br>"
            + " If the file has previously been created, you do not need to check this again.<br>"
            + " NOTE: Your sound card's output MUST be set to 44.1Khz.<br>" + " WARNING, will overwrite "
            + (isWindows ? (appDataDir + "\\alsoft.ini") : (userHomeDir + "/.alsoftrc")) + "!<br>"
            + " Delete the " + (isWindows ? "alsoft.ini" : "alsoftrc") + " file to disable HRTF again."
            + "</html>");
    useHrtf.setAlignmentX(LEFT_ALIGNMENT);

    //Add option panels option panel
    forgePanel.setAlignmentX(LEFT_ALIGNMENT);

    //optPanel.add(forgePanel);
    //optPanel.add(useShadersMod);
    optPanel.add(createProfile);
    optPanel.add(useHrtf);
    this.add(optPanel);

    this.add(Box.createRigidArea(new Dimension(5, 20)));

    instructions = new JLabel("", SwingConstants.CENTER);
    instructions.setAlignmentX(CENTER_ALIGNMENT);
    instructions.setAlignmentY(TOP_ALIGNMENT);
    instructions.setForeground(Color.RED);
    instructions.setPreferredSize(new Dimension(20, 40));
    this.add(instructions);

    this.add(Box.createVerticalGlue());
    JLabel github = linkify("Vivecraft is open source. find it on Github",
            "https://github.com/jrbudda/Vivecraft_111", "Vivecraft 1.11 Github");
    JLabel wiki = linkify("Vivecraft home page", "http://www.vivecraft.org", "Vivecraft Home");
    JLabel donate = linkify("If you think Vivecraft is awesome, please consider donating.",
            "https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JVBJLN5HJJS52&lc=US&item_name=jrbudda&currency_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG%2egif%3aNonHosted)",
            "jrbudda's Paypal");
    JLabel optifine = linkify("Vivecraft includes OptiFine for performance. Consider donating to them as well.",
            "http://optifine.net/donate.php", "http://optifine.net/donate.php");

    github.setAlignmentX(CENTER_ALIGNMENT);
    github.setHorizontalAlignment(SwingConstants.CENTER);
    wiki.setAlignmentX(CENTER_ALIGNMENT);
    wiki.setHorizontalAlignment(SwingConstants.CENTER);
    donate.setAlignmentX(CENTER_ALIGNMENT);
    donate.setHorizontalAlignment(SwingConstants.CENTER);
    optifine.setAlignmentX(CENTER_ALIGNMENT);
    optifine.setHorizontalAlignment(SwingConstants.CENTER);

    this.add(Box.createRigidArea(new Dimension(5, 20)));
    this.add(github);
    this.add(wiki);
    this.add(donate);
    this.add(optifine);

    this.setAlignmentX(LEFT_ALIGNMENT);
    updateFilePath();
    updateInstructions();
}

From source file:Tcpbw100.java

public void testResults(String tmpstr) {
    StringTokenizer tokens;/*from w  w  w . j  av a2 s  .co m*/
    int i = 0;
    String sysvar, strval;
    int sysval, Zero = 0, bwdelay, minwin;
    double sysval2, j;
    String osName, osArch, osVer, javaVer, javaVendor, client;

    tokens = new StringTokenizer(tmpstr);
    sysvar = null;
    strval = null;
    while (tokens.hasMoreTokens()) {
        if (++i % 2 == 1) {
            sysvar = tokens.nextToken();
        } else {
            strval = tokens.nextToken();
            diagnosis.append(sysvar + " " + strval + "\n");
            //we load all the key value pairs to the report, too
            //may come in handy in the future
            //TODO: strip the trailing ':' from sysvar
            report.put("web100_" + sysvar.replaceAll(":$", ""), strval);
            emailText += sysvar + " " + strval + "\n%0A";
            if (strval.indexOf(".") == -1) {
                sysval = Integer.parseInt(strval);
                save_int_values(sysvar, sysval);
            } else {
                sysval2 = Double.valueOf(strval).doubleValue();
                save_dbl_values(sysvar, sysval2);
            }
        }
    }

    // Grab some client details from the applet environment
    osName = System.getProperty("os.name");
    pub_osName = osName;

    osArch = System.getProperty("os.arch");
    pub_osArch = osArch;

    osVer = System.getProperty("os.version");
    pub_osVer = osVer;

    javaVer = System.getProperty("java.version");
    pub_javaVer = javaVer;

    javaVendor = System.getProperty("java.vendor");

    if (osArch.startsWith("x86") == true) {
        client = messages.getString("pc");
    } else {
        client = messages.getString("workstation");
    }

    // Calculate some variables and determine path conditions
    // Note: calculations now done in server and the results are shipped
    //    back to the client for printing.

    if (CountRTT > 0) {
        // Now write some messages to the screen
        if (c2sData < 3) {
            if (c2sData < 0) {
                results.append(messages.getString("unableToDetectBottleneck") + "\n");
                emailText += "Server unable to determine bottleneck link type.\n%0A";
                pub_AccessTech = "Connection type unknown";

            } else {
                results.append(messages.getString("your") + " " + client + " "
                        + messages.getString("connectedTo") + " ");
                emailText += messages.getString("your") + " " + client + " " + messages.getString("connectedTo")
                        + " ";
                if (c2sData == 1) {
                    results.append(messages.getString("dialup") + "\n");
                    emailText += messages.getString("dialup") + "\n%0A";
                    mylink = .064;
                    pub_AccessTech = "Dial-up Modem";
                } else {
                    results.append(messages.getString("cabledsl") + "\n");
                    emailText += messages.getString("cabledsl") + "\n%0A";
                    mylink = 3;
                    pub_AccessTech = "Cable/DSL modem";
                }
            }
        } else {
            results.append(messages.getString("theSlowestLink") + " ");
            emailText += messages.getString("theSlowestLink") + " ";
            if (c2sData == 3) {
                results.append(messages.getString("10mbps") + "\n");
                emailText += messages.getString("10mbps") + "\n%0A";
                mylink = 10;
                pub_AccessTech = "10 Mbps Ethernet";
            } else if (c2sData == 4) {
                results.append(messages.getString("45mbps") + "\n");
                emailText += messages.getString("45mbps") + "\n%0A";
                mylink = 45;
                pub_AccessTech = "45 Mbps T3/DS3 subnet";
            } else if (c2sData == 5) {
                results.append("100 Mbps ");
                emailText += "100 Mbps ";
                mylink = 100;
                pub_AccessTech = "100 Mbps Ethernet";

                if (half_duplex == 0) {
                    results.append(messages.getString("fullDuplex") + "\n");
                    emailText += messages.getString("fullDuplex") + "\n%0A";
                } else {
                    results.append(messages.getString("halfDuplex") + "\n");
                    emailText += messages.getString("halfDuplex") + "\n%0A";
                }
            } else if (c2sData == 6) {
                results.append(messages.getString("622mbps") + "\n");
                emailText += messages.getString("622mbps") + "\n%0A";
                mylink = 622;
                pub_AccessTech = "622 Mbps OC-12";
            } else if (c2sData == 7) {
                results.append(messages.getString("1gbps") + "\n");
                emailText += messages.getString("1gbps") + "\n%0A";
                mylink = 1000;
                pub_AccessTech = "1.0 Gbps Gigabit Ethernet";
            } else if (c2sData == 8) {
                results.append(messages.getString("2.4gbps") + "\n");
                emailText += messages.getString("2.4gbps") + "\n%0A";
                mylink = 2400;
                pub_AccessTech = "2.4 Gbps OC-48";
            } else if (c2sData == 9) {
                results.append(messages.getString("10gbps") + "\n");
                emailText += messages.getString("10gbps") + "\n%0A";
                mylink = 10000;
                pub_AccessTech = "10 Gigabit Ethernet/OC-192";

            }
        }

        if (mismatch == 1) {
            results.append(messages.getString("oldDuplexMismatch") + "\n");
            emailText += messages.getString("oldDuplexMismatch") + "\n%0A";
        } else if (mismatch == 2) {
            results.append(messages.getString("duplexFullHalf") + "\n");
            emailText += messages.getString("duplexFullHalf") + "\n%0A";
        } else if (mismatch == 4) {
            results.append(messages.getString("possibleDuplexFullHalf") + "\n");
            emailText += messages.getString("possibleDuplexFullHalf") + "\n%0A";
        } else if (mismatch == 3) {
            results.append(messages.getString("duplexHalfFull") + "\n");
            emailText += messages.getString("duplexHalfFull") + "\n%0A";
        } else if (mismatch == 5) {
            results.append(messages.getString("possibleDuplexHalfFull") + "\n");
            emailText += messages.getString("possibleDuplexHalfFull") + "\n%0A";
        } else if (mismatch == 7) {
            results.append(messages.getString("possibleDuplexHalfFullWarning") + "\n");
            emailText += messages.getString("possibleDuplexHalfFullWarning") + "\n%0A";
        }

        if (mismatch == 0) {
            if (bad_cable == 1) {
                results.append(messages.getString("excessiveErrors ") + "\n");
                emailText += messages.getString("excessiveErrors") + "\n%0A";
            }
            if (congestion == 1) {
                results.append(messages.getString("otherTraffic") + "\n");
                emailText += messages.getString("otherTraffic") + "\n%0A";
            }
            if (((2 * rwin) / rttsec) < mylink) {
                j = (float) ((mylink * avgrtt) * 1000) / 8 / 1024;
                if (j > (float) MaxRwinRcvd) {
                    results.append(messages.getString("receiveBufferShouldBe") + " " + prtdbl(j)
                            + messages.getString("toMaximizeThroughput") + " \n");
                    emailText += messages.getString("receiveBufferShouldBe") + " " + prtdbl(j)
                            + messages.getString("toMaximizeThroughput") + "\n%0A";
                }
            }
        }

        if ((tests & TEST_C2S) == TEST_C2S) {
            if (sc2sspd < (c2sspd * (1.0 - VIEW_DIFF))) {
                // TODO:  distinguish the host buffering from the middleboxes buffering
                JLabel info = new JLabel(messages.getString("information"));
                info.addMouseListener(new MouseAdapter() {

                    public void mouseClicked(MouseEvent e) {
                        showBufferedBytesInfo();
                    }

                });
                info.setForeground(Color.BLUE);
                info.setCursor(new Cursor(Cursor.HAND_CURSOR));
                info.setAlignmentY((float) 0.8);
                results.insertComponent(info);
                results.append(messages.getString("c2sPacketQueuingDetected") + "\n");
            }
        }

        if ((tests & TEST_S2C) == TEST_S2C) {
            if (s2cspd < (ss2cspd * (1.0 - VIEW_DIFF))) {
                // TODO:  distinguish the host buffering from the middleboxes buffering
                JLabel info = new JLabel(messages.getString("information"));
                info.addMouseListener(new MouseAdapter() {

                    public void mouseClicked(MouseEvent e) {
                        showBufferedBytesInfo();
                    }

                });
                info.setForeground(Color.BLUE);
                info.setCursor(new Cursor(Cursor.HAND_CURSOR));
                info.setAlignmentY((float) 0.8);
                results.insertComponent(info);
                results.append(messages.getString("s2cPacketQueuingDetected") + "\n");
            }
        }

        statistics.append("\n\t------  " + messages.getString("clientInfo") + "------\n");
        statistics.append(messages.getString("osData") + " " + messages.getString("name") + " = " + osName
                + ", " + messages.getString("architecture") + " = " + osArch);
        statistics.append(", " + messages.getString("version") + " = " + osVer + "\n");
        statistics.append(messages.getString("javaData") + ": " + messages.getString("vendor") + " = "
                + javaVendor + ", " + messages.getString("version") + " = " + javaVer + "\n");

        report.put("os_name", osName);
        report.put("os_architecture", osArch);
        report.put("os_version", osVer);
        statistics.append("Java data: Vendor = " + javaVendor + ", Version = " + javaVer + "\n");
        report.put("java_vendor", javaVendor);
        report.put("java_version", javaVer);

        // statistics.append(" java.class.version=" + System.getProperty("java.class.version") + "\n");

        statistics.append("\n\t------  " + messages.getString("web100Details") + "  ------\n");
        if (c2sData == -2)
            statistics.append(messages.getString("insufficient") + "\n");
        else if (c2sData == -1)
            statistics.append(messages.getString("ipcFail") + "\n");
        else if (c2sData == 0)
            statistics.append(messages.getString("rttFail") + "\n");
        else if (c2sData == 1)
            statistics.append(messages.getString("foundDialup") + "\n");
        else if (c2sData == 2)
            statistics.append(messages.getString("foundDsl") + "\n");
        else if (c2sData == 3)
            statistics.append(messages.getString("found10mbps") + "\n");
        else if (c2sData == 4)
            statistics.append(messages.getString("found45mbps") + "\n");
        else if (c2sData == 5)
            statistics.append(messages.getString("found100mbps") + "\n");
        else if (c2sData == 6)
            statistics.append(messages.getString("found622mbps") + "\n");
        else if (c2sData == 7)
            statistics.append(messages.getString("found1gbps") + "\n");
        else if (c2sData == 8)
            statistics.append(messages.getString("found2.4gbps") + "\n");
        else if (c2sData == 9)
            statistics.append(messages.getString("found10gbps") + "\n");

        if (half_duplex == 0)
            statistics.append(messages.getString("linkFullDpx") + "\n");
        else
            statistics.append(messages.getString("linkHalfDpx") + "\n");

        if (congestion == 0)
            statistics.append(messages.getString("congestNo") + "\n");
        else
            statistics.append(messages.getString("congestYes") + "\n");

        if (bad_cable == 0)
            statistics.append(messages.getString("cablesOk") + "\n");
        else
            statistics.append(messages.getString("cablesNok") + "\n");

        if (mismatch == 0)
            statistics.append(messages.getString("duplexOk") + "\n");
        else if (mismatch == 1) {
            statistics.append(messages.getString("duplexNok") + " ");
            emailText += messages.getString("duplexNok") + " ";
        } else if (mismatch == 2) {
            statistics.append(messages.getString("duplexFullHalf") + "\n");
            emailText += messages.getString("duplexFullHalf") + "\n%0A ";
        } else if (mismatch == 3) {
            statistics.append(messages.getString("duplexHalfFull") + "\n");
            emailText += messages.getString("duplexHalfFull") + "\n%0A ";
        }

        statistics.append("\n" + messages.getString("web100rtt") + " =  " + prtdbl(avgrtt) + " " + "ms" + "; ");
        emailText += "\n%0A" + messages.getString("web100rtt") + " = " + prtdbl(avgrtt) + " " + "ms" + "; ";

        statistics.append(messages.getString("packetsize") + " = " + CurrentMSS + " "
                + messages.getString("bytes") + "; " + messages.getString("and") + " \n");
        emailText += messages.getString("packetsize") + " = " + CurrentMSS + " " + messages.getString("bytes")
                + "; " + messages.getString("and") + " \n%0A";

        report.put("rtt", prtdbl(avgrtt));
        rttLbl.setText(prtdbl(avgrtt));
        rttLbl.setText(String.format(padding + "%.0f msec", avgrtt));
        report.put("mss", Integer.toString(CurrentMSS));
        report.put("retransmissions", Integer.toString(PktsRetrans));
        report.put("sack_blocks", Integer.toString(SACKsRcvd));
        report.put("duplicate_acks", Integer.toString(DupAcksIn));
        report.put("timeouts", Integer.toString(Timeouts));
        report.put("wait_seconds", Double.toString(waitsec));
        report.put("out_of_order", Double.toString(order));
        report.put("loss", Double.toString(loss));
        report.put("jitter", get_jitter());
        lossLbl.setText(String.format(padding + "%.0f %%", loss * 100));
        jitterLbl.setText(padding + get_jitter() + " msec");

        if (PktsRetrans > 0) {
            statistics.append(PktsRetrans + " " + messages.getString("pktsRetrans"));
            statistics.append(", " + DupAcksIn + " " + messages.getString("dupAcksIn"));
            statistics.append(", " + messages.getString("and") + " " + SACKsRcvd + " "
                    + messages.getString("sackReceived") + "\n");
            emailText += PktsRetrans + " " + messages.getString("pktsRetrans");
            emailText += ", " + DupAcksIn + " " + messages.getString("dupAcksIn");
            emailText += ", " + messages.getString("and") + " " + SACKsRcvd + " "
                    + messages.getString("sackReceived") + "\n%0A";
            if (Timeouts > 0) {
                statistics.append(messages.getString("connStalled") + " " + Timeouts + " "
                        + messages.getString("timesPktLoss") + "\n");
            }

            statistics.append(messages.getString("connIdle") + " " + prtdbl(waitsec) + " "
                    + messages.getString("seconds") + " (" + prtdbl((waitsec / timesec) * 100)
                    + messages.getString("pctOfTime") + ")\n");
            emailText += messages.getString("connStalled") + " " + Timeouts + " "
                    + messages.getString("timesPktLoss") + "\n%0A";
            emailText += messages.getString("connIdle") + " " + prtdbl(waitsec) + " "
                    + messages.getString("seconds") + " (" + prtdbl((waitsec / timesec) * 100)
                    + messages.getString("pctOfTime") + ")\n%0A";
        } else if (DupAcksIn > 0) {
            statistics.append(messages.getString("noPktLoss1") + " - ");
            statistics.append(messages.getString("ooOrder") + " " + prtdbl(order * 100)
                    + messages.getString("pctOfTime") + "\n");
            emailText += messages.getString("noPktLoss1") + " - ";
            emailText += messages.getString("ooOrder") + " " + prtdbl(order * 100)
                    + messages.getString("pctOfTime") + "\n%0A";
        } else {
            statistics.append(messages.getString("noPktLoss2") + ".\n");
            emailText += messages.getString("noPktLoss2") + ".\n%0A";
        }

        if ((tests & TEST_C2S) == TEST_C2S) {
            if (c2sspd > sc2sspd) {
                if (sc2sspd < (c2sspd * (1.0 - VIEW_DIFF))) {
                    statistics.append(messages.getString("c2s") + " " + messages.getString("qSeen") + ": "
                            + prtdbl(100 * (c2sspd - sc2sspd) / c2sspd) + "%\n");
                } else {
                    statistics.append(messages.getString("c2s") + " " + messages.getString("qSeen") + ": "
                            + prtdbl(100 * (c2sspd - sc2sspd) / c2sspd) + "%\n");
                }
            }
        }

        if ((tests & TEST_S2C) == TEST_S2C) {
            if (ss2cspd > s2cspd) {
                if (s2cspd < (ss2cspd * (1.0 - VIEW_DIFF))) {
                    statistics.append(messages.getString("s2c") + " " + messages.getString("qSeen") + ": "
                            + prtdbl(100 * (ss2cspd - s2cspd) / ss2cspd) + "%\n");
                } else {
                    statistics.append(messages.getString("s2c") + " " + messages.getString("qSeen") + ": "
                            + prtdbl(100 * (ss2cspd - s2cspd) / ss2cspd) + "%\n");
                }
            }
        }

        if (rwintime > .015) {
            statistics.append(messages.getString("thisConnIs") + " " + messages.getString("limitRx") + " "
                    + prtdbl(rwintime * 100) + messages.getString("pctOfTime") + ".\n");
            emailText += messages.getString("thisConnIs") + " " + messages.getString("limitRx") + " "
                    + prtdbl(rwintime * 100) + messages.getString("pctOfTime") + ".\n%0A";
            pub_pctRcvrLimited = rwintime * 100;

            // I think there is a bug here, it sometimes tells you to increase the buffer
            // size, but the new size is smaller than the current.

            if (((2 * rwin) / rttsec) < mylink) {
                statistics.append("  " + messages.getString("incrRxBuf") + " (" + prtdbl(MaxRwinRcvd / 1024)
                        + " KB) " + messages.getString("willImprove") + "\n");
            }
        }
        if (sendtime > .015) {
            statistics.append(messages.getString("thisConnIs") + " " + messages.getString("limitTx") + " "
                    + prtdbl(sendtime * 100) + messages.getString("pctOfTime") + ".\n");
            emailText += messages.getString("thisConnIs") + " " + messages.getString("limitTx") + " "
                    + prtdbl(sendtime * 100) + messages.getString("pctOfTime") + ".\n%0A";
            if ((2 * (swin / rttsec)) < mylink) {
                statistics.append("  " + messages.getString("incrTxBuf") + " (" + prtdbl(Sndbuf / 2048)
                        + " KB) " + messages.getString("willImprove") + "\n");
            }
        }
        if (cwndtime > .005) {
            statistics.append(messages.getString("thisConnIs") + " " + messages.getString("limitNet") + " "
                    + prtdbl(cwndtime * 100) + messages.getString("pctOfTime") + ".\n");
            emailText += messages.getString("thisConnIs") + " " + messages.getString("limitNet") + " "
                    + prtdbl(cwndtime * 100) + messages.getString("pctOfTime") + ".\n%0A";
            // if (cwndtime > .15)
            //   statistics.append("  Contact your local network administrator to report a network problem\n");
            // if (order > .15)
            //   statistics.append("  Contact your local network admin and report excessive packet reordering\n");
        }
        if ((spd < 4) && (loss > .01)) {
            statistics.append(messages.getString("excLoss") + "\n");
        }

        statistics.append("\n" + messages.getString("web100tcpOpts") + " \n");
        statistics.append("RFC 2018 Selective Acknowledgment: ");
        if (SACKEnabled == Zero)
            statistics.append(messages.getString("off") + "\n");
        else
            statistics.append(messages.getString("on") + "\n");

        statistics.append("RFC 896 Nagle Algorithm: ");
        if (NagleEnabled == Zero)
            statistics.append(messages.getString("off") + "\n");
        else
            statistics.append(messages.getString("on") + "\n");

        statistics.append("RFC 3168 Explicit Congestion Notification: ");
        if (ECNEnabled == Zero)
            statistics.append(messages.getString("off") + "\n");
        else
            statistics.append(messages.getString("on") + "\n");

        statistics.append("RFC 1323 Time Stamping: ");
        if (TimestampsEnabled == 0)
            statistics.append(messages.getString("off") + "\n");
        else
            statistics.append(messages.getString("on") + "\n");

        statistics.append("RFC 1323 Window Scaling: ");
        if (MaxRwinRcvd < 65535)
            WinScaleRcvd = 0;
        if ((WinScaleRcvd == 0) || (WinScaleRcvd > 20)) {
            statistics.append(messages.getString("off") + "\n");
            report.put("window_scaling", "0");
        } else {
            statistics.append(messages.getString("on") + "; " + messages.getString("scalingFactors") + " -  "
                    + messages.getString("server") + "=" + WinScaleRcvd + ", " + messages.getString("client")
                    + "=" + WinScaleSent + "\n");
            report.put("window_scaling", "1");
        }
        statistics.append("\n");

        if ((tests & TEST_SFW) == TEST_SFW) {
            switch (c2sResult) {
            case SFW_NOFIREWALL:
                statistics.append(messages.getString("server") + " '" + host + "' "
                        + messages.getString("firewallNo") + "\n");
                emailText += messages.getString("server") + " '" + host + "' "
                        + messages.getString("firewallNo") + "\n%0A";
                break;
            case SFW_POSSIBLE:
                statistics.append(messages.getString("server") + " '" + host + "' "
                        + messages.getString("firewallYes") + "\n");
                emailText += messages.getString("server") + " '" + host + "' "
                        + messages.getString("firewallYes") + "\n%0A";
                break;
            case SFW_UNKNOWN:
            case SFW_NOTTESTED:
                break;
            }
            switch (s2cResult) {
            case SFW_NOFIREWALL:
                statistics
                        .append(messages.getString("client2") + " " + messages.getString("firewallNo") + "\n");
                emailText += messages.getString("client2") + " " + messages.getString("firewallNo") + "\n%0A";
                break;
            case SFW_POSSIBLE:
                statistics
                        .append(messages.getString("client2") + " " + messages.getString("firewallYes") + "\n");
                emailText += messages.getString("client2") + " " + messages.getString("firewallYes") + "\n%0A";
                break;
            case SFW_UNKNOWN:
            case SFW_NOTTESTED:
                break;
            }
        }

        //         diagnosis.append("\nEstimate = " + prtdbl(estimate) + " based on packet size = "
        //            + (CurrentMSS*8/1024) + "kbits, RTT = " + prtdbl(avgrtt) + "msec, " + "and loss = " + loss + "\n");
        diagnosis.append("\n");

        diagnosis.append(messages.getString("theoreticalLimit") + " " + prtdbl(estimate) + " " + "Mbps\n");
        emailText += messages.getString("theoreticalLimit") + " " + prtdbl(estimate) + " Mbps\n%0A";

        diagnosis.append(messages.getString("ndtServerHas") + " " + prtdbl(Sndbuf / 2048) + " "
                + messages.getString("kbyteBufferLimits") + " " + prtdbl(swin / rttsec) + " Mbps\n");
        emailText += messages.getString("ndtServerHas") + " " + prtdbl(Sndbuf / 2048) + " "
                + messages.getString("kbyteBufferLimits") + " " + prtdbl(swin / rttsec) + " Mbps\n%0A";

        diagnosis.append(messages.getString("yourPcHas") + " " + prtdbl(MaxRwinRcvd / 1024) + " "
                + messages.getString("kbyteBufferLimits") + " " + prtdbl(rwin / rttsec) + " Mbps\n");
        emailText += messages.getString("yourPcHas") + " " + prtdbl(MaxRwinRcvd / 1024) + " "
                + messages.getString("kbyteBufferLimits") + " " + prtdbl(rwin / rttsec) + " Mbps\n%0A";

        diagnosis.append(messages.getString("flowControlLimits") + " " + prtdbl(cwin / rttsec) + " Mbps\n");
        emailText += messages.getString("flowControlLimits") + " " + prtdbl(cwin / rttsec) + " Mbps\n%0A";

        diagnosis.append("\n" + messages.getString("clientDataReports") + " '" + prttxt(c2sData) + "', "
                + messages.getString("clientAcksReport") + " '" + prttxt(c2sAck) + "'\n"
                + messages.getString("serverDataReports") + " '" + prttxt(s2cData) + "', "
                + messages.getString("serverAcksReport") + " '" + prttxt(s2cAck) + "'\n");
        pub_diagnosis = diagnosis.getText();

    }
}