Example usage for javax.swing JLabel setBounds

List of usage examples for javax.swing JLabel setBounds

Introduction

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

Prototype

public void setBounds(int x, int y, int width, int height) 

Source Link

Document

Moves and resizes this component.

Usage

From source file:net.itransformers.topologyviewer.dialogs.snmpDiscovery.DiscoveryManagerDialogV2.java

public DiscoveryManagerDialogV2(JFrame frame, File projectDir) {
    this.frame = frame;
    this.projectDir = projectDir;
    setTitle("Discovery Manager");
    setBounds(100, 100, 960, 364);/*from ww w  .ja  va  2s. co m*/
    getContentPane().setLayout(new BorderLayout());
    {

        JPanel buttonPane = new JPanel();
        getContentPane().add(buttonPane, BorderLayout.NORTH);
        {
            buttonPane.setLayout(new BorderLayout(0, 0));
            {
                JPanel panel = new JPanel();
                buttonPane.add(panel);
                panel.setLayout(null);
                {
                    depthComboBox = new JComboBox();
                    depthComboBox.setModel(
                            new DefaultComboBoxModel(new Integer[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }));
                    depthComboBox.setBounds(46, 11, 70, 20);
                    panel.add(depthComboBox);
                }

                JLabel lblMode = new JLabel("Depth:");
                lblMode.setBounds(6, 14, 46, 14);
                panel.add(lblMode);

                JLabel lblAddress = new JLabel("Address:");
                lblAddress.setBounds(172, 14, 56, 14);
                panel.add(lblAddress);

                addressTextField = new JTextField();
                addressTextField.setBounds(230, 11, 113, 20);
                panel.add(addressTextField);
                addressTextField.setColumns(10);

                JLabel lblLabel = new JLabel("Label:");
                lblLabel.setBounds(360, 14, 56, 14);
                panel.add(lblLabel);

                labelTextField = new JTextField();
                labelTextField.setBounds(400, 11, 113, 20);
                panel.add(labelTextField);
                labelTextField.setColumns(10);

                autoLabelCheckBox = new JCheckBox("auto-label");
                autoLabelCheckBox.setBounds(520, 11, 113, 20);
                autoLabelCheckBox.setSelected(true);
                panel.add(autoLabelCheckBox);
                postDiscoveryCheckBox = new JCheckBox("Post Discovery");
                postDiscoveryCheckBox.setBounds(620, 11, 153, 20);
                postDiscoveryCheckBox.setSelected(true);
                panel.add(postDiscoveryCheckBox);

            }
        }
        {
            JPanel panel = new JPanel();
            buttonPane.add(panel, BorderLayout.EAST);
            final JButton stopStartButton = new JButton("Start");
            panel.add(stopStartButton);
            stopStartButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    if ("Start".equals(stopStartButton.getText())) {
                        onStartDiscoveryPre(stopStartButton);
                        onStartDiscovery();
                        onStartDiscoveryPost(stopStartButton);
                    } else {
                        onStopDiscoveryPre(stopStartButton);
                        onStopDiscovery();
                        onStopDiscoveryPost(stopStartButton);

                    }
                }
            });
            stopStartButton.setActionCommand("Start");
            getRootPane().setDefaultButton(stopStartButton);
            {
                pauseResumeButton.setEnabled(false);
                panel.add(pauseResumeButton);
                pauseResumeButton.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        if ("Pause".equals(pauseResumeButton.getText())) {
                            pauseResumeButton.setEnabled(false);
                            onPauseDiscovery();
                            pauseResumeButton.setText("Resume");
                            pauseResumeButton.setEnabled(true);
                        } else {
                            pauseResumeButton.setEnabled(false);
                            onResumeDiscovery();
                            pauseResumeButton.setText("Pause");
                            pauseResumeButton.setEnabled(true);
                        }
                    }
                });
            }
        }
    }
    {
        lblDiscoveredDevices = new JTextArea();
        JScrollPane scrolltxt = new JScrollPane(lblDiscoveredDevices);
        lblDiscoveredDevices.append("Discovery process output");
        getContentPane().add(scrolltxt, BorderLayout.CENTER);
    }
    {
        JPanel statusPanel = new JPanel();
        getContentPane().add(statusPanel, BorderLayout.SOUTH);
        statusPanel.setLayout(new BorderLayout(0, 0));
        {
            JPanel panel = new JPanel();
            statusPanel.add(panel);
            panel.setLayout(new BorderLayout(0, 0));
            //panel.setSize(100:100);
            {
                loggerConsole = new JTextArea();
                JScrollPane scrolltxt = new JScrollPane(loggerConsole);
                loggerConsole.append("Discovery logger console");
                panel.add(scrolltxt, BorderLayout.CENTER);
            }
        }
    }
    {
        Logger logger = Logger.getRootLogger();
        logger.setLevel(Level.INFO);
        logger.addAppender(new AppenderSkeleton() {
            @Override
            protected void append(final LoggingEvent loggingEvent) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        loggerConsole.append(loggingEvent.getMessage().toString());
                        loggerConsole.append("\n");
                    }
                });
            }

            @Override
            public void close() {
            }

            @Override
            public boolean requiresLayout() {
                return false;
            }
        });
    }
}

From source file:com.openbravo.pos.util.ThumbNailBuilder.java

public Image getThumbNailText(Image img, String text) {
    /*//from  www  .  j  a  v a  2  s .c  o  m
     * Create an image containing a thumbnail of the product image,
     * or default image.
     * 
     * Then apply the text of the product name. Use text wrapping.
     * 
     * If the product name is too big for the label, ensure that
     * the first part is displayed.
     */

    img = getThumbNail(img);

    BufferedImage imgtext = new BufferedImage(img.getWidth(null), img.getHeight(null),
            BufferedImage.TYPE_INT_ARGB);
    Graphics2D g2d = imgtext.createGraphics();

    // The text
    // <p style="width: 100px"> DOES NOT WORK PROPERLY.
    // use width= instead.
    String html = "<html><p style=\"text-align:center\" width=\"" + imgtext.getWidth() + "\">"
            + StringEscapeUtils.escapeHtml(text) + "</p>";

    JLabel label = new JLabel(html);
    label.setOpaque(false);
    //label.setText("<html><center>Line1<br>Line2");
    label.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
    label.setVerticalAlignment(javax.swing.SwingConstants.TOP);
    Dimension d = label.getPreferredSize();
    label.setBounds(0, 0, imgtext.getWidth(), d.height);

    // The background
    Color c1 = new Color(0xff, 0xff, 0xff, 0x40);
    Color c2 = new Color(0xff, 0xff, 0xff, 0xd0);

    //        Point2D center = new Point2D.Float(imgtext.getWidth() / 2, label.getHeight());
    //        float radius = imgtext.getWidth() / 3;
    //        float[] dist = {0.1f, 1.0f};
    //        Color[] colors = {c2, c1};        
    //        Paint gpaint = new RadialGradientPaint(center, radius, dist, colors);
    Paint gpaint = new GradientPaint(new Point(0, 0), c1, new Point(label.getWidth() / 2, 0), c2, true);

    g2d.drawImage(img, 0, 0, null);
    int ypos = imgtext.getHeight() - label.getHeight();
    int ypos_min = -4; // todo: configurable
    if (ypos < ypos_min)
        ypos = ypos_min; // Clamp label
    g2d.translate(0, ypos);
    g2d.setPaint(gpaint);
    g2d.fillRect(0, 0, imgtext.getWidth(), label.getHeight());
    label.paint(g2d);

    g2d.dispose();

    return imgtext;
}

From source file:es.emergya.ui.base.plugins.PluggableJTabbedPane.java

private void addFloatingButtons() {
    JButton salir = new JButton();
    salir.addActionListener(new ExitHandler());

    Icon icon = LogicConstants.getIcon("header_button_exit");
    salir.setIcon(icon);//from  w w w . ja v  a2s . c om
    if (icon != null)
        if (min_height < icon.getIconHeight())
            min_height = icon.getIconHeight();

    // Aadimos el botn de Salir
    salir.setBounds(this.getWidth() - icon.getIconWidth() - 2, 2, icon.getIconWidth(), icon.getIconHeight());
    salir.setBorderPainted(false);
    PluggableJTabbedPane.this.salir = salir.getBounds();

    // Logo de la empresa
    JLabel logo = new JLabel();
    icon = LogicConstants.getIcon("header_logo_cliente");
    if (min_height < icon.getIconHeight())
        min_height = icon.getIconHeight();

    logo.setIcon(icon);
    logo.setBounds(salir.getBounds().x - icon.getIconWidth() - 2, 2, icon.getIconWidth(), icon.getIconHeight());

    JLabel companyLogo = new JLabel();
    icon = LogicConstants.getIcon("header_logo");
    if (icon != null)
        if (min_height < icon.getIconHeight())
            min_height = icon.getIconHeight();
    companyLogo.setIcon(icon);
    companyLogo.setBounds(logo.getBounds().x - icon.getIconWidth(), 2, icon.getIconWidth(),
            icon.getIconHeight());

    botones_flotantes = new ArrayList<JComponent>();
    addFloatingButton(companyLogo);
    addFloatingButton(logo);
    addFloatingButton(salir);

    repaint();
}

From source file:hspc.submissionsprogram.AppDisplay.java

AppDisplay() {
    this.setTitle("Dominion High School Programming Contest");
    this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    this.setResizable(false);

    WindowListener exitListener = new WindowAdapter() {
        @Override//from w ww  . ja  v a 2  s.co m
        public void windowClosing(WindowEvent e) {
            System.exit(0);
        }
    };
    this.addWindowListener(exitListener);

    JTabbedPane pane = new JTabbedPane();
    this.add(pane);

    JPanel submitPanel = new JPanel(null);
    submitPanel.setPreferredSize(new Dimension(500, 500));

    UIManager.put("FileChooser.readOnly", true);
    JFileChooser fileChooser = new JFileChooser();
    fileChooser.setBounds(0, 0, 500, 350);
    fileChooser.setVisible(true);
    FileNameExtensionFilter javaFilter = new FileNameExtensionFilter("Java files (*.java)", "java");
    fileChooser.setFileFilter(javaFilter);
    fileChooser.setAcceptAllFileFilterUsed(false);
    fileChooser.setControlButtonsAreShown(false);
    submitPanel.add(fileChooser);

    JSeparator separator1 = new JSeparator();
    separator1.setBounds(12, 350, 476, 2);
    separator1.setForeground(new Color(122, 138, 152));
    submitPanel.add(separator1);

    JLabel problemChooserLabel = new JLabel("Problem:");
    problemChooserLabel.setBounds(12, 360, 74, 25);
    submitPanel.add(problemChooserLabel);

    String[] listOfProblems = Main.Configuration.get("problem_names")
            .split(Main.Configuration.get("name_delimiter"));
    JComboBox problems = new JComboBox<>(listOfProblems);
    problems.setBounds(96, 360, 393, 25);
    submitPanel.add(problems);

    JButton submit = new JButton("Submit");
    submit.setBounds(170, 458, 160, 30);
    submit.addActionListener(e -> {
        try {
            File file = fileChooser.getSelectedFile();
            try {
                CloseableHttpClient httpClient = HttpClients.createDefault();
                HttpPost uploadFile = new HttpPost(Main.Configuration.get("submit_url"));

                MultipartEntityBuilder builder = MultipartEntityBuilder.create();
                builder.addTextBody("accountID", Main.accountID, ContentType.TEXT_PLAIN);
                builder.addTextBody("problem", String.valueOf(problems.getSelectedItem()),
                        ContentType.TEXT_PLAIN);
                builder.addBinaryBody("submission", file, ContentType.APPLICATION_OCTET_STREAM, file.getName());
                HttpEntity multipart = builder.build();

                uploadFile.setEntity(multipart);

                CloseableHttpResponse response = httpClient.execute(uploadFile);
                HttpEntity responseEntity = response.getEntity();
                String inputLine;
                BufferedReader br = new BufferedReader(new InputStreamReader(responseEntity.getContent()));
                try {
                    if ((inputLine = br.readLine()) != null) {
                        int rowIndex = Integer.parseInt(inputLine);
                        new ResultWatcher(rowIndex);
                    }
                    br.close();
                } catch (IOException ex) {
                    ex.printStackTrace();
                }
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        } catch (NullPointerException ex) {
            JOptionPane.showMessageDialog(this, "No file selected.\nPlease select a java file.", "Error",
                    JOptionPane.WARNING_MESSAGE);
        }
    });
    submitPanel.add(submit);

    JPanel clarificationsPanel = new JPanel(null);
    clarificationsPanel.setPreferredSize(new Dimension(500, 500));

    cList = new JList<>();
    cList.setBounds(12, 12, 476, 200);
    cList.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)),
            BorderFactory.createEmptyBorder(8, 8, 8, 8)));
    cList.setBackground(new Color(254, 254, 255));
    clarificationsPanel.add(cList);

    JButton viewC = new JButton("View");
    viewC.setBounds(12, 224, 232, 25);
    viewC.addActionListener(e -> {
        if (cList.getSelectedIndex() != -1) {
            int id = Integer.parseInt(cList.getSelectedValue().split("\\.")[0]);
            clarificationDatas.stream().filter(data -> data.getId() == id).forEach(
                    data -> new ClarificationDisplay(data.getProblem(), data.getText(), data.getResponse()));
        }
    });
    clarificationsPanel.add(viewC);

    JButton refreshC = new JButton("Refresh");
    refreshC.setBounds(256, 224, 232, 25);
    refreshC.addActionListener(e -> updateCList(true));
    clarificationsPanel.add(refreshC);

    JSeparator separator2 = new JSeparator();
    separator2.setBounds(12, 261, 476, 2);
    separator2.setForeground(new Color(122, 138, 152));
    clarificationsPanel.add(separator2);

    JLabel problemChooserLabelC = new JLabel("Problem:");
    problemChooserLabelC.setBounds(12, 273, 74, 25);
    clarificationsPanel.add(problemChooserLabelC);

    JComboBox problemsC = new JComboBox<>(listOfProblems);
    problemsC.setBounds(96, 273, 393, 25);
    clarificationsPanel.add(problemsC);

    JTextArea textAreaC = new JTextArea();
    textAreaC.setLineWrap(true);
    textAreaC.setWrapStyleWord(true);
    textAreaC.setBorder(new CompoundBorder(BorderFactory.createLineBorder(new Color(122, 138, 152)),
            BorderFactory.createEmptyBorder(8, 8, 8, 8)));
    textAreaC.setBackground(new Color(254, 254, 255));

    JScrollPane areaScrollPane = new JScrollPane(textAreaC);
    areaScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    areaScrollPane.setBounds(12, 312, 477, 134);
    clarificationsPanel.add(areaScrollPane);

    JButton submitC = new JButton("Submit Clarification");
    submitC.setBounds(170, 458, 160, 30);
    submitC.addActionListener(e -> {
        if (textAreaC.getText().length() > 2048) {
            JOptionPane.showMessageDialog(this,
                    "Clarification body is too long.\nMaximum of 2048 characters allowed.", "Error",
                    JOptionPane.WARNING_MESSAGE);
        } else if (textAreaC.getText().length() < 20) {
            JOptionPane.showMessageDialog(this,
                    "Clarification body is too short.\nClarifications must be at least 20 characters, but no more than 2048.",
                    "Error", JOptionPane.WARNING_MESSAGE);
        } else {
            Connection conn = null;
            PreparedStatement stmt = null;
            try {
                Class.forName(JDBC_DRIVER);

                conn = DriverManager.getConnection(Main.Configuration.get("jdbc_mysql_address"),
                        Main.Configuration.get("mysql_user"), Main.Configuration.get("mysql_pass"));

                String sql = "INSERT INTO clarifications (team, problem, text) VALUES (?, ?, ?)";
                stmt = conn.prepareStatement(sql);

                stmt.setInt(1, Integer.parseInt(String.valueOf(Main.accountID)));
                stmt.setString(2, String.valueOf(problemsC.getSelectedItem()));
                stmt.setString(3, String.valueOf(textAreaC.getText()));

                textAreaC.setText("");

                stmt.executeUpdate();

                stmt.close();
                conn.close();

                updateCList(false);
            } catch (Exception ex) {
                ex.printStackTrace();
            } finally {
                try {
                    if (stmt != null) {
                        stmt.close();
                    }
                } catch (Exception ex2) {
                    ex2.printStackTrace();
                }
                try {
                    if (conn != null) {
                        conn.close();
                    }
                } catch (Exception ex2) {
                    ex2.printStackTrace();
                }
            }
        }
    });
    clarificationsPanel.add(submitC);

    pane.addTab("Submit", submitPanel);
    pane.addTab("Clarifications", clarificationsPanel);

    Timer timer = new Timer();
    TimerTask updateTask = new TimerTask() {
        @Override
        public void run() {
            updateCList(false);
        }
    };
    timer.schedule(updateTask, 10000, 10000);

    updateCList(false);

    this.pack();
    this.setLocationRelativeTo(null);
    this.setVisible(true);
}

