Swing
Using Swing Components
JFrame & JLabel Hierarchy javax.swing.JFrame java.awt.Frame java.awt.Window java.awt.Container java.awt.Component java.awt...
JTextField & JButton Hierarchy javax.swing.JButton javax.swing.AbstractButton javax.swing.JComponent JTextField javax.swin...
Creating a Window
Creating a Window  contd. <ul><li>import javax.swing.*; </li></ul><ul><li>public class SwingTest extends JFrame </li></ul>...
Adding Components to a Window <ul><li>public SwingTest( String title ) </li></ul><ul><li>{ </li></ul><ul><li>super(title);...
Adding Components to a Window
Events java.awt.event.FocusEvent java.awt.event.MouseEvent java.awt.event.WindowEvent java.awt.event.ActionEvent java.awt....
Event Listeners java.awt.event.MouseListener java.util.EventListener java.util.EventListener java.awt.event.ActionListener...
Registering a Component with a Listener <ul><li>import java.awt.event.*; </li></ul><ul><li>public class SwingTest extends ...
Registering a Component with a Listener <ul><li>public class SwingTest extends JFrame implements ActionListener,MouseListe...
Registering a Component with a Listener <ul><li>public void mouseExited(MouseEvent me) </li></ul><ul><li>{ </li></ul><ul><...
Registering a Component with a Listener Registering TextFields with FocusListener to handle FocusEvent
Registering a Component with a Listener <ul><li>public class SwingTest extends JFrame implements ActionListener,FocusListe...
Using Mnemonic to transfer focus
Using Mnemonic to transfer focus <ul><li>n = new JLabel(&quot;Name&quot;); </li></ul><ul><li>r = new JLabel(&quot;Roll&quo...
Adding ToolTips <ul><li>b1 = new JButton(); </li></ul><ul><li>b2 = new JButton(); </li></ul><ul><li>b3 = new JButton(); </...
Working with Text
Class Hierarchy javax.swing.text.JTextComponent javax.swing.JTextField javax.swing.JPasswordField javax.swing.JTextArea ja...
javax.swing.text.JTextComponent <ul><li>An abstract class, defines the basic behavior of every text-based swing component....
Events <ul><li>CaretEvent </li></ul><ul><li>Every JTextComponent fires this event every time the component’s caret  state ...
Handling Caret Event <ul><li>jta = new JTextArea(10,15); </li></ul><ul><li>cp = new JLabel(); </li></ul><ul><li>add(new JS...
javax.swing.JTextField <ul><li>Allows user to enter single line of text. </li></ul><ul><li>ActionEvent  is fired when ente...
Aligning the Text <ul><li>center.setHorizontalAlignment( JTextField.CENTER ); </li></ul><ul><li>right.setHorizontalAlignme...
Interface javax.swing.text.Document <ul><li>Properties : </li></ul><ul><li>Element defaultRootElement </li></ul><ul><li>pr...
Interface javax.swing.text.Element <ul><li>Used to describe an arbitrary portion of a document. </li></ul><ul><li>Elements...
Element  contd. <ul><li>Properties : </li></ul><ul><li>Document document </li></ul><ul><li>AttributeSet attributes </li></...
Document Hierarchy java.lang.Object javax.swing.text.AbstractDocument javax.swing.text.PlainDocument javax.swing.text.Docu...
Manipulating the content of the Document <ul><li>String getText(int offset,int length) throws BadLocationException </li></...
Filtering TextField <ul><li>Alternatives : 2 </li></ul><ul><li>Either Use KeyListener </li></ul><ul><li>or Modify Document...
Listening to Document Events
Listening to Document Events <ul><li>jTextArea1.getDocument().addDocumentListener(this); </li></ul><ul><li>jTextArea1.getD...
Listening to Document Events <ul><li>private void showDocEvent(DocumentEvent event) </li></ul><ul><li>{ </li></ul><ul><li>...
javax.swing.event.DocumentListener <ul><li>changedUpdate(DocumentEvent event) </li></ul><ul><li>Indicates that an attribut...
Working with Elements
Working with Elements <ul><li>Handling Caret Event </li></ul><ul><li>jTextArea2.setText(&quot;Lines : &quot;+jTextArea1.ge...
Building a Primitive Browser
Building a Primitive Browser <ul><li>Set the MIME Type </li></ul><ul><li>jEditorPane1.setContentType(&quot;text/html&quot;...
Following the Link
Following the Link <ul><li>Use javax.swing.event.HyperlinkListener. </li></ul><ul><li>if( evt.getEventType() == HyperlinkE...
 
 
Upcoming SlideShare
Loading in...5
×

Swing

1,525

Published on

0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,525
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Transcript of "Swing"

  1. 1. Swing
  2. 2. Using Swing Components
  3. 3. JFrame & JLabel Hierarchy javax.swing.JFrame java.awt.Frame java.awt.Window java.awt.Container java.awt.Component java.awt.Object javax.swing.JLabel JComponent
  4. 4. JTextField & JButton Hierarchy javax.swing.JButton javax.swing.AbstractButton javax.swing.JComponent JTextField javax.swing.text.JTextComponent javax.swing.JToggleButton JCheckBox JRadioButton JTextArea JEditorPane JTextPane
  5. 5. Creating a Window
  6. 6. Creating a Window contd. <ul><li>import javax.swing.*; </li></ul><ul><li>public class SwingTest extends JFrame </li></ul><ul><li>{ </li></ul><ul><li>public SwingTest( String title ) </li></ul><ul><li>{ </li></ul><ul><li>super(title); </li></ul><ul><li>setSize(500,350); </li></ul><ul><li>setVisible(true); </li></ul><ul><li>} </li></ul><ul><li>public static void main(String[] args) </li></ul><ul><li>{ </li></ul><ul><li>SwingTest window = new SwingTest(&quot;Swing Demo&quot;); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  7. 7. Adding Components to a Window <ul><li>public SwingTest( String title ) </li></ul><ul><li>{ </li></ul><ul><li>super(title); </li></ul><ul><li>setSize(500,350); </li></ul><ul><li>setVisible(true); </li></ul><ul><li>firstName = new JTextField(20); </li></ul><ul><li>lastName = new JTextField(20); </li></ul><ul><li>fullName = new JButton(&quot;Full Name&quot;); </li></ul><ul><li>first = new JLabel(&quot;First Name&quot;); </li></ul><ul><li>last = new JLabel(&quot;Last Name&quot;); </li></ul><ul><li>setLayout(new FlowLayout()); </li></ul><ul><li>add(first); add(firstName); </li></ul><ul><li>add(last); add(lastName); </li></ul><ul><li>add(fullName); </li></ul><ul><li>} </li></ul>
  8. 8. Adding Components to a Window
  9. 9. Events java.awt.event.FocusEvent java.awt.event.MouseEvent java.awt.event.WindowEvent java.awt.event.ActionEvent java.awt.event.ComponentEvent java.awt.AWTEvent java.util.EventObject java.lang.Object
  10. 10. Event Listeners java.awt.event.MouseListener java.util.EventListener java.util.EventListener java.awt.event.ActionListener java.awt.event.FocusListener java.awt.event.WindowListener
  11. 11. Registering a Component with a Listener <ul><li>import java.awt.event.*; </li></ul><ul><li>public class SwingTest extends JFrame implements ActionListener </li></ul><ul><li>{ </li></ul><ul><li>public SwingTest( String title ) </li></ul><ul><li>{ </li></ul><ul><li>fullName.addActionListener(this); </li></ul><ul><li>} </li></ul><ul><li>public void actionPerformed(ActionEvent ae) </li></ul><ul><li>{ </li></ul><ul><li>String fullName = firstName.getText()+&quot; &quot;+lastName.getText(); </li></ul><ul><li>JOptionPane.showMessageDialog(null,fullName); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>Registering the button with ActionListener to handle ActionEvent
  12. 12. Registering a Component with a Listener <ul><li>public class SwingTest extends JFrame implements ActionListener,MouseListener </li></ul><ul><li>{ </li></ul><ul><li>public SwingTest( String title ) </li></ul><ul><li>{ </li></ul><ul><li>fullName.addActionListener(this); </li></ul><ul><li>fullName.addMouseListener(this); </li></ul><ul><li>} </li></ul><ul><li>public void actionPerformed(ActionEvent ae) </li></ul><ul><li>{ </li></ul><ul><li>String fullName = firstName.getText()+&quot; &quot;+lastName.getText(); </li></ul><ul><li>JOptionPane.showMessageDialog(null,fullName); </li></ul><ul><li>} </li></ul><ul><li>public void mouseEntered(MouseEvent me) </li></ul><ul><li>{ </li></ul><ul><li>System.out.println(&quot;mouse enter event&quot;); </li></ul><ul><li>} </li></ul>Registering the button with MouseListener to handle MouseEvent
  13. 13. Registering a Component with a Listener <ul><li>public void mouseExited(MouseEvent me) </li></ul><ul><li>{ </li></ul><ul><li>System.out.println(&quot;mouse exit event&quot;); </li></ul><ul><li>} </li></ul><ul><li>public void mousePressed(MouseEvent me) </li></ul><ul><li>{ </li></ul><ul><li>System.out.println(&quot;mouse press event&quot;); </li></ul><ul><li>} </li></ul><ul><li>public void mouseReleased(MouseEvent me) </li></ul><ul><li>{ </li></ul><ul><li>System.out.println(&quot;mouse release event&quot;); </li></ul><ul><li>} </li></ul><ul><li>public void mouseClicked(MouseEvent me) </li></ul><ul><li>{ </li></ul><ul><li>System.out.println(&quot;mouse click event&quot;); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>Registering the button with MouseListener to handle MouseEvent contd. Which is preferrable? MouseListener or ActionListener
  14. 14. Registering a Component with a Listener Registering TextFields with FocusListener to handle FocusEvent
  15. 15. Registering a Component with a Listener <ul><li>public class SwingTest extends JFrame implements ActionListener,FocusListener </li></ul><ul><li>{ </li></ul><ul><li>Color backGround; </li></ul><ul><li>public SwingTest( String title ) </li></ul><ul><li>{ </li></ul><ul><li> fullName.addActionListener(this); </li></ul><ul><li>firstName.addFocusListener(this); </li></ul><ul><li>lastName.addFocusListener(this); </li></ul><ul><li>backGround = firstName.getBackground(); </li></ul><ul><li>} </li></ul><ul><li>public void focusGained(FocusEvent fe) </li></ul><ul><li>{ </li></ul><ul><li>((JComponent)fe.getSource()).setBackground(new Color(255,255,193)); </li></ul><ul><li>} </li></ul><ul><li>public void focusLost(FocusEvent fe) </li></ul><ul><li>{ </li></ul><ul><li>((JComponent)fe.getSource()).setBackground(backGround); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul>
  16. 16. Using Mnemonic to transfer focus
  17. 17. Using Mnemonic to transfer focus <ul><li>n = new JLabel(&quot;Name&quot;); </li></ul><ul><li>r = new JLabel(&quot;Roll&quot;); </li></ul><ul><li>b = new JLabel(&quot;Batch&quot;); </li></ul><ul><li>s = new JLabel(&quot;Session&quot;); </li></ul><ul><li>n.setDisplayedMnemonic('N'); </li></ul><ul><li>r.setDisplayedMnemonic('R'); </li></ul><ul><li>b.setDisplayedMnemonic('B'); </li></ul><ul><li>s.setDisplayedMnemonic('S'); </li></ul><ul><li>n.setLabelFor(name); </li></ul><ul><li>r.setLabelFor(roll); </li></ul><ul><li>b.setLabelFor(batch); </li></ul><ul><li>s.setLabelFor(session); </li></ul>
  18. 18. Adding ToolTips <ul><li>b1 = new JButton(); </li></ul><ul><li>b2 = new JButton(); </li></ul><ul><li>b3 = new JButton(); </li></ul><ul><li>b1.setToolTipText(&quot;Hi, I'm Dino&quot;); </li></ul><ul><li>b2.setToolTipText(&quot;I'm a bird,I'm duck.&quot;); </li></ul><ul><li>b1.setIcon(new ImageIcon(&quot;c:udiino.gif&quot;)); </li></ul><ul><li>b1.setContentAreaFilled(false); </li></ul><ul><li>b1.setBorder(null); </li></ul>b2.setIcon(new ImageIcon(&quot;c:udiuck.gif&quot;)); b2.setContentAreaFilled(false); b2.setBorder(null); b3.setIcon(new ImageIcon(&quot;c:udiruck.gif&quot;)); b3.setContentAreaFilled(false);
  19. 19. Working with Text
  20. 20. Class Hierarchy javax.swing.text.JTextComponent javax.swing.JTextField javax.swing.JPasswordField javax.swing.JTextArea javax.swing.JEditorPane javax.swing.JTextPane javax.swing.JComponent
  21. 21. javax.swing.text.JTextComponent <ul><li>An abstract class, defines the basic behavior of every text-based swing component. </li></ul><ul><li>Properties : </li></ul><ul><li>document </li></ul><ul><li>A reference to the Document model for the component. </li></ul><ul><li>This is where the component’s data is stored. </li></ul><ul><li>default value : null </li></ul><ul><li>highlighter </li></ul><ul><li>Type : javax.swing.text.Highlighter </li></ul><ul><li>default value : null </li></ul><ul><li>It’s used to refer an object that’s responsible for making highlights in the text. </li></ul>
  22. 22. Events <ul><li>CaretEvent </li></ul><ul><li>Every JTextComponent fires this event every time the component’s caret state changes. </li></ul><ul><li>Exception : when the text is being selected using mouse. </li></ul><ul><li>PropertyChangeEvent </li></ul><ul><li>caret, caretColor, disabledTextColor, document, editable, focusAccelerator, highlighter, keymap, margin, selectedTextColor, and selectionColor. </li></ul>
  23. 23. Handling Caret Event <ul><li>jta = new JTextArea(10,15); </li></ul><ul><li>cp = new JLabel(); </li></ul><ul><li>add(new JScrollPane(jta)); </li></ul><ul><li>add(cp); </li></ul><ul><li>jta.addCaretListener(this); </li></ul><ul><li>public void caretUpdate(CaretEvent event) </li></ul><ul><li>{ </li></ul><ul><li>cp.setText(&quot;Cursor Position : &quot;+jta.getCaretPosition()); </li></ul><ul><li>} </li></ul>
  24. 24. javax.swing.JTextField <ul><li>Allows user to enter single line of text. </li></ul><ul><li>ActionEvent is fired when enter key is pressed. </li></ul><ul><li>Improvements over java.awt.TextField : </li></ul><ul><li>Allows simple alignment of text (Center, Left, Right). </li></ul><ul><li>Allows text filtering </li></ul><ul><li>Events : </li></ul><ul><li>JTextField objects fire ActionEvent s any time the enter key is pressed. </li></ul><ul><li>A JTextField fires a PropertyChangeEvent whenever the horizontal Alignment property is updated. </li></ul>
  25. 25. Aligning the Text <ul><li>center.setHorizontalAlignment( JTextField.CENTER ); </li></ul><ul><li>right.setHorizontalAlignment( JTextField.RIGHT ); </li></ul><ul><li>left.setHorizontalAlignment( JTextField.LEFT ); </li></ul>
  26. 26. Interface javax.swing.text.Document <ul><li>Properties : </li></ul><ul><li>Element defaultRootElement </li></ul><ul><li>provides access to the Element at the root of the default Element structure hierarchy. </li></ul><ul><li>Element[] rootElements </li></ul><ul><li>specifies an array of all root elements (including the default) available in </li></ul><ul><li>the Document. </li></ul><ul><li>Position endPosition() </li></ul><ul><li>Position startPosition() </li></ul><ul><li>Always refer to the beginning and end of the document, regardless of changes made to it throughout its lifetime. </li></ul><ul><li>int length </li></ul><ul><li>Specifies the total number of characters in the Document. </li></ul>
  27. 27. Interface javax.swing.text.Element <ul><li>Used to describe an arbitrary portion of a document. </li></ul><ul><li>Elements do not actually contain a portion of the document, they just define a way of structuring it. </li></ul><ul><li>Each Element is described by an AttributeSet, </li></ul><ul><li>Elements may contain other Elements. </li></ul>
  28. 28. Element contd. <ul><li>Properties : </li></ul><ul><li>Document document </li></ul><ul><li>AttributeSet attributes </li></ul><ul><li>Element element // indexed </li></ul><ul><li>int elementCount() </li></ul><ul><li>int endOffset </li></ul><ul><li>int startOffset </li></ul><ul><li>specify the offsets from the beginning of the document that the Element covers. These values change as data is added to or before the Element. </li></ul><ul><li>boolean leaf </li></ul><ul><li>indicates whether or not this is a leaf Element </li></ul>
  29. 29. Document Hierarchy java.lang.Object javax.swing.text.AbstractDocument javax.swing.text.PlainDocument javax.swing.text.Document java.io.Serializable StyledDocument javax.swing.text.DefaultStyledDocument
  30. 30. Manipulating the content of the Document <ul><li>String getText(int offset,int length) throws BadLocationException </li></ul><ul><li>void insertString(int offset, String str, AttributeSet a) throws BadLocationException </li></ul><ul><li>void remove(int offs, int len) throws BadLocationException </li></ul><ul><li>The Document should update its Element structures to reflect the change. </li></ul><ul><li>void putProperty(Object key, Object value) </li></ul><ul><li>Object getProperty(Object key) </li></ul><ul><li>used to store things such as the document title, author, etc. </li></ul>
  31. 31. Filtering TextField <ul><li>Alternatives : 2 </li></ul><ul><li>Either Use KeyListener </li></ul><ul><li>or Modify Document Model </li></ul><ul><li>jf = new JTextField(20); </li></ul><ul><li>jf.setDocument(new FixedLength()); </li></ul><ul><li>class FixedLength extends PlainDocument </li></ul><ul><li>{ </li></ul><ul><li>public void insertString(int offset,String s,AttributeSet a) </li></ul><ul><li>{ </li></ul><ul><li>if( getLength()+s.length() >10) </li></ul><ul><li>Toolkit.getDefaultToolkit().beep(); </li></ul><ul><li>else </li></ul><ul><li>try{ super.insertString(offset,s,a); }catch(Exception e){} </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>Benefit over keyListener : </li></ul><ul><li>any insertion into the Document (including keyboard entry,pasting from the clipboard, or programmatic insertions) will be checked. </li></ul>
  32. 32. Listening to Document Events
  33. 33. Listening to Document Events <ul><li>jTextArea1.getDocument().addDocumentListener(this); </li></ul><ul><li>jTextArea1.getDocument().addUndoableEditListener(this); </li></ul><ul><li>public void changedUpdate(DocumentEvent event) </li></ul><ul><li>{ </li></ul><ul><li>showDocEvent(event); </li></ul><ul><li>} </li></ul><ul><li>public void removeUpdate(DocumentEvent event) </li></ul><ul><li>{ </li></ul><ul><li>showDocEvent(event); </li></ul><ul><li>} </li></ul><ul><li>public void insertUpdate(DocumentEvent event) </li></ul><ul><li>{ </li></ul><ul><li>showDocEvent(event); </li></ul><ul><li>} </li></ul><ul><li>public void undoableEditHappened(UndoableEditEvent event) </li></ul><ul><li>{ </li></ul><ul><li>jTextArea2.append(event.getEdit().getPresentationName().toString()); </li></ul><ul><li>} </li></ul>
  34. 34. Listening to Document Events <ul><li>private void showDocEvent(DocumentEvent event) </li></ul><ul><li>{ </li></ul><ul><li>jTextArea2.append(&quot; &quot;+event.getType().toString()); </li></ul><ul><li>jTextArea2.append(&quot; Offset : &quot;+event.getOffset()+&quot; length : &quot;+event.getLength()); </li></ul><ul><li>Element e = jTextArea1.getDocument().getDefaultRootElement(); </li></ul><ul><li>DocumentEvent.ElementChange change = event.getChange(e); </li></ul><ul><li>if(change==null) </li></ul><ul><li>jTextArea2.append(&quot;<NO ELEMENT CHANGES>&quot;); </li></ul><ul><li>else </li></ul><ul><li>{ </li></ul><ul><li>jTextArea2.append(&quot; Changes {Index/Add/Remove} : &quot;+change.getIndex()); </li></ul><ul><li>jTextArea2.append(&quot;/&quot;+change.getChildrenAdded().length); </li></ul><ul><li>jTextArea2.append(&quot;/&quot;+change.getChildrenRemoved().length); </li></ul><ul><li>} </li></ul><ul><li>jTextArea2.append(&quot; &quot;); </li></ul><ul><li>} </li></ul>
  35. 35. javax.swing.event.DocumentListener <ul><li>changedUpdate(DocumentEvent event) </li></ul><ul><li>Indicates that an attribute or set of attributes in the Document has changed. </li></ul><ul><li>The range given in the event reflects the offset and length of the affected text. </li></ul><ul><li>insertUpdate(DocumentEvent event) </li></ul><ul><li>Indicates that text has been inserted into the Document. </li></ul><ul><li>The range given in the event reflects the offset and length of the new text. </li></ul><ul><li>removeUpdate(DocumentEvent event) </li></ul><ul><li>Indicates that text has been removed from the Document. </li></ul><ul><li>The range given by the event reflects the offset and length of the removed text, relative to the state of the Document before the text was removed. </li></ul>
  36. 36. Working with Elements
  37. 37. Working with Elements <ul><li>Handling Caret Event </li></ul><ul><li>jTextArea2.setText(&quot;Lines : &quot;+jTextArea1.getDocument().getDefaultRootElement().getElementCount()+&quot; Chars : &quot;+jTextArea1.getDocument().getLength() ); </li></ul><ul><li>jTextArea3.setText(&quot;&quot;); </li></ul><ul><li>int elements = jTextArea1.getDocument().getDefaultRootElement().getElementCount(); </li></ul><ul><li>for( int index=0; index<elements; index++ ) </li></ul><ul><li>{ </li></ul><ul><li>javax.swing.text.Element ee = jTextArea1.getDocument().getDefaultRootElement().getElement(index); </li></ul><ul><li>int chars = ee.getEndOffset() - ee.getStartOffset(); </li></ul><ul><li>jTextArea3.append(&quot;Line no. &quot;+(index+1)+&quot; has &quot;+chars+&quot; chars. &quot; ); </li></ul><ul><li>} </li></ul>
  38. 38. Building a Primitive Browser
  39. 39. Building a Primitive Browser <ul><li>Set the MIME Type </li></ul><ul><li>jEditorPane1.setContentType(&quot;text/html&quot;); </li></ul><ul><li>jEditorPane1.setEditable(false); </li></ul><ul><li>On Button Click </li></ul><ul><li>String path = jTextField1.getText(); </li></ul><ul><li>try{ </li></ul><ul><li>FileInputStream fis = new FileInputStream(path); </li></ul><ul><li>byte b[] = new byte[(int)fis.getChannel().size()]; </li></ul><ul><li>fis.read(b); </li></ul><ul><li>jEditorPane1.setText(new String(b)); </li></ul><ul><li>} </li></ul><ul><li>catch(FileNotFoundException fnfe) </li></ul><ul><li>{ </li></ul><ul><li>jEditorPane1.setText(&quot;File Location Incorrect&quot;); </li></ul><ul><li>} </li></ul><ul><li>catch(IOException e) </li></ul><ul><li>{ </li></ul><ul><li>jEditorPane1.setText(e.getMessage()); </li></ul><ul><li>} </li></ul><ul><li>jEditorPane1.getCaret().moveDot(0); </li></ul>On FocusEvent on JEditorPane jEditorPane1.getCaret().setVisible(false);
  40. 40. Following the Link
  41. 41. Following the Link <ul><li>Use javax.swing.event.HyperlinkListener. </li></ul><ul><li>if( evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED ) </li></ul><ul><li>{ </li></ul><ul><li>try{ </li></ul><ul><li>jEditorPane1.setPage(evt.getURL()); </li></ul><ul><li>jTextField1.setText(evt.getURL().toExternalForm()); </li></ul><ul><li>} </li></ul><ul><li>catch(IOException ioe) </li></ul><ul><li>{ </li></ul><ul><li>jEditorPane1.setText(ioe.getMessage()); </li></ul><ul><li>} </li></ul><ul><li>} </li></ul><ul><li>else if( evt.getEventType()==HyperlinkEvent.EventType.ENTERED) </li></ul><ul><li>{ </li></ul><ul><li>jEditorPane1.setToolTipText(&quot;Click to view this page&quot;); </li></ul><ul><li>} </li></ul>

×