Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 6 of 6

Thread: link

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question link

    /*
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
     
    /*
     * Crytpo.java
     *
     * Created on Jun 30, 2011, 8:31:45 PM
     */
    package web.base;
     
    /**
     *
     * @author Chang
     */
    public class Crytpo extends javax.swing.JFrame {
     
        /** Creates new form Crytpo */
        public Crytpo() {
            initComponents();
        }
     
        /** This method is called from within the constructor to
         * initialize the form.
         * WARNING: Do NOT modify this code. The content of this method is
         * always regenerated by the Form Editor.
         */
        @SuppressWarnings("unchecked")
        // <editor-fold defaultstate="collapsed" desc="Generated Code">
        private void initComponents() {
     
            Welcome = new javax.swing.JLabel();
            jLabel1 = new javax.swing.JLabel();
            RSA = new javax.swing.JButton();
            Prime = new javax.swing.JButton();
            SecretKey = new javax.swing.JButton();
            jButton1 = new javax.swing.JButton();
            Mersene = new javax.swing.JButton();
     
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
     
            Welcome.setFont(new java.awt.Font("Tahoma", 0, 36)); // NOI18N
            Welcome.setText("Welcome to calculator");
     
            jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
            jLabel1.setText("Please chose to check the cryptographic:");
     
            RSA.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
            RSA.setText("RSA");
            RSA.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    RSAActionPerformed(evt);
                }
            });
     
            Prime.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
            Prime.setText("Prime");
     
            SecretKey.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
            SecretKey.setText("Secret Key");
     
            jButton1.setText("jButton1");
     
            Mersene.setFont(new java.awt.Font("Tahoma", 0, 18)); // NOI18N
            Mersene.setText("Mersene");
     
            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
            getContentPane().setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(Welcome, javax.swing.GroupLayout.DEFAULT_SIZE, 358, Short.MAX_VALUE)
                    .addGap(32, 32, 32))
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(layout.createSequentialGroup()
                            .addGap(41, 41, 41)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(RSA)
                                .addComponent(Prime))
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 117, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(Mersene)
                                .addComponent(SecretKey)))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGap(29, 29, 29)
                            .addComponent(jLabel1)))
                    .addContainerGap(50, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(19, 19, 19)
                    .addComponent(Welcome, javax.swing.GroupLayout.PREFERRED_SIZE, 30, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGap(18, 18, 18)
                    .addComponent(jLabel1)
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(Mersene)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 40, Short.MAX_VALUE)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(SecretKey)
                                .addComponent(Prime))
                            .addGap(91, 91, 91))
                        .addComponent(RSA)))
            );
     
            pack();
        }// </editor-fold>
     
        private void RSAActionPerformed(java.awt.event.ActionEvent evt) {
            // TODO add your handling code here:
     
        }
     
        /**
         * @param args the command line arguments
         */
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
     
                public void run() {
                    new Crytpo().setVisible(true);
                }
            });
        }
        // Variables declaration - do not modify
        private javax.swing.JButton Mersene;
        private javax.swing.JButton Prime;
        private javax.swing.JButton RSA;
        private javax.swing.JButton SecretKey;
        private javax.swing.JLabel Welcome;
        private javax.swing.JButton jButton1;
        private javax.swing.JLabel jLabel1;
        // End of variables declaration
    }
    i try to do button to link to other page call RSA so how to do?
    rivate void RSAActionPerformed(java.awt.event.ActionEvent evt) {
    // TODO add your handling code here:

    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: link

    to link to other page
    Can you explain what you mean by this? "link to ..." sounds like the HTML tag <A HREF= and not java.
    In the code you posted, the action listener for the JButton: RSA calls the RSAActionPerformed() method when it is pressed.
    Is there some processing you want done when the RSA button is pressed?

  3. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: link

    Quote Originally Posted by Norm View Post
    Can you explain what you mean by this? "link to ..." sounds like the HTML tag <A HREF= and not java.
    In the code you posted, the action listener for the JButton: RSA calls the RSAActionPerformed() method when it is pressed.
    Is there some processing you want done when the RSA button is pressed?
    yes something like that. need to write the code?

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: link

    Sorry, I don't understand what your question is. Can you explain?

  5. #5
    Junior Member
    Join Date
    Jun 2011
    Posts
    17
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: link

    Quote Originally Posted by Norm View Post
    Sorry, I don't understand what your question is. Can you explain?
    Example i click on button, it will direct to other page

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: link

    i click on button, it will direct to other page
    What is a page? Are you talking about an html page in a browser?
    The GUI for Java programs are displayed in windows created by classes like JFrames.

    To have your code do something when a button is clicked, you need to add a listener to the button.
    The listener code can then "go to the other page".
    I don't know what you mean by "direct to other page". Please explain.

Similar Threads

  1. Link Grabber
    By isuru in forum What's Wrong With My Code?
    Replies: 2
    Last Post: May 17th, 2011, 03:33 AM
  2. New Unanswered Threads Link
    By JavaPF in forum The Cafe
    Replies: 1
    Last Post: May 5th, 2011, 12:26 PM
  3. Forward to a link from Java
    By makdu in forum JavaServer Pages: JSP & JSTL
    Replies: 0
    Last Post: November 30th, 2010, 06:45 AM
  4. Can Anyone Check This Link
    By arpitgadle in forum Java Servlet
    Replies: 5
    Last Post: October 7th, 2009, 08:56 AM
  5. How to Hyper-link pages together in Java?
    By don.java1 in forum Java Applets
    Replies: 5
    Last Post: July 21st, 2008, 05:09 AM