Page 1 of 2 12 LastLast
Results 1 to 20 of 23
  1. #1
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Lightbulb Encoding Circuits for an App

    Hi,

    I'm having trouble hard-coding exercises into a Circuit for a Java App. I am using JFrame forms to do so. I am using the NetBeans program.

    Any help will be very much appreciated.

    Kind Regards,

    aboyse1990

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    Do you have any java programming questions about your code?
    Post your code and ask your questions about it.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    code
    /*
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    */

    /*
    * KettleCircuit.java
    *
    * Created on 12-Nov-2014, 09:03:53
    */

    package javaproject;

    /**
    *
    * @author User
    */
    public class KettleCircuit extends javax.swing.JFrame {

    /** Creates new form KettleCircuit */
    public KettleCircuit() {
    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() {

    jColorChooser1 = new javax.swing.JColorChooser();
    jColorChooser2 = new javax.swing.JColorChooser();
    jFrame1 = new javax.swing.JFrame();
    jPanel1 = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jPanel3 = new javax.swing.JPanel();
    jComboBox1 = new javax.swing.JComboBox();
    jComboBox3 = new javax.swing.JComboBox();
    jComboBox4 = new javax.swing.JComboBox();
    jButton1 = new javax.swing.JButton();
    jLabel1 = new javax.swing.JLabel();
    jLabel2 = new javax.swing.JLabel();

    javax.swing.GroupLayout jFrame1Layout = new javax.swing.GroupLayout(jFrame1.getContentPane());
    jFrame1.getContentPane().setLayout(jFrame1Layout);
    jFrame1Layout.setHorizontalGroup(
    jFrame1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 400, Short.MAX_VALUE)
    );
    jFrame1Layout.setVerticalGroup(
    jFrame1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 300, Short.MAX_VALUE)
    );

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout.setHorizontalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 100, Short.MAX_VALUE)
    );
    jPanel1Layout.setVerticalGroup(
    jPanel1Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 100, Short.MAX_VALUE)
    );

    javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
    jPanel2.setLayout(jPanel2Layout);
    jPanel2Layout.setHorizontalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 100, Short.MAX_VALUE)
    );
    jPanel2Layout.setVerticalGroup(
    jPanel2Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 100, Short.MAX_VALUE)
    );

    javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
    jPanel3.setLayout(jPanel3Layout);
    jPanel3Layout.setHorizontalGroup(
    jPanel3Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 100, Short.MAX_VALUE)
    );
    jPanel3Layout.setVerticalGroup(
    jPanel3Layout.createParallelGroup(javax.swing.Grou pLayout.Alignment.LEADING)
    .addGap(0, 100, Short.MAX_VALUE)
    );

    setDefaultCloseOperation(javax.swing.WindowConstan ts.EXIT_ON_CLOSE);

    jComboBox1.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Circuits", "Circuit One (Beginner)", "Circuit Two (Novice)", "Circuit Three (Amateur)", "Circuit Four (Intermediate", "Circuit Five (Expert)" }));
    jComboBox1.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jComboBox1ActionPerformed(evt);
    }
    });

    jComboBox3.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Minutes", "5 Minutes", "8 Minutes ", "10 Minutes ", "12 Minutes ", "15 Minutes", "20 Minutes " }));

    jComboBox4.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Test Yourself", "Jerk", "Snatch", "Long Cycle" }));
    jComboBox4.addActionListener(new java.awt.event.ActionListener() {
    public void actionPerformed(java.awt.event.ActionEvent evt) {
    jComboBox4ActionPerformed(evt);
    }
    });

    jButton1.setText("GO");

    jLabel1.setText("Twitter");

    jLabel2.setText("Facebook");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.TRAILING)
    .addComponent(jButton1)
    .addGroup(javax.swing.GroupLayout.Alignment.LEADIN G, layout.createParallelGroup(javax.swing.GroupLayout .Alignment.TRAILING)
    .addGroup(layout.createSequentialGroup()
    .addComponent(jLabel1)
    .addGap(26, 26, 26)
    .addComponent(jLabel2))
    .addGroup(javax.swing.GroupLayout.Alignment.LEADIN G, layout.createSequentialGroup()
    .addGap(28, 28, 28)
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.LEADING, false)
    .addComponent(jComboBox4, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jComboBox3, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
    .addComponent(jComboBox1, javax.swing.GroupLayout.Alignment.TRAILING, 0, 335, Short.MAX_VALUE)))))
    .addContainerGap(37, Short.MAX_VALUE))
    );
    layout.setVerticalGroup(
    layout.createParallelGroup(javax.swing.GroupLayout .Alignment.LEADING)
    .addGroup(layout.createSequentialGroup()
    .addContainerGap()
    .addGroup(layout.createParallelGroup(javax.swing.G roupLayout.Alignment.BASELINE)
    .addComponent(jLabel1)
    .addComponent(jLabel2))
    .addGap(31, 31, 31)
    .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(31, 31, 31)
    .addComponent(jComboBox3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(32, 32, 32)
    .addComponent(jComboBox4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
    .addGap(35, 35, 35)
    .addComponent(jButton1)
    .addContainerGap(63, Short.MAX_VALUE))
    );

    pack();
    }// </editor-fold>

    private void jComboBox1ActionPerformed(java.awt.event.ActionEve nt evt) {
    // TODO add your handling code here:
    }

    private void jComboBox4ActionPerformed(java.awt.event.ActionEve nt 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 KettleCircuit().setVisible(true);
    }
    });
    }

    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JColorChooser jColorChooser1;
    private javax.swing.JColorChooser jColorChooser2;
    private javax.swing.JComboBox jComboBox1;
    private javax.swing.JComboBox jComboBox3;
    private javax.swing.JComboBox jComboBox4;
    private javax.swing.JFrame jFrame1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    // End of variables declaration

    }
    /code

    How do I encode exercises into each Circuit?

    As well as a countdown timer, but help with the Circuits will do for now...

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    encode exercises into each Circuit
    What does that mean? Can you translate that into something related to the java language?

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE GOES HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

  5. #5
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Encoding Circuits for an App

    Well I hope someone here knows what an "exercise" is in the context of your question. I certainly do not.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  6. #6
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    An exercise is a workout routine like squatting or deadlifting....

  7. #7
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    5,114
    Rep Power
    12

    Default Re: Encoding Circuits for an App

    I'd then have to ask what a "circuit" is but I can see from your unformatted generated code that it is like a workout schedule tied to a specific difficulty level.

    So your real question is how to create a combo box with pre-defined values then? I mean who cares that they are "exercises", you have some selection of values and you want to make them selectable. Right?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    Ok, that's a start.
    what is a circuit?
    And what does encoding mean?

    What is the purpose of the program?
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    A Circuit is a pre-defined number of exercises. Like Circuit One (Snatch, Box Jumps, Jerk, Single Arm Swing)

    Circuit One will be a set of clickable exercises, like when you click Circuit One, you will get a set of predetermined exercises.

    For my local Gym

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    Are you saying:
    there should be two lists of items for the user to select from.
    The first list has a predetermined content.
    The second list's content will be determined from what is selected in the first list.
    If you don't understand my response, don't ignore it, ask a question.

  11. #11
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    Yeah Circuits is hard-coded in with set exercises and then minutes and that should be a countdown timer, we will leave test yourself for the minute....

  12. #12
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    should be a countdown timer
    Does the user get to say when the timer should start counting?
    Can the timer start before the user has chosen something from the two lists?

    Can you make a complete list of the events that should happen when a user starts the program?
    What does the user do first?
    What does the program do in response to that?
    What does the user do next?
    What does the program do?
    ... Continue adding items to this list up to when the program should exit
    Last edited by Norm; 11-12-2014 at 04:18 PM.
    If you don't understand my response, don't ignore it, ask a question.

  13. #13
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    The user will pick the Circuit they want, the minute limit they want and then the program will start a countdown from the set time limit and the user will go through the exercises in the Circuit.

  14. #14
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    program will start a countdown
    Does the timer start immediately after the user selects the minutes? Or is there a Start button?

    What does the program display while the timer is running? Is there a button for the user to stop the timer?
    Will the timer stop when it gets to 0?
    If you don't understand my response, don't ignore it, ask a question.

  15. #15
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    There will be a start button, it will display each exercise with number of times you have to do the exercise... E.g. Swing x 10. There will be a pause button and yes it will stop at zero.

  16. #16
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    Ok, that looks like a start on the program's design.

    What steps have you completed? What step are you having problems with? Work on the steps one at a time: code, compile, execute, check results, repeat until working and then move to the next step.

    NOTE: Be sure to wrap any posted code in code tags.
    If you don't understand my response, don't ignore it, ask a question.

  17. #17
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    Right I have the screens right. People can choose the Circuit, Minute limit press go. I just need Exercises within the Circuits a countdown timer to start anyway.

    The rest will come together...

  18. #18
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    I just need Exercises within the Circuits
    Does that mean the code needs to put items into the second list now that the user has selected an item in the first list?

    Please try to use java programming terms. Exercises and Circuits are not part of java.
    If you don't understand my response, don't ignore it, ask a question.

  19. #19
    aboyse1990 is offline Member
    Join Date
    Nov 2014
    Posts
    61
    Rep Power
    0

    Default Re: Encoding Circuits for an App

    Firstly, how do i hard-code items into the first menu

  20. #20
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    20,003
    Rep Power
    33

    Default Re: Encoding Circuits for an App

    One way would be to use a String array with the values:
    Java Code:
    String[] aStrA = {"asd", "der"};  // define String array with initial values
    If you don't understand my response, don't ignore it, ask a question.

Page 1 of 2 12 LastLast

Similar Threads

  1. xml encoding problem.
    By sbutt in forum XML
    Replies: 0
    Last Post: 07-11-2012, 12:14 PM
  2. Url encoding
    By RaviGupta0709 in forum Web Frameworks
    Replies: 0
    Last Post: 08-23-2011, 09:02 AM
  3. Problem with Encoding
    By agajantorayev in forum Advanced Java
    Replies: 7
    Last Post: 02-28-2011, 08:47 PM
  4. Encoding Problems in JRE
    By xlomo in forum New To Java
    Replies: 3
    Last Post: 02-28-2011, 10:13 AM
  5. Some help with encoding...
    By nm123 in forum Networking
    Replies: 0
    Last Post: 04-15-2008, 01:22 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •