22 May 2008 @ 10:22 PM 

Someone asked me to write an application that:

• Use an array to store the data for the different brands.
• Must have 4 additional index positions available for data entry so that I may be able to add
• Must ensure that PR or Plain Wrap is not duplicated in data entry
• Cannot use scanner
• You may choose to use 2 dimensional array (one class needed) or object of array(two classes needed)

Output:
• You will need to display the plain wrap number chosen and the corresponding Brands for that particular part.

So here it is:

More »

Tags Tags: , , , , , , , , , , , , , ,
Categories: Java, Languages
Posted By: HappyFace
Last Edit: 25 May 2008 @ 11 31 PM

E-mailPermalinkComments (0)

Here's a demo I wrote to show an example of the usage of a timertask. This demo will show a "reminder" dialog after x seconds.

JAVA:
  1. public class TimerTaskDemoV2 extends JDialog  implements ActionListener {
  2. Timer timer;
  3. JTextArea info = new JTextArea("This is a reminder..\nBy: HappyFace\nwww.engineeringserver.com");
  4. public TimerTaskDemoV2(int seconds) {
  5. timer = new Timer();
  6. timer.schedule(new RemindTask(), seconds*1000);
  7. }
  8. public TimerTaskDemoV2(){
  9. getContentPane().setLayout(null);
  10. info.setEditable(false);
  11. info.setBounds(0,0,200,100);
  12. ok = new JButton("Close");
  13. ok.addActionListener(this);
  14. ok.setBounds(0,100,200,30);
  15. add(info);
  16. add(ok);
  17. setTitle("Reminder");
  18. setDefaultCloseOperation(0);
  19. setSize(207,155);
  20. setResizable(false);
  21. setLocationRelativeTo(null);
  22. setVisible(true);
  23. }
  24. class RemindTask extends TimerTask {
  25. public void run() {
  26. TimerTaskDemoV2 tmp = new  TimerTaskDemoV2();
  27. timer.cancel();
  28. }
  29. }
  30. public void actionPerformed(ActionEvent e) {
  31. if(e.getSource() == ok){
  32. System.exit(0);
  33. }
  34. }
  35. public static void main(String args[]) {
  36. int wait = 5;
  37. System.out.println("Wait "+ wait + " second(s)");
  38. new TimerTaskDemoV2(wait);
  39. }
  40. }

Tags Tags: , , , , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 24 Aug 2008 @ 06 30 PM

E-mailPermalinkComments (2)
\/ More Options ...
Change Theme...
  • Role »
  • Posts »
  • Comments »
Change Theme...
  • VoidVoid (Default)
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LiteLightweight