From source file:LicenseGenerator.java

/**
 * Initialize the contents of the frame.
 *///w  ww. j  a va 2 s  . com
private void initialize() {
    try {
        UIManager.setLookAndFeel(new WindowsLookAndFeel());
    } catch (UnsupportedLookAndFeelException ex) {
    }

    m_frame = new JFrame();
    m_frame.setTitle("License?");
    m_frame.setResizable(false);
    m_frame.setBounds(100, 100, 496, 483);
    m_frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    m_frame.getContentPane().setLayout(null);

    chkDate = new JCheckBox("?");
    chkDate.setSelected(true);
    chkDate.setBounds(6, 6, 103, 23);
    m_frame.getContentPane().add(chkDate);

    txtDate = new JTextField();
    txtDate.setText("20131231");
    txtDate.setHorizontalAlignment(SwingConstants.RIGHT);
    txtDate.setBounds(131, 7, 193, 21);
    m_frame.getContentPane().add(txtDate);
    txtDate.setColumns(10);

    chkAdapterNum = new JCheckBox("???");
    chkAdapterNum.setSelected(true);
    chkAdapterNum.setBounds(6, 37, 119, 23);
    m_frame.getContentPane().add(chkAdapterNum);

    txtAdapterNum = new JTextField();
    txtAdapterNum.setText("000012");
    txtAdapterNum.setHorizontalAlignment(SwingConstants.RIGHT);
    txtAdapterNum.setColumns(10);
    txtAdapterNum.setBounds(131, 38, 193, 21);
    m_frame.getContentPane().add(txtAdapterNum);

    chkAdapter = new JCheckBox(
            "??? (?? ???)");
    chkAdapter.setSelected(true);
    chkAdapter.setBounds(6, 76, 465, 23);
    m_frame.getContentPane().add(chkAdapter);

    chkHTTP_C = new JCheckBox("http.c");
    chkHTTP_C.setSelected(true);
    chkHTTP_C.setBounds(43, 130, 76, 23);
    m_frame.getContentPane().add(chkHTTP_C);

    txtHTTP_C = new JTextField();
    txtHTTP_C.setText("20131231");
    txtHTTP_C.setHorizontalAlignment(SwingConstants.RIGHT);
    txtHTTP_C.setBounds(131, 131, 103, 21);
    m_frame.getContentPane().add(txtHTTP_C);
    txtHTTP_C.setColumns(10);

    chkSOAP_C = new JCheckBox("soap.c");
    chkSOAP_C.setSelected(true);
    chkSOAP_C.setBounds(43, 161, 76, 23);
    m_frame.getContentPane().add(chkSOAP_C);

    txtSOAP_C = new JTextField();
    txtSOAP_C.setText("20131231");
    txtSOAP_C.setHorizontalAlignment(SwingConstants.RIGHT);
    txtSOAP_C.setColumns(10);
    txtSOAP_C.setBounds(131, 162, 103, 21);
    m_frame.getContentPane().add(txtSOAP_C);

    chkTCP_C = new JCheckBox("tcp.c");
    chkTCP_C.setSelected(true);
    chkTCP_C.setBounds(43, 192, 76, 23);
    m_frame.getContentPane().add(chkTCP_C);

    txtTCP_C = new JTextField();
    txtTCP_C.setText("20131231");
    txtTCP_C.setHorizontalAlignment(SwingConstants.RIGHT);
    txtTCP_C.setColumns(10);
    txtTCP_C.setBounds(131, 193, 103, 21);
    m_frame.getContentPane().add(txtTCP_C);

    chkUDP_C = new JCheckBox("udp.c");
    chkUDP_C.setSelected(true);
    chkUDP_C.setBounds(43, 223, 76, 23);
    m_frame.getContentPane().add(chkUDP_C);

    txtUDP_C = new JTextField();
    txtUDP_C.setText("20131231");
    txtUDP_C.setHorizontalAlignment(SwingConstants.RIGHT);
    txtUDP_C.setColumns(10);
    txtUDP_C.setBounds(131, 224, 103, 21);
    m_frame.getContentPane().add(txtUDP_C);

    chkTUXEDO_C = new JCheckBox("tuxedo.c");
    chkTUXEDO_C.setSelected(true);
    chkTUXEDO_C.setBounds(43, 254, 76, 23);
    m_frame.getContentPane().add(chkTUXEDO_C);

    txtTUXEDO_C = new JTextField();
    txtTUXEDO_C.setText("20131231");
    txtTUXEDO_C.setHorizontalAlignment(SwingConstants.RIGHT);
    txtTUXEDO_C.setColumns(10);
    txtTUXEDO_C.setBounds(131, 255, 103, 21);
    m_frame.getContentPane().add(txtTUXEDO_C);

    chkMQ_C = new JCheckBox("mq.c");
    chkMQ_C.setSelected(true);
    chkMQ_C.setBounds(43, 286, 76, 23);
    m_frame.getContentPane().add(chkMQ_C);

    txtMQ_C = new JTextField();
    txtMQ_C.setText("20131231");
    txtMQ_C.setHorizontalAlignment(SwingConstants.RIGHT);
    txtMQ_C.setColumns(10);
    txtMQ_C.setBounds(131, 287, 103, 21);
    m_frame.getContentPane().add(txtMQ_C);

    chkHTTP_S = new JCheckBox("http.s");
    chkHTTP_S.setSelected(true);
    chkHTTP_S.setBounds(283, 130, 76, 23);
    m_frame.getContentPane().add(chkHTTP_S);

    txtHTTP_S = new JTextField();
    txtHTTP_S.setText("20131231");
    txtHTTP_S.setHorizontalAlignment(SwingConstants.RIGHT);
    txtHTTP_S.setColumns(10);
    txtHTTP_S.setBounds(368, 130, 103, 21);
    m_frame.getContentPane().add(txtHTTP_S);

    chkSOAP_S = new JCheckBox("soap.s");
    chkSOAP_S.setSelected(true);
    chkSOAP_S.setBounds(283, 161, 76, 23);
    m_frame.getContentPane().add(chkSOAP_S);

    txtSOAP_S = new JTextField();
    txtSOAP_S.setText("20131231");
    txtSOAP_S.setHorizontalAlignment(SwingConstants.RIGHT);
    txtSOAP_S.setColumns(10);
    txtSOAP_S.setBounds(368, 161, 103, 21);
    m_frame.getContentPane().add(txtSOAP_S);

    chkTCP_S = new JCheckBox("tcp.s");
    chkTCP_S.setSelected(true);
    chkTCP_S.setBounds(283, 192, 76, 23);
    m_frame.getContentPane().add(chkTCP_S);

    txtTCP_S = new JTextField();
    txtTCP_S.setText("20131231");
    txtTCP_S.setHorizontalAlignment(SwingConstants.RIGHT);
    txtTCP_S.setColumns(10);
    txtTCP_S.setBounds(368, 192, 103, 21);
    m_frame.getContentPane().add(txtTCP_S);

    chkUDP_S = new JCheckBox("udp.s");
    chkUDP_S.setSelected(true);
    chkUDP_S.setBounds(283, 223, 76, 23);
    m_frame.getContentPane().add(chkUDP_S);

    txtUDP_S = new JTextField();
    txtUDP_S.setText("20131231");
    txtUDP_S.setHorizontalAlignment(SwingConstants.RIGHT);
    txtUDP_S.setColumns(10);
    txtUDP_S.setBounds(368, 223, 103, 21);
    m_frame.getContentPane().add(txtUDP_S);

    chkTUXEDO_S = new JCheckBox("tuxedo.s");
    chkTUXEDO_S.setSelected(true);
    chkTUXEDO_S.setBounds(283, 254, 76, 23);
    m_frame.getContentPane().add(chkTUXEDO_S);

    txtTUXEDO_S = new JTextField();
    txtTUXEDO_S.setText("20131231");
    txtTUXEDO_S.setHorizontalAlignment(SwingConstants.RIGHT);
    txtTUXEDO_S.setColumns(10);
    txtTUXEDO_S.setBounds(368, 254, 103, 21);
    m_frame.getContentPane().add(txtTUXEDO_S);

    chkMQ_S = new JCheckBox("mq.s");
    chkMQ_S.setSelected(true);
    chkMQ_S.setBounds(283, 286, 76, 23);
    m_frame.getContentPane().add(chkMQ_S);

    txtMQ_S = new JTextField();
    txtMQ_S.setText("20131231");
    txtMQ_S.setHorizontalAlignment(SwingConstants.RIGHT);
    txtMQ_S.setColumns(10);
    txtMQ_S.setBounds(368, 286, 103, 21);
    m_frame.getContentPane().add(txtMQ_S);

    JLabel lblAdapterType1 = new JLabel("???");
    lblAdapterType1.setBounds(43, 105, 115, 15);
    m_frame.getContentPane().add(lblAdapterType1);

    JLabel lblAdapterType2 = new JLabel("??");
    lblAdapterType2.setBounds(283, 105, 103, 15);
    m_frame.getContentPane().add(lblAdapterType2);

    JLabel lblAdapterDate1 = new JLabel("?");
    lblAdapterDate1.setHorizontalAlignment(SwingConstants.RIGHT);
    lblAdapterDate1.setBounds(168, 106, 66, 15);
    m_frame.getContentPane().add(lblAdapterDate1);

    JLabel lblAdapterDate2 = new JLabel("?");
    lblAdapterDate2.setHorizontalAlignment(SwingConstants.RIGHT);
    lblAdapterDate2.setBounds(405, 105, 66, 15);
    m_frame.getContentPane().add(lblAdapterDate2);

    JButton cmdLicense = new JButton("?license");
    cmdLicense.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            cmdLicense_click(e);
        }
    });
    cmdLicense.setBounds(302, 332, 169, 23);
    m_frame.getContentPane().add(cmdLicense);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(6, 367, 478, 82);
    m_frame.getContentPane().add(scrollPane);

    txtLicense = new JTextArea();
    txtLicense.setEditable(false);
    scrollPane.setViewportView(txtLicense);
}

From source file:utybo.easypastebin.windows.MainWindow.java

/**
 * Creates the window/*  ww  w .  j  a  va 2  s  . c o m*/
 */
@SuppressWarnings({ "rawtypes", "unchecked" })
public MainWindow() {
    EasyPastebin.LOGGER.log("Initializing the window", SinkJLevel.INFO);
    setTitle("EasyPastebin");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 664, 431);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    contentPane.setLayout(new BorderLayout(0, 0));
    setContentPane(contentPane);

    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    contentPane.add(tabbedPane, BorderLayout.CENTER);

    JPanel main = new JPanel();
    tabbedPane.addTab("EasyPastebin", null, main, null);
    main.setLayout(null);

    JScrollPane scrollPane = new JScrollPane();
    scrollPane.setBounds(62, 39, 312, 132);
    main.add(scrollPane);

    pasteContent = new JTextArea();
    pasteContent.setFont(new Font("Monospaced", Font.PLAIN, 11));
    pasteContent.setWrapStyleWord(true);
    pasteContent.setLineWrap(true);
    pasteContent.setToolTipText("Put your paste here!");
    scrollPane.setViewportView(pasteContent);

    JLabel titleLabel = new JLabel("Title :");
    titleLabel.setFont(new Font("Tahoma", Font.PLAIN, 12));
    titleLabel.setBounds(10, 11, 42, 21);
    main.add(titleLabel);

    pasteTitle = new JTextField();
    pasteTitle.setBounds(62, 12, 312, 20);
    main.add(pasteTitle);
    pasteTitle.setColumns(10);

    JLabel lblPaste = new JLabel("Paste :");
    lblPaste.setForeground(Color.RED);
    lblPaste.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblPaste.setBounds(10, 85, 53, 21);
    main.add(lblPaste);

    pasteExpireDate = new JComboBox();
    pasteExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12));
    pasteExpireDate.setModel(new DefaultComboBoxModel(EnumExpireDate.values()));
    pasteExpireDate.setBounds(468, 12, 155, 21);
    main.add(pasteExpireDate);

    JLabel lblExpireDate = new JLabel("Expire Date :");
    lblExpireDate.setFont(new Font("Tahoma", Font.PLAIN, 12));
    lblExpireDate.setBounds(384, 14, 81, 14);
    main.add(lblExpireDate);

    JLabel lblfieldsInRed = new JLabel("(Fields in red are required)");
    lblfieldsInRed.setBounds(72, 182, 302, 14);
    main.add(lblfieldsInRed);

    btnSubmit = new JButton("Submit!");
    btnSubmit.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent event) {
            EasyPastebin.LOGGER.log("Starting Submit script", SinkJLevel.INFO);
            btnSubmit.setEnabled(false);
            btnSubmit.setText("Please wait...");

            boolean success = true;
            String paste = pasteContent.getText();
            String title = pasteTitle.getText();
            EnumExpireDate expireDate = (EnumExpireDate) pasteExpireDate.getSelectedItem();

            if (paste.equals("") || paste.equals(" ") || paste.equals(null)) {
                pastebinUrl.setText("ERROR");
                JOptionPane.showMessageDialog(null, "You cannot send empty pastes!",
                        "Error while processing paste", JOptionPane.ERROR_MESSAGE);
            } else {
                try {
                    EasyPastebin.LOGGER.log("Setting options", SinkJLevel.INFO);
                    Map map = new HashMap<String, String>();
                    map.put("api_dev_key", HttpHelper.API_KEY);
                    map.put("api_option", "paste");
                    map.put("api_paste_code", paste);
                    if (!(expireDate.equals(null) || expireDate.equals(EnumExpireDate.NEVER)))
                        map.put("api_paste_expire_date", expireDate.getRawName());
                    if (!(title.equals("") || title.equals(" ") || title.equals(null)))
                        map.put("api_paste_name", title);

                    EasyPastebin.LOGGER.log("Sending paste", SinkJLevel.INFO);
                    String actionResult = HttpHelper.sendPost("http://pastebin.com/api/api_post.php", map)
                            .asString();
                    EasyPastebin.LOGGER.log("Paste sent, checking output", SinkJLevel.INFO);
                    // Exception handlers
                    if (actionResult.equals("Bad API request, invalid api_option")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Incorrect Pastebin option!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_dev_key")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Incorrect dev key! Try again with a more recent version!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, IP blocked")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null, "Error while processing paste. Your IP is blocked!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals(
                            "Bad API request, maximum number of 25 unlisted pastes for your free account")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals(
                            "Bad API request, maximum number of 10 private pastes for your free account")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals("Bad API request, api_paste_code was empty")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                    }
                    if (actionResult.equals("Bad API request, maximum paste file size exceeded")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Your paste is too big!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_expire_date")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Invalid expire date!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_paste_private")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null,
                                "Error while processing paste. Invalid privacy value!", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    }
                    if (actionResult.equals("Bad API request, invalid api_paste_format")) {
                        success = false;
                        EasyPastebin.LOGGER.log(
                                "The output is an error message : " + actionResult + ". Submit script failed!",
                                SinkJLevel.ERROR);
                        JOptionPane.showMessageDialog(null, "Error while processing paste. Invalid format!",
                                "Error", JOptionPane.ERROR_MESSAGE);
                    }
                    // END

                    // Starting display stuff
                    if (success == false) {
                        EasyPastebin.LOGGER.log("Submit script failed : success == false", SinkJLevel.ERROR);
                        pastebinUrl.setText("ERROR");
                    }
                    if (success == true) {
                        EasyPastebin.LOGGER.log("Paste sent! Starting display script!", SinkJLevel.INFO);
                        pastebinUrl.setText(actionResult);
                        JOptionPane.showMessageDialog(null, "Paste successfully sent!", "Done!",
                                JOptionPane.INFORMATION_MESSAGE);
                        EasyPastebin.LOGGER.log("Display script finished! Paste URL is : " + actionResult,
                                SinkJLevel.INFO);
                    }

                } catch (ClientProtocolException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                } catch (IOException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e, "Error",
                            JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                } catch (MissingParamException e) {
                    EasyPastebin.LOGGER.log("Unexpected error! " + e, SinkJLevel.ERROR);
                    JOptionPane.showMessageDialog(null, "Error while processing paste : " + e
                            + "! This is a severe programming error! Try again with a more recent version!",
                            "Error", JOptionPane.ERROR_MESSAGE);
                    e.printStackTrace();
                }
            }

            EasyPastebin.LOGGER.log("Re-enabling the Submit button ", SinkJLevel.INFO);
            btnSubmit.setEnabled(true);
            btnSubmit.setText("Submit another paste!");
            EasyPastebin.LOGGER.log("Finished submit script! Success : " + success, SinkJLevel.INFO);
        }
    });
    btnSubmit.setBounds(386, 45, 237, 44);
    main.add(btnSubmit);

    pastebinUrl = new JTextField();
    pastebinUrl.setText("The paste's URL will be shown here!");
    pastebinUrl.setEditable(false);
    pastebinUrl.setBounds(384, 198, 239, 32);
    main.add(pastebinUrl);
    pastebinUrl.setColumns(10);

    JPanel about = new JPanel();
    tabbedPane.addTab("About", null, about, null);

    JLabel label = new JLabel("EasyPastebin");
    label.setBounds(12, 12, 623, 39);
    label.setHorizontalAlignment(SwingConstants.CENTER);
    label.setFont(new Font("Dialog", Font.PLAIN, 25));

    JLabel lblTheEasiestWay = new JLabel("The easiest way to use Pastebin.com");
    lblTheEasiestWay.setBounds(12, 63, 623, 32);
    lblTheEasiestWay.setFont(new Font("Dialog", Font.PLAIN, 16));
    lblTheEasiestWay.setHorizontalAlignment(SwingConstants.CENTER);
    about.setLayout(null);
    about.add(label);
    about.add(lblTheEasiestWay);

    JButton btnForkM = new JButton("Fork me on Github!");
    btnForkM.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("https://github.com/utybo/EasyPastebin");
        }
    });
    btnForkM.setBounds(12, 117, 623, 25);
    about.add(btnForkM);

    JButton btnCheckOutUtybos = new JButton("Check out utybo's projects!");
    btnCheckOutUtybos.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("http://utybo.github.io/");
        }
    });
    btnCheckOutUtybos.setBounds(12, 154, 623, 25);
    about.add(btnCheckOutUtybos);

    JButton btnGoToPastebincom = new JButton("Go to Pastebin.com!");
    btnGoToPastebincom.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            goToUrl("http://www.pastebin.com");
        }
    });
    btnGoToPastebincom.setBounds(12, 191, 623, 25);
    about.add(btnGoToPastebincom);

    JLabel lblcUtybo = new JLabel(
            "This soft was made by utybo. It uses Apache's libraries for the interaction with Pastebin's API");
    lblcUtybo.setFont(new Font("Dialog", Font.PLAIN, 10));
    lblcUtybo.setHorizontalAlignment(SwingConstants.CENTER);
    lblcUtybo.setBounds(12, 324, 623, 15);
    about.add(lblcUtybo);

    JLabel lblClickMeTo = new JLabel("Click me to go to Apache's licence official website");
    lblClickMeTo.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            goToUrl("http://www.apache.org/licenses/LICENSE-2.0");
        }
    });
    lblClickMeTo.setHorizontalAlignment(SwingConstants.CENTER);
    lblClickMeTo.setFont(new Font("Dialog", Font.PLAIN, 10));
    lblClickMeTo.setBounds(12, 342, 623, 15);
    about.add(lblClickMeTo);

    setVisible(true);

    EasyPastebin.LOGGER.log("Done!", SinkJLevel.INFO);
}

From source file:autoGui.RegisterPagePanel.java

RegisterPagePanel(JFrame parent, MouseAdapter backHandler) {
    parent.getContentPane().add(RegisterPage, "name_22846752421143");
    RegisterPage.setLayout(null);//  www  . ja  va  2  s  . co m
    //System.out.println(parent.getContentPane());
    RegisterPage.setBounds(100, 100, 1036, 608);

    email = new JTextField();
    email.setBounds(642, 87, 116, 22);
    RegisterPage.add(email);
    email.setColumns(10);

    JLabel lblEmail = new JLabel("Email*");
    lblEmail.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblEmail.setBounds(506, 89, 56, 16);
    RegisterPage.add(lblEmail);

    JLabel lblNewLabel = new JLabel("Password*");
    lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel.setBounds(506, 132, 71, 16);
    RegisterPage.add(lblNewLabel);

    JLabel lblFirstName = new JLabel("First Name*");
    lblFirstName.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblFirstName.setBounds(141, 87, 88, 16);
    RegisterPage.add(lblFirstName);

    firstName = new JTextField();
    firstName.setBounds(241, 85, 142, 22);
    RegisterPage.add(firstName);
    firstName.setColumns(10);

    JLabel lblNewLabel_1 = new JLabel("Middle Name");
    lblNewLabel_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_1.setBounds(141, 132, 88, 16);
    RegisterPage.add(lblNewLabel_1);

    middleName = new JTextField();
    middleName.setBounds(241, 129, 142, 22);
    RegisterPage.add(middleName);
    middleName.setColumns(10);

    JLabel lblNewLabel_2 = new JLabel("Last Name*");
    lblNewLabel_2.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_2.setBounds(141, 174, 88, 16);
    RegisterPage.add(lblNewLabel_2);

    lastName = new JTextField();
    lastName.setBounds(241, 172, 142, 22);
    RegisterPage.add(lastName);
    lastName.setColumns(10);

    JLabel lblPersonalInformation = new JLabel("Personal Information");
    lblPersonalInformation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblPersonalInformation.setBounds(86, 33, 159, 27);
    RegisterPage.add(lblPersonalInformation);

    JLabel lblContactInformation = new JLabel("Contact Information");
    lblContactInformation.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblContactInformation.setBounds(459, 33, 175, 27);
    RegisterPage.add(lblContactInformation);

    JLabel lblPhoneNumber = new JLabel("Phone*");
    lblPhoneNumber.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblPhoneNumber.setBounds(506, 217, 71, 16);
    RegisterPage.add(lblPhoneNumber);

    phone = new JTextField();
    phone.setBounds(642, 215, 116, 22);
    RegisterPage.add(phone);
    phone.setColumns(10);

    password = new JPasswordField();
    password.setBounds(642, 130, 116, 22);
    RegisterPage.add(password);

    JButton btnBack_5 = new JButton("Back");
    btnBack_5.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
        }
    });

    btnBack_5.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            if (lastPage == 6) {
                lastPage = 4;

            }
            RegisterPage.setVisible(false);
            parent.getContentPane().getComponent(lastPage).setVisible(true);
            backHandler.mouseClicked(e);
        }
    });
    btnBack_5.setBounds(12, 525, 97, 25);
    RegisterPage.add(btnBack_5);

    JButton btnExit_6 = new JButton("Exit");
    btnExit_6.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            parent.setVisible(false);
            parent.dispose();
        }
    });
    btnExit_6.setBounds(909, 525, 97, 25);
    RegisterPage.add(btnExit_6);

    JLabel lblAddress = new JLabel("Address*");
    lblAddress.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblAddress.setBounds(141, 217, 56, 16);
    RegisterPage.add(lblAddress);

    address = new JTextField();
    address.setBounds(241, 215, 142, 22);
    RegisterPage.add(address);
    address.setColumns(10);

    address2 = new JTextField();
    address2.setBounds(241, 260, 142, 22);
    RegisterPage.add(address2);
    address2.setColumns(10);

    JLabel lblCity = new JLabel("City*");
    lblCity.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCity.setBounds(141, 308, 56, 16);
    RegisterPage.add(lblCity);

    city = new JTextField();
    city.setBounds(241, 306, 142, 22);
    RegisterPage.add(city);
    city.setColumns(10);

    JLabel lblAddress_1 = new JLabel("Address 2");
    lblAddress_1.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblAddress_1.setBounds(141, 263, 77, 16);
    RegisterPage.add(lblAddress_1);

    JLabel lblZip = new JLabel("Zip*");
    lblZip.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblZip.setBounds(141, 402, 56, 16);
    RegisterPage.add(lblZip);

    zip = new JTextField();
    zip.setBounds(241, 400, 142, 22);
    RegisterPage.add(zip);
    zip.setColumns(10);

    JLabel lblState = new JLabel("State*");
    lblState.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblState.setBounds(141, 355, 56, 16);
    RegisterPage.add(lblState);

    state = new JTextField();
    state.setBounds(241, 353, 142, 22);
    RegisterPage.add(state);
    state.setColumns(10);

    JLabel lblRequired = new JLabel("* = required");
    lblRequired.setBounds(301, 39, 88, 16);
    RegisterPage.add(lblRequired);

    JLabel lblLicenseInfo = new JLabel("License Information");
    lblLicenseInfo.setFont(new Font("Tahoma", Font.PLAIN, 16));
    lblLicenseInfo.setBounds(459, 257, 148, 27);
    RegisterPage.add(lblLicenseInfo);

    JLabel lblNumber = new JLabel("Number*");
    lblNumber.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNumber.setBounds(506, 310, 71, 16);
    RegisterPage.add(lblNumber);

    license = new JTextField();
    license.setBounds(642, 306, 116, 22);
    RegisterPage.add(license);
    license.setColumns(10);

    JLabel lblDateOfBirth = new JLabel("Date of Birth*");
    lblDateOfBirth.setBounds(506, 372, 88, 16);
    RegisterPage.add(lblDateOfBirth);

    birthMonth = new JComboBox();
    birthMonth.setModel(new DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
            "Aug", "Sep", "Oct", "Nov", "Dec" }));
    birthMonth.setBounds(642, 370, 71, 22);
    RegisterPage.add(birthMonth);

    birthDay = new JComboBox();
    birthDay.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10",
            "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26",
            "27", "28", "29", "30", "31" }));
    birthDay.setBounds(708, 370, 62, 22);
    RegisterPage.add(birthDay);

    List<Integer> years = new ArrayList<Integer>();
    for (int i = 1915; i <= 2015; ++i) {
        years.add(i);
    }

    birthYear = new JComboBox(years.toArray());
    birthYear.setBounds(769, 370, 97, 22);
    RegisterPage.add(birthYear);

    JButton btnContinue = new JButton("Continue ->");
    btnContinue.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            register(parent);

        }
    });
    btnContinue.setBounds(674, 428, 133, 34);
    RegisterPage.add(btnContinue);

    JLabel lblConfirmPassword = new JLabel("Confirm Password*");
    lblConfirmPassword.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblConfirmPassword.setBounds(506, 174, 121, 16);
    RegisterPage.add(lblConfirmPassword);

    repassword = new JPasswordField();
    repassword.setBounds(642, 172, 116, 22);
    RegisterPage.add(repassword);

    JLabel lblNewLabel_3 = new JLabel("Credit card #*");
    lblNewLabel_3.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblNewLabel_3.setBounds(141, 448, 93, 16);
    RegisterPage.add(lblNewLabel_3);

    cardNumber = new JTextField();
    cardNumber.setBounds(241, 443, 142, 28);
    RegisterPage.add(cardNumber);
    cardNumber.setColumns(10);

    JLabel lblCardExp = new JLabel("Card exp*");
    lblCardExp.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblCardExp.setBounds(141, 496, 82, 16);
    RegisterPage.add(lblCardExp);

    cardExpMonth = new JComboBox();
    cardExpMonth.setModel(new DefaultComboBoxModel(new String[] { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }));
    cardExpMonth.setBounds(238, 493, 77, 27);
    RegisterPage.add(cardExpMonth);

    cardExpDay = new JComboBox();
    cardExpDay.setModel(new DefaultComboBoxModel(new String[] { "1", "2", "3", "4", "5", "6", "7", "8", "9",
            "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25",
            "26", "27", "28", "29", "30", "31" }));
    cardExpDay.setBounds(312, 493, 71, 27);
    RegisterPage.add(cardExpDay);

    JLabel lblLicenseState = new JLabel("License state*");
    lblLicenseState.setFont(new Font("Tahoma", Font.PLAIN, 14));
    lblLicenseState.setBounds(506, 338, 88, 16);
    RegisterPage.add(lblLicenseState);

    licenseState = new JTextField();
    licenseState.setBounds(642, 333, 116, 28);
    RegisterPage.add(licenseState);
    licenseState.setColumns(10);

    RegisterPage.setVisible(false);
}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

