Java Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming LanguagesJava Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 4th, 2008, 02:47 PM
EldHawke EldHawke is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Location: Kenya
Posts: 27 EldHawke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 51 m 33 sec
Reputation Power: 0
Homework - Please could i have some assistance

Hi all, i am new here..i am actually here for one reason so far, but the site looks awesome, so i will be around.

i was wondering if any of you would mind helping me script a few commands. i can create the gui and everything..i just need the commands to be put in, now im not very good at that.

if you can help, plz reply and i will gladly upload the .java files.

thnx to all

Reply With Quote
  #2  
Old May 4th, 2008, 03:09 PM
tagmanadvance's Avatar
tagmanadvance tagmanadvance is offline
Kage Bunshin
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2005
Location: The Seven Seas Of Rhye
Posts: 779 tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 16 h 22 m 3 sec
Reputation Power: 180
Send a message via AIM to tagmanadvance Send a message via Yahoo to tagmanadvance Send a message via XFire to tagmanadvance
This is a help section. Not a do-it-for-you-so-that-you-don't-have-to-and-will-never-learn-that-way section. Adding listeners is quite easy =)
__________________
"Java makes impossible things possible, but makes easy things difficult." - Somebody

Reply With Quote
  #3  
Old May 4th, 2008, 03:29 PM
EldHawke EldHawke is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Location: Kenya
Posts: 27 EldHawke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 51 m 33 sec
Reputation Power: 0
ok fair enough, could you help me out with a few links or examples to using the math.random function. i am using netbeans. my instructor said i must use textpad...but he still lives in the prehistoric age.

i basically need to implement, math.random then generate random numbers in individual text fields, the user with the highest value wins.

im a technician/network engineer..not a coder.

Reply With Quote
  #4  
Old May 4th, 2008, 03:49 PM
tagmanadvance's Avatar
tagmanadvance tagmanadvance is offline
Kage Bunshin
Dev Shed Novice (500 - 999 posts)
 
Join Date: Aug 2005
Location: The Seven Seas Of Rhye
Posts: 779 tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level)tagmanadvance User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 5 Days 16 h 22 m 3 sec
Reputation Power: 180
Send a message via AIM to tagmanadvance Send a message via Yahoo to tagmanadvance Send a message via XFire to tagmanadvance
You change a text fields value using the .setText(<string>) method. As for a random, do you want it to be in a range, or just some number?

Reply With Quote
  #5  
Old May 5th, 2008, 05:16 AM
EldHawke EldHawke is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Location: Kenya
Posts: 27 EldHawke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 51 m 33 sec
Reputation Power: 0
thnx for the help :-)

i want it to do a math.random of values between 0(or)1 and 50 (so in essence a range of int's) then print them to indivdual boxes...is there a way i can link multiple objects to work on one array, so i can tell it

math.random (init function of random numbers)
while
(print text to (textboxset1.setText(math.random output));

cuz it will be a b**ch if i have to code for each individual box.

i am using net beans as my builder...then copy paste to textpad to see if it will run.

ok here is screen shot of my app (for some reason it wont display the pic..here is direct code to pic)

Code:
http://i272.photobucket.com/albums/jj191/EldHawke/applet.jpg




and here is my code
Code:
public class applet extends java.applet.Applet {
    
    /** Initializes the applet appplet */
    @Override
    public void init() {
        try {
            java.awt.EventQueue.invokeAndWait(new Runnable() {
                public void run() {
                    initComponents();
                    resize (322,136);

                                  }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }
    
    
    private void initComponents() {

        p1lbl = new javax.swing.JLabel();
        p2lbl = new javax.swing.JLabel();
        p1t1 = new javax.swing.JTextField();
        p2t1 = new javax.swing.JTextField();
        p2t2 = new javax.swing.JTextField();
        p1t2 = new javax.swing.JTextField();
        p2t3 = new javax.swing.JTextField();
        p1t3 = new javax.swing.JTextField();
        p2t14 = new javax.swing.JTextField();
        p1t4 = new javax.swing.JTextField();
        stbt = new javax.swing.JButton();
        p1lblt = new javax.swing.JLabel();
        p2lblt = new javax.swing.JLabel();
        p1t = new javax.swing.JTextField();
        p2t = new javax.swing.JTextField();

        p1lbl.setText("Player 1 :");

        p2lbl.setText("Player 2 :");

        p1t1.setEditable(false);

        p2t1.setEditable(false);

        p2t2.setEditable(false);

        p1t2.setEditable(false);

        p2t3.setEditable(false);

        p1t3.setEditable(false);

        p2t14.setEditable(false);

        p1t4.setEditable(false);

        stbt.setText("Start!");
        stbt.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                stbtActionPerformed(evt);
            }
        });

        p1lblt.setText("Player 1 Total :");

        p2lblt.setText("Player 2 Total :");

        p1t.setEditable(false);

        p2t.setEditable(false);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(p1lbl)
                    .addComponent(p2lbl))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p2t1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(p1t1, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(p2t2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(p1t2, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(stbt)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(p2t3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(p1t3, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(p1t4, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(p1lblt))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(p2t14, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(p2lblt)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(p2t, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(p1t, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(24, 24, 24)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(p1t1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(p1lbl))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(p2t1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(p2lbl)))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(p1t2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(p2t2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(p1t3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(p2t3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(p1t4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(p1lblt)
                            .addComponent(p1t, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(p2lblt)
                                .addComponent(p2t, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(p2t14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addGap(18, 18, 18)
                .addComponent(stbt)
                .addContainerGap(25, Short.MAX_VALUE))
        );
    }

    private void stbtActionPerformed(java.awt.event.ActionEvent evt) {                                     
       
        
        
        
    }                                    
    
    
    
    private javax.swing.JLabel p1lbl;
    private javax.swing.JLabel p1lblt;
    private javax.swing.JTextField p1t;
    private javax.swing.JTextField p1t1;
    private javax.swing.JTextField p1t2;
    private javax.swing.JTextField p1t3;
    private javax.swing.JTextField p1t4;
    private javax.swing.JLabel p2lbl;
    private javax.swing.JLabel p2lblt;
    private javax.swing.JTextField p2t;
    private javax.swing.JTextField p2t1;
    private javax.swing.JTextField p2t14;
    private javax.swing.JTextField p2t2;
    private javax.swing.JTextField p2t3;
    private javax.swing.JButton stbt;
   
    
}

Reply With Quote
  #6  
Old May 5th, 2008, 07:52 PM
tvc3mye's Avatar
tvc3mye tvc3mye is offline
Daniel Schildsky
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Location: KL, Malaysia.
Posts: 633 tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level)tvc3mye User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 6 Days 8 h 38 m 54 sec
Reputation Power: 201
Send a message via ICQ to tvc3mye Send a message via MSN to tvc3mye Send a message via Yahoo to tvc3mye
Use an ArrayList

You can add all the text boxes into an ArrayList and then use a loop to accomplish your task.
__________________
When the programming world turns decent, the real world will turn upside down.

Reply With Quote
  #7  
Old May 7th, 2008, 01:50 AM
EldHawke EldHawke is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2008
Location: Kenya
Posts: 27 EldHawke User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 51 m 33 sec
Reputation Power: 0
thnx for the help you guys, i managed to do it :-)

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming LanguagesJava Help > Homework - Please could i have some assistance


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT