25 May 2008 @ 11:21 PM 
1 Star2 Stars3 Stars4 Stars5 Stars (1 votes, average: 5 out of 5)
Loading ... Loading ...
732 views

Here’s a small demo I wrote that shows you how to use the Java JToolBar. The toolbar doesn’t do a lot except for showing a message when the user clicks one of the toolbar items.

Screenshot:

More »

Your Ad Here
Tags Tags: , , , ,
Categories: Java
Posted By: HappyFace
Last Edit: 15 Jun 2008 @ 03 01 PM

EmailPermalinkComments (0)
 22 May 2008 @ 10:22 PM 
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 3.67 out of 5)
Loading ... Loading ...
435 views

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 »

Your Ad Here
 18 May 2008 @ 4:46 PM 
1 Star2 Stars3 Stars4 Stars5 Stars (3 votes, average: 4.67 out of 5)
Loading ... Loading ...
2,483 views

This is a demo I wrote earlier today to show you how you can write captcha software with Java. The application is really basic and currently only supports numbers but the code can be modified easily to support text. I’ll probably add this features later when i have the time to code it. Until then, here’s the JCaptcha code that works with numbers:

More »

Your Ad Here
 03 May 2008 @ 3:34 PM 
1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 5 out of 5)
Loading ... Loading ...
2,700 views

A small demo I wrapped up that shows you how to use a JTree. The demo shows a JTree and a message of the selected item on the bottom of the JFrame.

JAVA:
  1. import java.awt.Color;
  2. import javax.swing.JFrame;
  3. import javax.swing.JLabel;
  4. import javax.swing.JTree;
  5. import javax.swing.event.TreeSelectionEvent;
  6. import javax.swing.event.TreeSelectionListener;
  7. import javax.swing.tree.DefaultMutableTreeNode;
  8. import javax.swing.tree.TreeSelectionModel;
  9. public class TreeDemo extends JFrame implements TreeSelectionListener{
  10. JTree tree;
  11. DefaultMutableTreeNode root, child1,child2,child3, item1,item2;
  12. JLabel message;
  13. public TreeDemo(){
  14. setTitle("TreeDemo :: www.engineeringserver.com");
  15. getContentPane().setLayout(null);
  16. root = new DefaultMutableTreeNode("root");
  17. child1 = new DefaultMutableTreeNode("Child1");
  18. child2 = new DefaultMutableTreeNode("Child2");
  19. child3 = new DefaultMutableTreeNode("Child3");
  20. item1 = new DefaultMutableTreeNode("item1");
  21. item2 = new DefaultMutableTreeNode("item2");
  22. root.add(child1);
  23. root.add(child2);
  24. root.add(child3);
  25. child2.add(item1);
  26. child2.add(item2);
  27. tree = new JTree(root);
  28. tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  29. expandAll(tree);
  30. tree.addTreeSelectionListener(this);
  31. tree.setBounds(0,0,400,200);
  32. message = new JLabel("Selected: ");
  33. message.setBounds(0,200,200,20);
  34. add(tree);
  35. add(message);
  36. setLocationRelativeTo(null);
  37. setResizable(false);
  38. setSize(400,250);
  39. setVisible(true);
  40. }
  41. public static void main(String[] args){
  42. new TreeDemo();
  43. }
  44. public void valueChanged(TreeSelectionEvent e) {
  45. DefaultMutableTreeNode node = (DefaultMutableTreeNode) tree.getLastSelectedPathComponent();
  46. Object nodeInfo = node.getUserObject();
  47. message.setText("Selected: " + nodeInfo);
  48. }
  49. public void expandAll(JTree tree) {
  50. int totalElements = 0;
  51. while (totalElements <tree.getRowCount()) {
  52. tree.expandRow(totalElements);
  53. totalElements++;
  54. }
  55. }
  56. }

Your Ad Here
\/ More Options ...
Change Theme...
  • Users » 888
  • Posts/Pages » 1,444
  • Comments » 506
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

Online Users



    No Child Pages.

Forum



    No Child Pages.