Results 1 to 9 of 9
  1. #1
    MaN-GreaSe's Avatar
    MaN-GreaSe is offline Member
    Join Date
    Apr 2010
    Posts
    11
    Rep Power
    0

    Default Urgent Java Help Needed.

    [spoiler=Account Log]
    Java Code:
    package accountlog;
    
    /**
     *
     * @author RaFiKi
     */
    import java.awt.*; // for Container
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    import java.util.*;
    import java.io.*; // for IO
    
    
    class Accountlog extends JFrame {
      private JTextField firstNameField = new JTextField(10);
      private JTextField surnameField = new JTextField(10);
      private JTextField accountNumberField = new JTextField (10);
      private JPanel dataPanel = new JPanel();
      private UserInputPanel userInputPanel = new UserInputPanel();
      private OptionButtonPanel optionButtonPanel = new OptionButtonPanel();
      private JPanel dobPanel = new JPanel();
      private JPanel outputPanel = new JPanel();
      private JLabel outputLabel = new JLabel("");
      private JComboBox monthChoices;
      private String[] months = { "", "Jan", "Feb", "Mar", "Apr", "May",
                                  "Jun", "Jul", "Aug", "Sep", "Oct",
                                  "Nov", "Dec" };
      private JComboBox dateChoices;
      private String[] dates = { "", "01", "02", "03", "04", "05",
                                 "06", "07", "08", "09", "10",
                                 "11", "12", "13", "14", "15",
                                 "16", "17", "18", "19", "20",
                                 "21", "22", "23", "24", "25",
                                 "26", "27", "28", "29", "30", "31" };
      private JComboBox yearChoices;
      private String[] years = { "", "1992", "1993", "1994", "1995", "1996",
                                 "1997", "1998", "1999", "2000", "2001",
                                 "2002", "2003", "2004", "2005", "2006", "2007" };
      private JComboBox bankChoices;
      private String [] banks = {"", "HSBC", "Loyds TSB", "Barclays", "RSB",
                                    "Natwest" };
      private JTextArea dataArea;
      private JScrollPane scrollPane;
      private int year = 0;
      private int month = 0;
      private int date = 0;
      private int bank = 0;
    
      // window properties
      private static final int FRAMEWIDTH = 500;
      private static final int FRAMEHEIGHT = 450;
      private static final int FRAMEX = 350; // screen co-ordinates
      private static final int FRAMEY = 300;
      // PersonV4 object
      PersonV4 person = new PersonV4();
    
      public Accountlog() {
        Container guiContainer = getContentPane();
        guiContainer.setLayout(new BorderLayout());
        dataPanel.setLayout(new BorderLayout());
        dataPanel.add(userInputPanel, BorderLayout.NORTH);
        dobPanel.add(new JLabel("Date "));
        // instantiate combo box with dates array
        dateChoices = new JComboBox(dates);
        dateChoices.setSelectedIndex(0); // set default item
        // assign listener
        DateComboBoxListener dcbListener = new DateComboBoxListener();
        dateChoices.addItemListener(dcbListener);
        dobPanel.add(dateChoices);
        // process next two combo boxes and their listeners
        dobPanel.add(new JLabel("Month "));
        monthChoices = new JComboBox(months);
        monthChoices.setSelectedIndex(0);
        MonthComboBoxListener mcbListener = new MonthComboBoxListener();
        monthChoices.addItemListener(mcbListener);
        dobPanel.add(monthChoices);
        dobPanel.add(new JLabel("Year "));
        yearChoices = new JComboBox(years);
        yearChoices.setSelectedIndex(0);
        YearComboBoxListener ycbListener = new YearComboBoxListener();
        yearChoices.addItemListener(ycbListener);
        dobPanel.add(yearChoices);
        dataPanel.add(dobPanel, BorderLayout.SOUTH);
        dobPanel.add(new JLabel("Bank "));
        
        bankChoices = new JComboBox(banks);
        bankChoices.setSelectedIndex(0);
        BankComboBoxListener bcbListener = new BankComboBoxListener();
        bankChoices.addItemListener((ItemListener) bcbListener);
        dobPanel.add(bankChoices);
        // add remaining components
        guiContainer.add(dataPanel, BorderLayout.NORTH);
        guiContainer.add(optionButtonPanel, BorderLayout.CENTER);
        // initialise and assign text area
        dataArea = new JTextArea(10, 20);
        scrollPane = new JScrollPane(dataArea);
        outputPanel.add(scrollPane);
        guiContainer.add(outputPanel, BorderLayout.SOUTH);
      }
    
      private class UserInputPanel extends JPanel {
          public UserInputPanel() {
            setLayout(new GridLayout(2, 2, 15, 15)); //horizontal/vertical distances
            JLabel label = new JLabel("First Name", JLabel.RIGHT); //R1/C1
            add(label);
            add(firstNameField);  //R1/C2
            label = new JLabel("Surname", JLabel.RIGHT);  //R2/C1
            add(label);
            add(surnameField);  //R2/C2
            add (label);
             label = new JLabel ("Account Number", JLabel.RIGHT);
            add (accountNumberField); // R2/C2
    
    
          }
        }
    
    
    
      private class OptionButtonPanel extends JPanel {
          public OptionButtonPanel() {
              setLayout(new FlowLayout());
              OptionButtonListener optionButtonListener =
                      new OptionButtonListener();
              JButton displayButton = new JButton("Display");
              add(displayButton);
              displayButton.addActionListener(optionButtonListener);
              JButton quitButton = new JButton("Exit");
              add(quitButton);
              quitButton.addActionListener(optionButtonListener);
          }
       }
    
       private class OptionButtonListener implements ActionListener {
        public void actionPerformed(ActionEvent event) {
          String command = event.getActionCommand();
           if(command.equals("Display")) {
              // assign data extracted from window to person object
              person.setForename(firstNameField.getText());
              person.setSurname(surnameField.getText());
              person.setDOB(date, month, year);
              // extract data from person object and write to text area
              dataArea.append("Forename: ");
              dataArea.append(person.getForename());
              dataArea.append(" Surname: ");
              dataArea.append(person.getSurname());
              dataArea.append("\nDate of Birth: ");
              dataArea.append(Integer.toString(person.getDateOfBirth()) + '/' +
                          Integer.toString(person.getMonthOfBirth()) + '/' +
                          Integer.toString(person.getYearOfBirth()));
              dataArea.append("\nApproximate Age: " + Integer.toString(person.getAge()));
              dataArea.append("\n"); // new line
           }
           if(command.equals("Exit")) {
               int option = JOptionPane.showConfirmDialog(null, "Do you really want to exit?",
                                   "Confirm", JOptionPane.YES_NO_OPTION);
                if(option == JOptionPane.YES_OPTION) {
                    System.exit(0);
                }
           }
        }
       }
    
    
    
     
      private class MonthComboBoxListener implements ItemListener {
          public void itemStateChanged(ItemEvent event) {
           if(event.getStateChange() == ItemEvent.SELECTED) {
               int comboIndex = monthChoices.getSelectedIndex();
               month = translateMonth(months[comboIndex]);
            }
          }
    
          int translateMonth(String comboMonth) {
              int month = 0;
              if(comboMonth.equals("Jan"))
                  month = 1;
              else if(comboMonth.equals("Feb"))
                  month = 2;
              else if(comboMonth.equals("Mar"))
                  month = 3;
              else if(comboMonth.equals("Apr"))
                  month = 4;
              else if(comboMonth.equals("May"))
                  month = 5;
              else if(comboMonth.equals("Jun"))
                  month = 6;
              else if(comboMonth.equals("Jul"))
                  month = 7;
              else if(comboMonth.equals("Aug"))
                  month = 8;
              else if(comboMonth.equals("Sep"))
                  month = 9;
              else if(comboMonth.equals("Oct"))
                  month = 10;
              else if(comboMonth.equals("Nov"))
                  month = 11;
              else if(comboMonth.equals("Dec"))
                  month = 12;
              return month;
          }
      }
    
      private class DateComboBoxListener implements ItemListener {
          public void itemStateChanged(ItemEvent event) {
           if(event.getStateChange() == ItemEvent.SELECTED) {
               int comboIndex = dateChoices.getSelectedIndex();
               date = Integer.parseInt(dates[comboIndex]);
            }
          }
      }
    
      private class YearComboBoxListener implements ItemListener {
          public void itemStateChanged(ItemEvent event) {
           if(event.getStateChange() == ItemEvent.SELECTED) {
               int comboIndex = yearChoices.getSelectedIndex();
               year = Integer.parseInt(years[comboIndex]);
            }
          }
      }
     private class BankComboBoxListener implements ItemListener {
          public void itemStateChanged(ItemEvent event) {
           if(event.getStateChange() == ItemEvent.SELECTED) {
               int comboIndex = bankChoices.getSelectedIndex();
               year = Integer.parseInt(banks[comboIndex]);
           }
          }
     }
      public static void main(String[] args)  throws Exception
      {
        Accountlog testWindow = new Accountlog();
        testWindow.pack();
        testWindow.setVisible(true);
        testWindow.setSize(FRAMEWIDTH, FRAMEHEIGHT);
        testWindow.setLocation(FRAMEX, FRAMEY);
        testWindow.setTitle("Account Manager");
        testWindow.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      }
    }
    [/spoiler]
    [spoiler=PersonV4]
    Java Code:
     * To change this template, choose Tools | Templates
     * and open the template in the editor.
     */
    
    package accountlog;
    
    /**
     *
     * @author RaFiKi
     */
    import java.util.*;
    import java.io.Serializable;
    
    public class PersonV4 implements Serializable{ //so objects can be written to file
        String forename = null;
        String surname = null;
     
        int age = 0;
        GregorianCalendar calendar = new GregorianCalendar();
    
        /** Creates a new instance of Person */
        public PersonV4() {
        }
    
        public PersonV4(String fnm, String snm, String gen, int date, int mnth, int yr) {
            forename = fnm;
            surname = snm;
       
            setDOB(date, mnth, yr);
        }
    
        void setForename(String fnm){
            forename = fnm;
        }
    
        void setSurname(String snm){
            surname = snm;
        }
    
        
        
    
        private void setAge(){
            GregorianCalendar currentDate = new GregorianCalendar();
            Date date = new Date(); //set to today's date
            currentDate.setTime(date);
            age = currentDate.get(currentDate.YEAR) - calendar.get(calendar.YEAR);
        }
    
        void setDOB(int date, int month, int year){
            calendar.set(year, --month, date);//MONTH is 0 - 11
            setAge(); //call private class
        }
    
        String getForename(){
            return forename;
        }
    
        String getSurname(){
            return surname;
        }
    
    
        
    
        int getAge(){
            return(age);
        }
    
        int getYearOfBirth(){
            return(calendar.get(calendar.YEAR));
        }
    
        int getMonthOfBirth(){
            return(calendar.get(calendar.MONTH) + 1); //so user operates with 1 - 12
        }
    
        int getDateOfBirth(){
            return(calendar.get(calendar.DATE));
        }
    }
    [/spoiler]
    Above is the code to my current Project which i need to finish in a few hours. I've done much of it but there's a few tweaks i would like with some great help.
    1. I need The Banks combobox not to be in the same line as the Date and months etc. I want it to be below that and a little bit wider to make it look neat.
    2.Need the account name textfield to come under surname and perfectly aligned with the rest. and have its name.

    3. I need to implement this calculator program into the account manager program
    [spoiler=simple calculator]
    Java Code:
    package simplecalculator01;
    
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.border.*;
    
    /**
     * SimpleCalculator01.java implements a simplfied calculator in a single class.
     * It demonstrates event-driven programming. The user enters numeric data as
     * a text string into each of two text fields and selects a button labelled '+'
     * to trigger data to be retrieved from the two input fields and added together.
     * The result of the calculation is presented in a third text field.
     *
     * The window consists of a JFrame upon which various components are placed. The
     * window has a BorderLayout(). An empty JPanel is placed at the top of the
     * window (BorderLayout.NORTH). This is simply to improve the appearance of the
     * layout. Another JPanel, called inputPanel, is placed in the middle of the
     * window (BorderLayout.CENTER). This panel has a GridLayout: three rows and
     * two columns. Three JLabels and associated JTextField objects are placed on
     * the panel. The first two JTextfields are for the user to enter data; the
     * third outputs the result of the addition. A third JPanel,
     * operationButtonPanel, is placed at the bottom of the window
     * (BorderLayout.SOUTH). A JButton, plus, is added to the panel.
     *
     * A class, OperationButtonListener, is created. This implements Java's Action
     * Listener class and it is used to respond to user input. An object of this
     * class is assigned to the plus button. The instructions within the listener
     * are carried out whenever the plus button is clicked.
     *
     * Within the listener the simple addition takes place and the result is output
     * in the window labeled '='. There is no attempt to trap errors in this version
     * of the program.
     *
     *
    
     */
    public class SimpleCalculator01 extends JFrame{
          private Container guiContainer;
          private String title = "Simple Calculator Version 1";
          // window components
          // input/output labels and text fields
          private JLabel inputXLabel = new JLabel("              Input X");
          private JTextField inputXTextField = new JTextField(15);
          private JLabel inputYLabel = new JLabel("              Input Y");
          private JTextField inputYTextField = new JTextField(15);
          private JLabel outputLabel = new JLabel("                  = ");
          private JTextField outputTextField = new JTextField(15);
          // display panels
          private JPanel emptyPanel = new JPanel();
          private JPanel inputPanel = new JPanel();
          private JPanel operationButtonPanel = new JPanel();
          // button
          private JButton plus = new JButton("+");
          // input values
          private String xValue = "";
          private String yValue = "";
    
          // window properties
          private static final int FRAMEWIDTH = 350;
          private static final int FRAMEHEIGHT = 150;
          private static final int FRAMEX = 200; // screen co-ordinates
          private static final int FRAMEY = 150;
    
          // initialise total
          double total = 0;
    
    
        /** Creates a new instance of SimpleCalculator01 */
        public SimpleCalculator01() {
            guiContainer = getContentPane();
            setTitle(title);
            // add panels to frame using BorderLayout
            guiContainer.add(emptyPanel, BorderLayout.NORTH);
            guiContainer.add(inputPanel, BorderLayout.CENTER);
            guiContainer.add(operationButtonPanel, BorderLayout.SOUTH);
    
            inputPanel.setLayout(new GridLayout(3,2));
            // add components to panels
            inputPanel.add(inputXLabel);
            inputPanel.add(inputXTextField);
            inputPanel.add(inputYLabel);
            inputPanel.add(inputYTextField);
            inputPanel.add(outputLabel);
            inputPanel.add(outputTextField);
            // add button to panel
            operationButtonPanel.add(plus);
            // create a listener
            OperationButtonListener oBListener = new OperationButtonListener();
            // assign listener to button
            plus.addActionListener(oBListener);
        }
    
        /** class to handle user interaction
         * user enters numbers as strings into text fields and selects operator
         * to carry out calculations. As there's only one operator, plus, we only
         * deal with addition. The values int the text fields are retrieved
         * and added together. The result is output in outputTextField
         *
         **/
        private class OperationButtonListener implements ActionListener  {
          public void actionPerformed(ActionEvent event) {
           String choice = event.getActionCommand();
           if(choice.equals("+")) {
               // get data
               xValue = inputXTextField.getText();
               yValue = inputYTextField.getText();
               // compute total - no error checking if invalid entries
               // convert entry strings to doubles
               total = (Double.parseDouble(xValue) + Double.parseDouble(yValue));
               // output result
               outputTextField.setText(Double.toString(total));
               }
           }
      }
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            // create, size, and position window
            SimpleCalculator01 sc01 =
                     new SimpleCalculator01();
            sc01.pack();
            sc01.setVisible(true);
            sc01.setSize(FRAMEWIDTH, FRAMEHEIGHT);
            sc01.setLocation(FRAMEX, FRAMEY);
            sc01.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        }
    
    }
    4. Finally i want everything to come back and to be displayed after the user clicks display. Thanks in advance i'll be watching this closely as i need to finish the prject in a few hours for the deadline. Please help.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    I think you'll have a better chance of getting help though if you try to implement what you need and then ask us to help you with your code. Just posting "I need..." and giving volunteers a deadline (at least in my experience) doesn't work here, and honestly, nor should it. I wish you much luck on your project.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    As for these problems:
    1. I need The Banks combobox not to be in the same line as the Date and months etc. I want it to be below that and a little bit wider to make it look neat.
    2.Need the account name textfield to come under surname and perfectly aligned with the rest. and have its name.
    Please have a look at the layout manager tutorial as it will help guide you to the layouts that are available to you:

    Lesson: Laying Out Components Within a Container (The Java™ Tutorials > Creating a GUI With JFC/Swing)

    You also might consider downloading and using the MigLayout which some say is just as powerful and easier to use than the GridBagLayout.

    Again much luck!

  4. #4
    MaN-GreaSe's Avatar
    MaN-GreaSe is offline Member
    Join Date
    Apr 2010
    Posts
    11
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    I think you'll have a better chance of getting help though if you try to implement what you need and then ask us to help you with your code. Just posting "I need..." and giving volunteers a deadline (at least in my experience) doesn't work here, and honestly, nor should it. I wish you much luck on your project.
    Umm Okay sorry to sound so demanding. My code i've already written it. Its just when i run the prog things aren't where i want them to be. If you run the code. You'll realize that the account name text field is way off and it doesn't even have its label on the UI. How can i rectify this? And make it come under surname ?
    The second query is also a similar issue.. how do i make the Combobox for bank to be under the other combo boxes instead of alongside them?

  5. #5
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    On going through your code I see you're trying to add a JLabel called "label" twice, and this won't work. Only the second add will show:

    Java Code:
            JLabel label = new JLabel("First Name", JLabel.RIGHT); // create label object 1
            add(label);  // adding label object 1 -- this is OK
            add(firstNameField);  //R1/C2
            label = new JLabel("Surname", JLabel.RIGHT);  // create label object 2
            add(label);  // adding label object 2  -- this would be OK if not for below
            add(surnameField);  //R2/C2
            add (label); // adding label object 2 *** again *** -- this is not OK

  6. #6
    MaN-GreaSe's Avatar
    MaN-GreaSe is offline Member
    Join Date
    Apr 2010
    Posts
    11
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    On going through your code I see you're trying to add a JLabel called "label" twice, and this won't work. Only the second add will show:

    Java Code:
            JLabel label = new JLabel("First Name", JLabel.RIGHT); // create label object 1
            add(label);  // adding label object 1 -- this is OK
            add(firstNameField);  //R1/C2
            label = new JLabel("Surname", JLabel.RIGHT);  // create label object 2
            add(label);  // adding label object 2  -- this would be OK if not for below
            add(surnameField);  //R2/C2
            add (label); // adding label object 2 *** again *** -- this is not OK
    I rectified that but i still have a problem with the fields not being aligned.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by MaN-GreaSe View Post
    I rectified that but i still have a problem with the fields not being aligned.
    You need to play with and use different layout managers. Which ones? It depends on your needs. I'll give you this demo of a GridBagLayout, one of my least favorites, but one that can work if you put enough into using it:

    Java Code:
    import java.awt.BorderLayout;
    import java.awt.GridBagConstraints;
    import java.awt.GridBagLayout;
    import java.awt.Insets;
    
    import javax.swing.*;
    
    public class AccountDemo extends JPanel {
       private static final int FIELD_SIZE = 15;
       private JTextField firstNameField = new JTextField(FIELD_SIZE);
       private JTextField surnameField = new JTextField(FIELD_SIZE);
       private JTextField accountNumberField = new JTextField(FIELD_SIZE);
       
       public AccountDemo() {
          setLayout(new BorderLayout());
          add(new UserInputPanel());
       }
       
       private static void createAndShowUI() {
          JFrame frame = new JFrame("Account Demo");
          frame.getContentPane().add(new AccountDemo());
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.pack();
          frame.setLocationRelativeTo(null);
          frame.setVisible(true);
       }
    
       public static void main(String[] args) {
          java.awt.EventQueue.invokeLater(new Runnable() {
             public void run() {
                createAndShowUI();
             }
          });
       }
       
       private class UserInputPanel extends JPanel {
          public UserInputPanel() {
             int eb = 15;
             setBorder(BorderFactory.createEmptyBorder(eb, eb, eb, eb));
             setLayout(new GridBagLayout());
             GridBagConstraints gbc = createGBC(0, 0, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH);
             add(new JLabel("First Name", JLabel.LEFT), gbc);
             gbc = createGBC(1, 0, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL);
             add(firstNameField, gbc);
             gbc = createGBC(0, 1, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH);
             add(new JLabel("Surname", JLabel.LEFT), gbc);
             gbc = createGBC(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL);
             add(surnameField, gbc);
             gbc = createGBC(0, 2, 1, 1, 0.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH);
             add(new JLabel("Account Number", JLabel.LEFT), gbc);
             gbc = createGBC(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL);
             add(accountNumberField, gbc);
          }
    
          private GridBagConstraints createGBC(int gridx, int gridy, int gridwidth, int gridheight,
                   double weightx, double weighty, int anchor, int fill) {
             GridBagConstraints gbc = new GridBagConstraints();
             gbc.gridx = gridx;
             gbc.gridy = gridy;
             gbc.gridwidth = gridwidth;
             gbc.gridheight = gridheight;
             gbc.weightx = weightx;
             gbc.weighty = weighty;
             gbc.anchor = anchor;
             gbc.fill = fill;
             
             int insets = 5;
             if (anchor == GridBagConstraints.WEST) {
                gbc.insets = new Insets(insets, 0, insets, 3*insets);
             }
             else {
                gbc.insets = new Insets(insets, 0, insets, 0);
             }
             return gbc;
          }
       }
    }
    Last edited by Fubarable; 04-22-2010 at 10:55 PM. Reason: changed weightx of JLabel to 0.0

  8. #8
    MaN-GreaSe's Avatar
    MaN-GreaSe is offline Member
    Join Date
    Apr 2010
    Posts
    11
    Rep Power
    0

    Default

    Java Code:
    public class IDEWindow01 extends javax.swing.JFrame {
        String genderString = "";
        int date = 0;
    
        /** Creates new form IDEWindow01 */
        public IDEWindow01() {
            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() {
    
            Text = new javax.swing.JTextField();
            Firstname = new javax.swing.JLabel();
            jTextField1 = new javax.swing.JTextField();
            Surname = new javax.swing.JLabel();
            Male = new javax.swing.JRadioButton();
            Female = new javax.swing.JRadioButton();
            jcomboboxdate = new javax.swing.JComboBox();
            Date = new javax.swing.JLabel();
            jComboboxmonth = new javax.swing.JComboBox();
            Month = new javax.swing.JLabel();
            jComboBoxYear = new javax.swing.JComboBox();
            Year = new javax.swing.JLabel();
            Display = new javax.swing.JButton();
            Exit = new javax.swing.JButton();
            jPanel1 = new javax.swing.JPanel();
            jScrollPane1 = new javax.swing.JScrollPane();
            jTextArea1 = new javax.swing.JTextArea();
    
            setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
    
            Firstname.setText("First name");
    
            Surname.setText("Surname ");
    
            Male.setText("Male");
            Male.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    MaleActionPerformed(evt);
                }
            });
    
            Female.setText("Female");
            Female.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    FemaleActionPerformed(evt);
                }
            });
    
            jcomboboxdate.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<Empty>", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
            jcomboboxdate.addItemListener(new java.awt.event.ItemListener() {
                public void itemStateChanged(java.awt.event.ItemEvent evt) {
                    jcomboboxdateItemStateChanged(evt);
                }
            });
    
            Date.setText("Date");
    
            jComboboxmonth.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<Empty>", "JAN            ", "FEB           ", "MAR              ", "APR              ", "MAY                ", "JUN            ", "JUL              ", "AUG             ", "SEP          ", "OCT           ", "NOV          ", "DEC " }));
            jComboboxmonth.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboboxmonthActionPerformed(evt);
                }
            });
    
            Month.setText("Month");
    
            jComboBoxYear.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "<Empty>", "1970", "1971", "1972", "1973", "1974", "1975", "1976", "1977", "1978", "1979", "1980", "1981", "1982", "1983", "1984", "1985", "1986", "1987", "1988", "1989", "1990", "1991", "1992", "1993", "1994", "1995", " " }));
            jComboBoxYear.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    jComboBoxYearActionPerformed(evt);
                }
            });
    
            Year.setText("Year");
    
            Display.setText("Display");
            Display.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    DisplayActionPerformed(evt);
                }
            });
    
            Exit.setText("Exit");
            Exit.addActionListener(new java.awt.event.ActionListener() {
                public void actionPerformed(java.awt.event.ActionEvent evt) {
                    ExitActionPerformed(evt);
                }
            });
    
            javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
            jPanel1.setLayout(jPanel1Layout);
            jPanel1Layout.setHorizontalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 209, Short.MAX_VALUE)
            );
            jPanel1Layout.setVerticalGroup(
                jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGap(0, 122, Short.MAX_VALUE)
            );
    
            jTextArea1.setColumns(20);
            jTextArea1.setRows(5);
            jScrollPane1.setViewportView(jTextArea1);
    
            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(103, Short.MAX_VALUE)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(Firstname, javax.swing.GroupLayout.PREFERRED_SIZE, 54, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addGap(43, 43, 43))
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(Surname, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                    .addGap(48, 48, 48)))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addComponent(jTextField1, javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(Text, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 83, Short.MAX_VALUE))
                            .addGap(19, 19, 19))
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(Female)
                            .addGap(11, 11, 11)
                            .addComponent(Male)
                            .addContainerGap())
                        .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                            .addComponent(jcomboboxdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(10, 10, 10)
                            .addComponent(Date)
                            .addGap(24, 24, 24)
                            .addComponent(jComboboxmonth, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(Month)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(jComboBoxYear, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                            .addComponent(Year)
                            .addGap(24, 24, 24))))
                .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createSequentialGroup()
                            .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addGap(24, 24, 24))
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                            .addGap(183, 183, 183)
                            .addComponent(Display)
                            .addGap(65, 65, 65)
                            .addComponent(Exit)))
                    .addContainerGap(107, Short.MAX_VALUE))
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addGap(31, 31, 31)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(Text, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(Firstname))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(Surname))
                    .addGap(35, 35, 35)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(Male)
                        .addComponent(Female))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jComboBoxYear, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(Month)
                        .addComponent(Date)
                        .addComponent(jcomboboxdate, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jComboboxmonth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(Year))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(Display)
                        .addComponent(Exit))
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addContainerGap(117, Short.MAX_VALUE))
            );
    
            pack();
        }// </editor-fold>                        
    
        private void FemaleActionPerformed(java.awt.event.ActionEvent evt) {                                       
            // TODO add your handling code here:
           genderString= "female";
    
        }                                      
    
        private void jComboboxmonthActionPerformed(java.awt.event.ActionEvent evt) {                                               
            // TODO add your handling code here:
        }                                              
    
        private void jComboBoxYearActionPerformed(java.awt.event.ActionEvent evt) {                                              
            // TODO add your handling code here:
        }                                             
    
        private void MaleActionPerformed(java.awt.event.ActionEvent evt) {                                     
            // TODO add your handling code here:
        }                                    
    
        private void DisplayActionPerformed(java.awt.event.ActionEvent evt) {                                        
            // TODO add your handling code here:
        }                                       
    
        private void ExitActionPerformed(java.awt.event.ActionEvent evt) {                                     
            // TODO add your handling code here:
        }                                    
    
        private void jcomboboxdateItemStateChanged(java.awt.event.ItemEvent evt) {                                               
            // TODO add your handling code here:
            if (evt.getStateChange()== evt.SELECTED) {
                int comboIndex = jcomboboxdate.getSelectedIndex ();
                String s = (String) jcomboboxdate.getItemAt (comboIndex);
                date = Integer.parseInt (s);
    
    
    
        }
        }                                              
    
        /**
        * @param args the command line arguments
        */
        public static void main(String args[]) {
            java.awt.EventQueue.invokeLater(new Runnable() {
                public void run() {
                    new IDEWindow01().setVisible(true);
                }
            });
        }
    
        // Variables declaration - do not modify                     
        private javax.swing.JLabel Date;
        private javax.swing.JButton Display;
        private javax.swing.JButton Exit;
        private javax.swing.JRadioButton Female;
        private javax.swing.JLabel Firstname;
        private javax.swing.JRadioButton Male;
        private javax.swing.JLabel Month;
        private javax.swing.JLabel Surname;
        private javax.swing.JTextField Text;
        private javax.swing.JLabel Year;
        private javax.swing.JComboBox jComboBoxYear;
        private javax.swing.JComboBox jComboboxmonth;
        private javax.swing.JPanel jPanel1;
        private javax.swing.JScrollPane jScrollPane1;
        private javax.swing.JTextArea jTextArea1;
        private javax.swing.JTextField jTextField1;
        private javax.swing.JComboBox jcomboboxdate;
        // End of variables declaration                   
    
    }
    How hard would it be to copy the code from Account Log into the IDE window? Because its much easier in the IDE window to design the UI.

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default

    Quote Originally Posted by MaN-GreaSe View Post
    How hard would it be to copy the code from Account Log into the IDE window? Because its much easier in the IDE window to design the UI.
    I've no idea as I don't use NetBeans code-generation.

Similar Threads

  1. Urgent Help Needed
    By Cid17 in forum New To Java
    Replies: 10
    Last Post: 07-03-2009, 02:42 PM
  2. Urgent Help needed!
    By mlwong in forum New To Java
    Replies: 0
    Last Post: 03-19-2009, 08:51 AM
  3. hi help needed, this is urgent
    By msciriha in forum NetBeans
    Replies: 1
    Last Post: 02-07-2009, 06:16 PM
  4. Urgent help needed here pls!!
    By Manfizy in forum NetBeans
    Replies: 5
    Last Post: 01-28-2009, 07:38 AM
  5. Urgent Java programmer needed.
    By KevinG in forum Jobs Offered
    Replies: 5
    Last Post: 04-23-2008, 04:02 AM

Posting Permissions

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