Java tutor needed BADLY

Reply

Join Date: May 2006
Posts: 18
Reputation: korbynlehr is an unknown quantity at this point 
Solved Threads: 0
korbynlehr's Avatar
korbynlehr korbynlehr is offline Offline
Newbie Poster

Java tutor needed BADLY

 
0
  #1
Jul 15th, 2006
I am looking for someone that can help me online for an hour or so maybe a few times for the next few weeks that can help me understand what I am supposed to do for my class programs. I am not looking for someone to do them for me but to be a guide and tutor.
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 71
Reputation: indienick is an unknown quantity at this point 
Solved Threads: 2
indienick's Avatar
indienick indienick is offline Offline
Junior Poster in Training

Re: Java tutor needed BADLY

 
0
  #2
Jul 21st, 2006
I might suggest picking yourself up a copy of 'Beginning Programming with Java for Dummies"...and if you're feeling particularily sassy, O'Reilly Java In A Nutshell. It's all the reference you'll ever need (except for javax.swing.* and java.awt.* - which are briefly covered in the Dummies book).

Perhaps I could be of some assistance, though. Just post the issue you're having here, on this thread, and I'll help you best I can.
Angel-headed hipsters burning for the ancient heavenly connection, to the starry dynamo in the machinery of the night.
-Ginsburg

Don't tell me to "google it" - I already have.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 2
Reputation: bharatchhajer is an unknown quantity at this point 
Solved Threads: 0
bharatchhajer bharatchhajer is offline Offline
Newbie Poster

Re: Java tutor needed BADLY

 
0
  #3
Jul 22nd, 2006
Originally Posted by korbynlehr
I am looking for someone that can help me online for an hour or so maybe a few times for the next few weeks that can help me understand what I am supposed to do for my class programs. I am not looking for someone to do them for me but to be a guide and tutor.
I am an Architect who is 10 years experienced in Software Development. Its very good that you are seeking help for class programs rather than getting them done as that's the right thing to do. I would be willing to be guide and tutor for $15 an hour. You can choose the time between 6pm and 10 pm EST and the days you want.

Thanks,
Bharat.
Phone 203 428 4124
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 2,108
Reputation: server_crash is on a distinguished road 
Solved Threads: 18
server_crash server_crash is offline Offline
Postaholic

Re: Java tutor needed BADLY

 
0
  #4
Jul 22nd, 2006
Pick up a book and start reading it. Then, when you have a problem try to figure it out yourself. If you can't after some time get it solved, then post back to a forum. Paying for a tutor is a terrible idea. As a programmer you need to solve problems on your own. Learn how to look up information and search google.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Java tutor needed BADLY

 
0
  #5
Jul 22nd, 2006
Originally Posted by bharatchhajer
I am an Architect who is 10 years experienced in Software Development. Its very good that you are seeking help for class programs rather than getting them done as that's the right thing to do. I would be willing to be guide and tutor for $15 an hour. You can choose the time between 6pm and 10 pm EST and the days you want.

Thanks,
Bharat.
Phone 203 428 4124
By any definition, that's not the right thing to do. If they're school/college/uni class programs, (and not just program classes) maybe you should consider a different course.

Still; I earnt a lot doing other people's schoolwork for money, and on the upside, It taught me and my clients valuable business skills.

Matt
Reply With Quote Quick reply to this message  
Join Date: May 2006
Posts: 18
Reputation: korbynlehr is an unknown quantity at this point 
Solved Threads: 0
korbynlehr's Avatar
korbynlehr korbynlehr is offline Offline
Newbie Poster

Re: Java tutor needed BADLY

 
0
  #6