/**
 * Create the panel./*w w w  .  ja  va 2  s  . c o m*/
 */
private JPanel createloginPanelV2() {
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(36, 36, 36, 36));
    contentPane.setLayout(null);

    JPanel loginUserPanel = new JPanel();
    loginUserPanel.setBounds(40, 91, 825, 306);
    contentPane.add(loginUserPanel);
    loginUserPanel
            .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null),
                    "", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215)));
    loginUserPanel.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("User Name");
    lblNewLabel_1.setBounds(70, 80, 118, 36);
    loginUserPanel.add(lblNewLabel_1);

    JButton submitBtn = new JButton(SubmitBtnLbl);
    submitBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                setStatus(statusLbl, "Please enter a valid user name and password.", Color.red);
            } else {
                setStatus(statusLbl, "Checking your access permission...", Color.blue);
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        submitRequest(userId, password);
                    }
                });
            }
        }
    });
    submitBtn.setBounds(606, 238, 140, 36);
    loginUserPanel.add(submitBtn);

    userNameFld = new JTextField();
    userNameFld.setBounds(200, 80, 333, 36);
    loginUserPanel.add(userNameFld);
    userNameFld.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setBounds(70, 156, 118, 36);
    loginUserPanel.add(lblPassword);

    passwdFld = new JPasswordField();
    passwdFld.setBounds(200, 156, 333, 36);
    loginUserPanel.add(passwdFld);

    statusLbl = new JLabel("");
    statusLbl.setBounds(70, 226, 524, 36);
    statusLbl.setFont(new Font("SansSerif", Font.PLAIN, 13));
    statusLbl.setVerticalAlignment(SwingConstants.BOTTOM);
    loginUserPanel.add(statusLbl);

    JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \""
            + DownloaderProperties.getBuildTime() + "\"");
    versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setForeground(new Color(70, 130, 180));
    versionLabel.setBounds(318, 427, 266, 20);
    contentPane.add(versionLabel);

    JLabel infoLbl = new JLabel(
            "This download contains restricted data. Log in or contact the help desk for access.");
    infoLbl.setForeground(new Color(105, 105, 105));
    infoLbl.setFont(new Font("SansSerif", Font.BOLD, 13));
    infoLbl.setBounds(40, 34, 796, 42);
    contentPane.add(infoLbl);

    JLabel helpDeskLbl;

    helpDeskLbl = new JLabel();
    ImageIcon image = new ImageIcon(this.getClass().getClassLoader().getResource("info.png"));
    helpDeskLbl = new JLabel(image);
    helpDeskLbl.setToolTipText("Click to get phone number/email address of the Help Desk.");
    helpDeskLbl.setBounds(826, 20, 36, 36);
    contentPane.add(helpDeskLbl);

    helpDeskLbl.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            System.out.println("mouse clicked");
            //BrowserLauncher.openUrl(DownloaderProperties.getHelpDeskUrl());
            BrowserLauncher.openUrlForHelpDesk();
        }

    });

    userNameFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            passwdFld.requestFocus();
        }
    });

    userNameFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    passwdFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                setStatus(statusLbl, "Please enter a valid user name and password.", Color.red);
            } else {
                setStatus(statusLbl, "Checking your access permission...", Color.blue);
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        submitRequest(userId, password);
                    }
                });
            }
        }
    });

    passwdFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    return contentPane;
}

From source file:ecg.ecgshow.ECGShowUI.java

private void createGuardData() {
    GuardDataPanel = new JPanel();
    GuardDataPanel.setBackground(new Color(0, 150, 255));
    //        GuardDataPanel.setBounds();
    //        BoxLayout layout=new BoxLayout(GuardDataPanel,BoxLayout.Y_AXIS);
    //        GuardDataPanel.setLayout(layout);
    GroupLayout layout = new GroupLayout(GuardDataPanel);
    GuardDataPanel.setLayout(layout);//from   ww  w .ja v  a  2  s.  c o  m
    JPanel temperatureData = new JPanel();
    temperatureData.setLayout(new FlowLayout());
    //        temperatureData.setLayout(null);
    //        temperatureData.setBounds(0,0,(int) (WIDTH * 0.14), (int) (HEIGHT * 0.15));
    temperatureData.setSize((int) (WIDTH * 0.16), (int) (HEIGHT * 0.11));
    temperatureData.setBackground(new Color(0, 150, 255));
    temperatureLabel = new JLabel("--.- ");
    temperatureLabel.setFont(loadFont("LED.tff", (float) (HEIGHT * 0.070)));
    temperatureLabel.setBackground(new Color(0, 150, 255));
    temperatureLabel.setForeground(Color.RED);
    //        temperatureLabel.setBounds(0,0,200,100);
    temperatureLabel.setOpaque(true);
    JLabel temperatureLabelName = new JLabel(" ");
    temperatureLabelName.setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020)));
    temperatureLabelName.setBackground(new Color(0, 150, 255));
    temperatureLabelName.setForeground(Color.BLACK);
    temperatureLabelName.setBounds(0, 0, 100, 100);
    temperatureLabelName.setOpaque(true); //??
    temperatureData.add(temperatureLabelName);
    temperatureData.add(temperatureLabel);
    //        JPanel emptyPanel=new JPanel();
    //        emptyPanel.setSize((int)(WIDTH*0.14),(int)(HEIGHT*0.2));
    //        emptyPanel.setBackground(new Color(0,150,255));
    //        GuardDataPanel.add(emptyPanel);

    JPanel lightValueData = new JPanel();
    lightValueData.setLayout(new BorderLayout());
    lightValueData.setBackground(new Color(0, 150, 255));
    //        lightValueData.setBounds(0,(int)(HEIGHT*0.28),(int)(WIDTH*0.14),(int)(HEIGHT*0.30));
    lightValueData.setSize((int) (WIDTH * 0.14), (int) (HEIGHT * 0.22));
    lightValueDataSet = new DefaultValueDataset();
    DialPlot lightValueDialPlot = new DialPlot();
    lightValueDialPlot.setDataset(lightValueDataSet);
    StandardDialFrame dialFrame = new StandardDialFrame();
    dialFrame.setVisible(false);
    lightValueDialPlot.setDialFrame(dialFrame);

    GradientPaint gradientpaint = new GradientPaint(new Point(), new Color(255, 255, 255), new Point(),
            new Color(170, 170, 170));
    DialBackground dialBackground = new DialBackground(gradientpaint);
    dialBackground.setGradientPaintTransformer(
            new StandardGradientPaintTransformer(GradientPaintTransformType.VERTICAL));
    lightValueDialPlot.setBackground(dialBackground);
    // ??
    DialTextAnnotation dialtextannotation = new DialTextAnnotation("");
    dialtextannotation.setFont(new Font("Dialog", 0, (int) (0.016 * HEIGHT)));
    dialtextannotation.setRadius(0.1D);
    lightValueDialPlot.addLayer(dialtextannotation);

    DialValueIndicator dialValueIndicator = new DialValueIndicator(0);
    dialValueIndicator.setFont(new Font("Dialog", Font.PLAIN, (int) (0.011 * HEIGHT)));
    dialValueIndicator.setOutlinePaint(Color.darkGray);
    dialValueIndicator.setRadius(0.4D);
    dialValueIndicator.setAngle(-90.0);
    lightValueDialPlot.addLayer(dialValueIndicator);

    StandardDialScale dialScale = new StandardDialScale();
    dialScale.setLowerBound(0D); // 
    dialScale.setUpperBound(1024); // 
    dialScale.setMajorTickIncrement(100);
    dialScale.setStartAngle(-120D); // 120,?
    dialScale.setExtent(-300D); // 300,?
    dialScale.setTickRadius(0.85D); // ,
    dialScale.setTickLabelOffset(0.1D); // ,0

    bloodDialRange = new StandardDialRange(500D, 750D, Color.red);
    bloodDialRange.setInnerRadius(0.52000000000000002D);
    bloodDialRange.setOuterRadius(0.55000000000000004D);
    lightValueDialPlot.addLayer(bloodDialRange);
    //
    bubbleDialRange = new StandardDialRange(0D, 500D, Color.black);
    bubbleDialRange.setInnerRadius(0.52000000000000002D);
    bubbleDialRange.setOuterRadius(0.55000000000000004D);
    lightValueDialPlot.addLayer(bubbleDialRange);
    //
    normalDialRange = new StandardDialRange(750D, 1024D, Color.green);
    normalDialRange.setInnerRadius(0.52000000000000002D);
    normalDialRange.setOuterRadius(0.55000000000000004D);
    lightValueDialPlot.addLayer(normalDialRange);

    dialScale.setTickLabelFont(new Font("Dialog", 0, (int) (0.011 * HEIGHT))); // 
    lightValueDialPlot.addScale(0, dialScale);

    DialPointer.Pointer pointer = new DialPointer.Pointer();
    lightValueDialPlot.addPointer(pointer);
    lightValueDialPlot.mapDatasetToScale(0, 0);
    DialCap dialCap = new DialCap();
    dialCap.setRadius(0.07D);
    JFreeChart lightValueDialChart = new JFreeChart(lightValueDialPlot);
    lightValueDialChart.setBackgroundPaint(new Color(0, 150, 255));
    lightValueDialChart.setTitle("??");
    lightValueDialChart.getTitle().setFont(new Font("SansSerif", 0, (int) (HEIGHT * 0.020)));
    ChartPanel lightValueDialChartPanel = new ChartPanel(lightValueDialChart, (int) (WIDTH * 0.15),
            (int) (HEIGHT * 0.27), 0, 0, Integer.MAX_VALUE, Integer.MAX_VALUE, true, true, false, true, false,
            false);
    lightValueData.add(lightValueDialChartPanel, BorderLayout.CENTER);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                            .addComponent(temperatureData, GroupLayout.Alignment.LEADING)
                            .addComponent(lightValueData, GroupLayout.Alignment.LEADING))));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05))
                    .addComponent(temperatureData)
                    .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05))
                    .addComponent(lightValueData)
                    .addGap((int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05), (int) (HEIGHT * 0.05))));

    //        JPanel alarmMessage=new JPanel();
    //        alarmMessage.setBackground(new Color(0,150,255));
    //        alarmMessLabel=new JLabel("");
    //        alarmMessLabel.setFont(new Font("SansSerif", 0, (int)(HEIGHT *0.020)));
    //        alarmMessLabel.setBackground(new Color(0,150,255));
    //        alarmMessage.add(alarmMessLabel);
    //        GuardDataPanel.add(alarmMessage);
}

From source file:gov.nih.nci.nbia.StandaloneDMV3.java

private JPanel constructLoginPanel() {
    JPanel contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(36, 36, 36, 36));
    contentPane.setLayout(null);/*from  w ww  . j  av a  2 s.  c o m*/

    JPanel guestPanel = new JPanel();
    guestPanel.setBounds(38, 40, 825, 140);
    guestPanel.setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.RAISED, new Color(153, 180, 209), null),
            "  For Guest  ", TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 120, 215)));
    contentPane.add(guestPanel);
    guestPanel.setLayout(null);

    JButton guestBtn = new JButton(GuestBtnLbl);
    guestBtn.setBounds(606, 50, 140, 36);
    guestBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            submitRequest(null, null);
        }
    });
    guestPanel.add(guestBtn);

    JLabel guestLbl = new JLabel("Log in as a guest to download public data only");
    guestLbl.setBounds(70, 50, 460, 42);
    guestPanel.add(guestLbl);

    JPanel loginUserPanel = new JPanel();
    loginUserPanel.setBounds(40, 258, 825, 306);
    contentPane.add(loginUserPanel);
    loginUserPanel
            .setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, new Color(153, 180, 209), null),
                    "  Login to Download Authorized Data  ", TitledBorder.CENTER, TitledBorder.TOP, null,
                    new Color(0, 120, 215)));
    loginUserPanel.setLayout(null);

    JLabel lblNewLabel_1 = new JLabel("User Name");
    lblNewLabel_1.setBounds(70, 80, 118, 36);
    loginUserPanel.add(lblNewLabel_1);

    JButton submitBtn = new JButton(SubmitBtnLbl);
    submitBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                statusLbl.setText("Please enter a valid user name and password.");
                statusLbl.setForeground(Color.red);
            } else {
                submitRequest(userId, password);
            }
        }
    });
    submitBtn.setBounds(606, 238, 140, 36);
    loginUserPanel.add(submitBtn);

    userNameFld = new JTextField();
    userNameFld.setBounds(200, 80, 333, 36);
    loginUserPanel.add(userNameFld);
    userNameFld.setColumns(10);

    JLabel lblPassword = new JLabel("Password");
    lblPassword.setBounds(70, 156, 118, 36);
    loginUserPanel.add(lblPassword);

    passwdFld = new JPasswordField();
    passwdFld.setBounds(200, 156, 333, 36);
    loginUserPanel.add(passwdFld);

    statusLbl = new JLabel("");
    statusLbl.setBounds(70, 226, 463, 36);
    loginUserPanel.add(statusLbl);

    JLabel lblOr = new JLabel("--- OR ---");
    lblOr.setBounds(419, 212, 81, 26);
    contentPane.add(lblOr);

    JLabel versionLabel = new JLabel("Release " + DownloaderProperties.getAppVersion() + " Build \""
            + DownloaderProperties.getBuildTime() + "\"");
    versionLabel.setHorizontalAlignment(SwingConstants.CENTER);
    versionLabel.setForeground(new Color(70, 130, 180));
    versionLabel.setBounds(315, 584, 260, 20);
    contentPane.add(versionLabel);

    userNameFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            passwdFld.requestFocus();
        }
    });

    userNameFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    passwdFld.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            userId = userNameFld.getText();
            password = passwdFld.getText();
            if ((userId.length() < 1) || (password.length() < 1)) {
                statusLbl.setText("Please enter a valid user name and password.");
                statusLbl.setForeground(Color.red);
            } else
                submitRequest(userId, password);
        }
    });

    passwdFld.addFocusListener(new FocusListener() {

        @Override
        public void focusGained(FocusEvent e) {
            statusLbl.setText("");
        }

        @Override
        public void focusLost(FocusEvent e) {
        }
    });

    return contentPane;
}