








Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Community
Ask the community for help and clear up your study doubts
Discover the best universities in your country according to Docsity users
Free resources
Download our free guides on studying techniques, anxiety management strategies, and thesis advice from Docsity tutors
Material Type: Notes; Class: Introduction to Advanced Studies II; Subject: Computer Science; University: Illinois Institute of Technology; Term: Unknown 1989;
Typology: Study notes
1 / 14
This page cannot be seen from the preview
Don't miss anything!
javax.swing.JmenuBar public class JMenuBar extends JComponent
Ex. JMenuBar menuBar = new JMenuBar(); setJMenuBar(menuBar);
javax.swing.JMenu public class JMenu extends JMenuItem
Ex. JMenu fileMenu = new JMenu("File"); menuBar.add(fileMenu);
javax.swing.Jpanel public class JPanel extends JComponent
Ex. JPanel textPanel = new JPanel(); getContentPane().add(textPanel, BorderLayout.SOUTH);
javax.swing.JtextField public class JTextField extends JTextComponent
Ex. JTextField textField = new JTextField(40); textField.setText( "TEXT FIELD " );
javax.swing.Jtree public class JTree extends Jcomponent void addTreeSelectionListener(TreeSelectionListener tsl) // Adds a listener for TreeSelection events.
Ex. JTree tree = new JTree( root ); // DefaultMutableTreeNode root tree.addTreeSelectionListener (new MyTreeSelectionListener());
javax.swing.event public interface TreeSelectionListener extends EventListener
Ex. class MyTreeSelectionListener implements TreeSelectionListener { public void valueChanged (TreeSelectionEvent e) { TreePath path = e.getPath(); … if (path.getPathCount() > 3) textField.setText( path.getLastPathComponent() + " Wins = " + s1 + "; Losses = " + s2); else textField.setText( " " ); } // end of valueChanged } // end of MyTreeSelectionListener
javax.swing.JScrollPane public class JScrollPane extends JComponent Ex. JPanel treePanel = new JPanel(); JTree tree = new JTree( root ); JScrollPane sp = new JScrollPane(tree); treePanel.add(sp, BorderLayout.CENTER);