Jul 24th, 2006
The problem I am having is getting the last part working. The timer is the part I am having trouble with which is the last code I submitted.





  1. import java.awt.Frame;
  2. import java.awt.event.WindowAdapter;
  3. import java.awt.event.WindowEvent;
  4. import javax.swing.UIManager;
  5. import java.awt.Dimension;
  6. import java.awt.Toolkit;
  7. public class ScoreboardApp
  8. {
  9. public ScoreboardApp()
  10. {
  11. Frame frame = new ScoreboardFrame();
  12. Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
  13. Dimension frameSize = frame.getSize();
  14. if (frameSize.height > screenSize.height)
  15. {
  16. frameSize.height = screenSize.height;
  17. }
  18. if (frameSize.width > screenSize.width)
  19. {
  20. frameSize.width = screenSize.width;
  21. }
  22. frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2);
  23. frame.addWindowListener(new WindowAdapter()
  24. {
  25. public void windowClosing(WindowEvent e)
  26. {
  27. System.exit(0);
  28. }
  29. });
  30. frame.setVisible(true);
  31. }
  32. public static void main(String[] args)
  33. {
  34. try
  35. {
  36. UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
  37. }
  38. catch(Exception e)
  39. {
  40. e.printStackTrace();
  41. }
  42. new ScoreboardApp();
  43. }
  44. }

  1. import javax.swing.JFrame;
  2. import javax.swing.JMenu;
  3. import javax.swing.JMenuBar;
  4. import javax.swing.JMenuItem;
  5. import java.awt.Dimension;
  6. import java.awt.event.ActionEvent;
  7. import java.awt.event.ActionListener;
  8. import java.awt.GridBagLayout;
  9. import java.awt.BorderLayout;
  10. import javax.swing.JPanel;
  11. import java.awt.Color;
  12. import javax.swing.JTextField;
  13. import java.awt.GridBagConstraints;
  14. import java.awt.Insets;
  15. import java.awt.Font;
  16. import javax.swing.JLabel;
  17. import javax.swing.JButton;
  18. import javax.swing.*;
  19. import java.text.*;
  20. public class ScoreboardFrame extends JFrame
  21. {
  22. JMenuItem menuFileExit = new JMenuItem();
  23. JMenu menuFile = new JMenu();
  24. JMenuBar menuBar1 = new JMenuBar();
  25. BorderLayout borderLayout1 = new BorderLayout();
  26. JPanel panelScoreboard = new JPanel();
  27. GridBagLayout gridBagLayout1 = new GridBagLayout();
  28. JTextField txtHomeScore = new JTextField();
  29. JLabel jLabel1 = new JLabel();
  30. JLabel jLabel2 = new JLabel();
  31. JTextField txtGuests = new JTextField();
  32. JTextField txtTime = new JTextField();
  33. JPanel panelButtons = new JPanel();
  34. JButton btnTimeControl = new JButton();
  35. JButton btnHomeAdd = new JButton();
  36. JButton btnHomeSub = new JButton();
  37. JButton btnGuestsAdd = new JButton();
  38. JButton btnGuestsSub = new JButton();
  39. DecimalFormat df = new DecimalFormat("00");
  40. int homeScore = 0;
  41. int guestsScore = 0;
  42. public ScoreboardFrame()
  43. {
  44. try
  45. {
  46. jbInit();
  47. }
  48. catch(Exception e)
  49. {
  50. e.printStackTrace();
  51. }
  52. }
  53. private void jbInit() throws Exception
  54. {
  55. this.setJMenuBar(menuBar1);
  56. this.getContentPane().setLayout(borderLayout1);
  57. this.setSize(new Dimension(534, 300));
  58. this.setTitle("Basketball Scoreboard");
  59. menuFile.setText("File");
  60. panelScoreboard.setBackground(new Color(227, 82, 227));
  61. panelScoreboard.setLayout(gridBagLayout1);
  62. txtHomeScore.setText("00");
  63. txtHomeScore.setPreferredSize(new Dimension(100, 75));
  64. txtHomeScore.setFont(new Font("SansSerif", 1, 60));
  65. txtHomeScore.setForeground(Color.red);
  66. txtHomeScore.setEditable(false);
  67. jLabel1.setText("Home");
  68. jLabel1.setFont(new Font("Dialog", 1, 20));
  69. jLabel1.setForeground(Color.white);
  70. jLabel2.setText("Guests");
  71. jLabel2.setForeground(Color.white);
  72. jLabel2.setFont(new Font("Dialog", 1, 20));
  73. txtGuests.setText("00");
  74. txtGuests.setCaretColor(Color.red);
  75. txtGuests.setForeground(Color.red);
  76. txtGuests.setEditable(false);
  77. txtGuests.setPreferredSize(new Dimension(100, 75));
  78. txtGuests.setFont(new Font("SansSerif", 1, 60));
  79. txtTime.setText("10:00");
  80. txtTime.setFont(new Font("SansSerif", 1, 60));
  81. txtTime.setForeground(Color.red);
  82. txtTime.setEditable(false);
  83. btnTimeControl.setText("Start/Stop");
  84. btnTimeControl.setForeground(Color.red);
  85. btnTimeControl.addActionListener(new ActionListener()
  86. {
  87. public void actionPerformed(ActionEvent e)
  88. {
  89. btnTimeControl_actionPerformed(e);
  90. }
  91. });
  92. btnHomeAdd.setText("Home +");
  93. btnHomeAdd.addActionListener(new ActionListener()
  94. {
  95. public void actionPerformed(ActionEvent e)
  96. {
  97. btnHomeAdd_actionPerformed(e);
  98. }
  99. });
  100. btnHomeSub.setText("Home -");
  101. btnHomeSub.addActionListener(new ActionListener()
  102. {
  103. public void actionPerformed(ActionEvent e)
  104. {
  105. btnHomeSub_actionPerformed(e);
  106. }
  107. });
  108. btnGuestsAdd.setText("Guests +");
  109. btnGuestsAdd.addActionListener(new ActionListener()
  110. {
  111. public void actionPerformed(ActionEvent e)
  112. {
  113. btnGuestsAdd_actionPerformed(e);
  114. }
  115. });
  116. btnGuestsSub.setText("Guests -");
  117. btnGuestsSub.addActionListener(new ActionListener()
  118. {
  119. public void actionPerformed(ActionEvent e)
  120. {
  121. btnGuestsSub_actionPerformed(e);
  122. }
  123. });
  124. menuFileExit.setText("Exit");
  125. menuFileExit.addActionListener(new ActionListener()
  126. {
  127. public void actionPerformed(ActionEvent ae)
  128. {
  129. fileExit_ActionPerformed(ae);
  130. }
  131. });
  132. menuFile.add(menuFileExit);
  133. menuBar1.add(menuFile);
  134. panelScoreboard.add(txtHomeScore, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 1, 1));
  135. panelScoreboard.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 1, 1));
  136. panelScoreboard.add(jLabel2, new GridBagConstraints(4, 0, 1, 1, 1.0, 1.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 1, 1));
  137. panelScoreboard.add(txtGuests, new GridBagConstraints(4, 1, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(4, 4, 4, 4), 1, 1));
  138. panelScoreboard.add(txtTime, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
  139. this.getContentPane().add(panelScoreboard, BorderLayout.CENTER);
  140. panelButtons.add(btnHomeAdd, null);
  141. panelButtons.add(btnHomeSub, null);
  142. panelButtons.add(btnTimeControl, null);
  143. panelButtons.add(btnGuestsAdd, null);
  144. panelButtons.add(btnGuestsSub, null);
  145. this.getContentPane().add(panelButtons, BorderLayout.SOUTH);
  146. }
  147. void fileExit_ActionPerformed(ActionEvent e)
  148. {
  149. System.exit(0);
  150. }
  151. void btnTimeControl_actionPerformed(ActionEvent e)
  152. {
  153. }
  154. void btnHomeAdd_actionPerformed(ActionEvent e)
  155. {
  156. homeScore++;
  157. txtHomeScore.setText(df.format(homeScore));
  158. }
  159. void btnHomeSub_actionPerformed(ActionEvent e)
  160. {
  161. homeScore--;
  162. txtHomeScore.setText(df.format(homeScore));
  163. }
  164. void btnGuestsAdd_actionPerformed(ActionEvent e)
  165. {
  166. guestsScore++;
  167. txtGuests.setText(df.format(guestsScore));
  168. }
  169. void btnGuestsSub_actionPerformed(ActionEvent e)
  170. {
  171. guestsScore--;
  172. txtGuests.setText(df.format(guestsScore));
  173. }
  174. }

  1. import javax.swing.JTextField;
  2.  
  3. public class ScoreboardTimer extends Thread
  4. {
  5. private int counter; // the number of seconds remaining on the timer
  6. private boolean isRunning; // toggle variable that controls whether the counter is decremented or not
  7. private JTextField timerDisplay; // reference to the GUI object displaying the timer
  8. // getters and setters for the variables
  9. public boolean toggleRunning()
  10. {
  11. // toggles the value of isRunning variable; called from click handler on/off button on frame
  12. }
  13. public void run()
  14. {
  15. while (counter > 0)
  16. {
  17. // delay one second with sleep() method
  18. // if clock is running, decrement counter and update display
  19. }
  20. }
  21. }
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Java tutor needed BADLY

 
0
  #7
Jul 24th, 2006
you don't need to extend thread to make a timer, there's already two (javax.swing.Timer and java.utils.Timer) personally i prefer java.utils.Timer, but more often than not i use javax.swing.Timer to avoid conlict issues in swing applications.

if you absolutely must use a thread, you don't need to extend it... I had some code to use a Thread as a Timer; (incedently - you can't call some old Thread methods like you could in previous versions without experiencing crashes..) the method doesn't extend thread, just creates a thread and listens to its run() calls.

But, i've lost that code, and can only find some code that's very wasteful, it creates a new Thread instance every 10th of a second, and eats up the stack like some kind of.. stack monster.

Read this page:

http://www.velocityreviews.com/forum...er-thread.html

it was actually quite difficult to find on google, i'd say 99 times out of ten people use the Timer objects rather than writing thier own.

Matt
Last edited by MattEvans; Jul 24th, 2006 at 11:50 pm.
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 216
Reputation: hooknc is an unknown quantity at this point 
Solved Threads: 8
hooknc hooknc is offline Offline
Posting Whiz in Training

Re: Java tutor needed BADLY

 
0
  #8
Jul 25th, 2006
Using the java.utils.timer class is fine. It is highly recommended NOT to use the javax.swing.timer class. It will mess up your swing ui.
Reply With Quote Quick reply to this message  
Join Date: Jul 2006
Posts: 1,091
Reputation: MattEvans is a jewel in the rough MattEvans is a jewel in the rough MattEvans is a jewel in the rough 
Solved Threads: 63
Moderator
Featured Poster
MattEvans's Avatar
MattEvans MattEvans is offline Offline
Veteran Poster

Re: Java tutor needed BADLY

 
0
  #9
Jul 25th, 2006
really? i use it on jframes that don't really have uis (just a big Canvas/Cavnas3D); what does it mess up specifically?
Plato forgot the nullahedron..
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 216
Reputation: hooknc is an unknown quantity at this point 
Solved Threads: 8
hooknc hooknc is offline Offline
Posting Whiz in Training

Re: Java tutor needed BADLY

 
0
  #10
Jul 25th, 2006
When using the javax.swing.Timer class if the process kicked off by the timer is long (as in longer then several milla seconds), it is posible to see the Swing UI freeze for the amount of time it takes the process to run.

Which IMO is a bad thing.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC