| | |
Java tutor needed BADLY
![]() |
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.
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.
-Ginsburg
Don't tell me to "google it" - I already have.
•
•
Join Date: Jul 2006
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
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.
Thanks,
Bharat.
Phone 203 428 4124
•
•
Join Date: Jun 2004
Posts: 2,108
Reputation:
Solved Threads: 18
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.
•
•
•
•
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
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
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.
Java Syntax (Toggle Plain Text)
import java.awt.Frame; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import javax.swing.UIManager; import java.awt.Dimension; import java.awt.Toolkit; public class ScoreboardApp { public ScoreboardApp() { Frame frame = new ScoreboardFrame(); Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); Dimension frameSize = frame.getSize(); if (frameSize.height > screenSize.height) { frameSize.height = screenSize.height; } if (frameSize.width > screenSize.width) { frameSize.width = screenSize.width; } frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); frame.setVisible(true); } public static void main(String[] args) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch(Exception e) { e.printStackTrace(); } new ScoreboardApp(); } }
Java Syntax (Toggle Plain Text)
import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; import java.awt.Dimension; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.GridBagLayout; import java.awt.BorderLayout; import javax.swing.JPanel; import java.awt.Color; import javax.swing.JTextField; import java.awt.GridBagConstraints; import java.awt.Insets; import java.awt.Font; import javax.swing.JLabel; import javax.swing.JButton; import javax.swing.*; import java.text.*; public class ScoreboardFrame extends JFrame { JMenuItem menuFileExit = new JMenuItem(); JMenu menuFile = new JMenu(); JMenuBar menuBar1 = new JMenuBar(); BorderLayout borderLayout1 = new BorderLayout(); JPanel panelScoreboard = new JPanel(); GridBagLayout gridBagLayout1 = new GridBagLayout(); JTextField txtHomeScore = new JTextField(); JLabel jLabel1 = new JLabel(); JLabel jLabel2 = new JLabel(); JTextField txtGuests = new JTextField(); JTextField txtTime = new JTextField(); JPanel panelButtons = new JPanel(); JButton btnTimeControl = new JButton(); JButton btnHomeAdd = new JButton(); JButton btnHomeSub = new JButton(); JButton btnGuestsAdd = new JButton(); JButton btnGuestsSub = new JButton(); DecimalFormat df = new DecimalFormat("00"); int homeScore = 0; int guestsScore = 0; public ScoreboardFrame() { try { jbInit(); } catch(Exception e) { e.printStackTrace(); } } private void jbInit() throws Exception { this.setJMenuBar(menuBar1); this.getContentPane().setLayout(borderLayout1); this.setSize(new Dimension(534, 300)); this.setTitle("Basketball Scoreboard"); menuFile.setText("File"); panelScoreboard.setBackground(new Color(227, 82, 227)); panelScoreboard.setLayout(gridBagLayout1); txtHomeScore.setText("00"); txtHomeScore.setPreferredSize(new Dimension(100, 75)); txtHomeScore.setFont(new Font("SansSerif", 1, 60)); txtHomeScore.setForeground(Color.red); txtHomeScore.setEditable(false); jLabel1.setText("Home"); jLabel1.setFont(new Font("Dialog", 1, 20)); jLabel1.setForeground(Color.white); jLabel2.setText("Guests"); jLabel2.setForeground(Color.white); jLabel2.setFont(new Font("Dialog", 1, 20)); txtGuests.setText("00"); txtGuests.setCaretColor(Color.red); txtGuests.setForeground(Color.red); txtGuests.setEditable(false); txtGuests.setPreferredSize(new Dimension(100, 75)); txtGuests.setFont(new Font("SansSerif", 1, 60)); txtTime.setText("10:00"); txtTime.setFont(new Font("SansSerif", 1, 60)); txtTime.setForeground(Color.red); txtTime.setEditable(false); btnTimeControl.setText("Start/Stop"); btnTimeControl.setForeground(Color.red); btnTimeControl.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnTimeControl_actionPerformed(e); } }); btnHomeAdd.setText("Home +"); btnHomeAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnHomeAdd_actionPerformed(e); } }); btnHomeSub.setText("Home -"); btnHomeSub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnHomeSub_actionPerformed(e); } }); btnGuestsAdd.setText("Guests +"); btnGuestsAdd.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnGuestsAdd_actionPerformed(e); } }); btnGuestsSub.setText("Guests -"); btnGuestsSub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { btnGuestsSub_actionPerformed(e); } }); menuFileExit.setText("Exit"); menuFileExit.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { fileExit_ActionPerformed(ae); } }); menuFile.add(menuFileExit); menuBar1.add(menuFile); 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)); 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)); 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)); 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)); 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)); this.getContentPane().add(panelScoreboard, BorderLayout.CENTER); panelButtons.add(btnHomeAdd, null); panelButtons.add(btnHomeSub, null); panelButtons.add(btnTimeControl, null); panelButtons.add(btnGuestsAdd, null); panelButtons.add(btnGuestsSub, null); this.getContentPane().add(panelButtons, BorderLayout.SOUTH); } void fileExit_ActionPerformed(ActionEvent e) { System.exit(0); } void btnTimeControl_actionPerformed(ActionEvent e) { } void btnHomeAdd_actionPerformed(ActionEvent e) { homeScore++; txtHomeScore.setText(df.format(homeScore)); } void btnHomeSub_actionPerformed(ActionEvent e) { homeScore--; txtHomeScore.setText(df.format(homeScore)); } void btnGuestsAdd_actionPerformed(ActionEvent e) { guestsScore++; txtGuests.setText(df.format(guestsScore)); } void btnGuestsSub_actionPerformed(ActionEvent e) { guestsScore--; txtGuests.setText(df.format(guestsScore)); } }
Java Syntax (Toggle Plain Text)
import javax.swing.JTextField; public class ScoreboardTimer extends Thread { private int counter; // the number of seconds remaining on the timer private boolean isRunning; // toggle variable that controls whether the counter is decremented or not private JTextField timerDisplay; // reference to the GUI object displaying the timer // getters and setters for the variables public boolean toggleRunning() { // toggles the value of isRunning variable; called from click handler on/off button on frame } public void run() { while (counter > 0) { // delay one second with sleep() method // if clock is running, decrement counter and update display } } }
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
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..
![]() |
Other Threads in the Java Forum
- Previous Thread: JTable help!
- Next Thread: Uploading
| Thread Tools | Search this Thread |
911 addball addressbook android api append applet application apps array arrays automation binary bluetooth businessintelligence button card chat class client code collision component crashcourse css csv database eclipse ee error fractal free game gis givemetehcodez graphics gui html ide image integer integration j2me japplet java javaarraylist javadoc javafx javaprojects jni jpanel julia jvm linux list loan machine map method methods migrate mobile netbeans newbie objects oriented output panel phone physics problem program programming project projects radio recursion replaydirector reporting scanner se server service set sms socket software sort sql string swing test textfield threads transfer tree trolltech ubuntu utility windows






