Page 2 of 5 FirstFirst 1234 ... LastLast
Results 21 to 40 of 92
  1. #21
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Sorry, I can't help you step by step. At least make an attempt. Seems you never wants to learn Java. We all told you that what you have to do. But no sign of any attempt.
    Sir i got some example from net plz see it and told me how can i use it in right way..

    Java Code:
     try {
            String url = "http://java.sun.com";
            JEditorPane editorPane = new JEditorPane(url);
            editorPane.setEditable(false);
            editorPane.addHyperlinkListener(new MyHyperlinkListener());
        } catch (IOException e) {
        }
        
        class MyHyperlinkListener implements HyperlinkListener {
            public void hyperlinkUpdate(HyperlinkEvent evt) {
                if (evt.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
                    JEditorPane pane = (JEditorPane)evt.getSource();
                    try {
                        // Show the new page in the editor pane.
                        pane.setPage(evt.getURL());
                    } catch (IOException e) {
                    }
                }
            }
        }

  2. #22
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    sir plz help me..I feel handicaft

  3. #23
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Now you are going to mixed up. That is another approach actually. What happened on that code. Did you run it and have a test?

  4. #24
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Now you are going to mixed up. That is another approach actually. What happened on that code. Did you run it and have a test?
    yes sir i test it like that

    Java Code:
    JLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
                public void mouseClicked(java.awt.event.MouseEvent evt) {
            
              System.out.println("It it working") ; 	
                	                
                }
            });
    Sir i am 100% new so

    Plz help me

  5. #25
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Now what you have to do is, run the browser with the url. Search on Google that how to run the browser in Java. There are lots of examples on the web.

  6. #26
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Now what you have to do is, run the browser with the url. Search on Google that how to run the browser in Java. There are lots of examples on the web.
    Sir i am fiending but still i am not geting...

  7. #27
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    Now what you have to do is, run the browser with the url. Search on Google that how to run the browser in Java. There are lots of examples on the web.
    Sir i am not geting plz help me

  8. #28
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    There are hundreds of examples available. Search the Google Mir, try to find. I don't know why you behave like this.

  9. #29
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    There are hundreds of examples available. Search the Google Mir, try to find. I don't know why you behave like this.
    Sorry Sir

    I search from google,i got some example but i haven't found any code for that .So i ask from you.. I am never going to hurt any one.But i am not geting so i ask.You know me..

    Thxs

  10. #30
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    What you mean, you say that found an example but not a code. I'm really wired with that. Example should be a code, in JAVA!!!!

    How did you search on the Google? And what are the example you found?

  11. #31
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    What you mean, you say that found an example but not a code. I'm really wired with that. Example should be a code, in JAVA!!!!

    How did you search on the Google? And what are the example you found?


    Search key word is

    Java Code:
    How to  run the browser in Java
    And i am geting result url is

    Java Code:
    www.javatester.org/ 
    sunnytalkstech.blogspot.com/2008/04/java-applets-don-run-in-browser-anymore.html -

    like this

  12. #32
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by Eranga View Post
    What you mean, you say that found an example but not a code. I'm really wired with that. Example should be a code, in JAVA!!!!

    How did you search on the Google? And what are the example you found?


    Sir Plz help me last time...

  13. #33
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Sir i hope this time you do something for me

  14. #34
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    7

    Default Windows processes

    Hello Mir

    Using Google is a skill that we learn through experience. Look at this site if you want to learn more. I used Google to research this topic and I found what I needed. Then I learned what the content meant and I applied it. Here is my solution based on the Windows operating system:
    processes.HyperLabel.java
    Java Code:
    package processes;
    
    import java.awt.Color;
    import java.awt.Cursor;
    import java.awt.Graphics;
    import java.awt.event.*;
    import javax.swing.JLabel;
    
    /**
     * HyperLabel is an extension of the JLabel class that allows the user to
     * open a new browser at the specified URL
     * @author Tim
     */
    public class HyperLabel extends JLabel implements MouseListener {
        private String URL = "http:\\www.google.com";
    
        public String getURL() {
            return URL;
        }
    
        public void setURL(String URL) {
            this.URL = URL;
            this.setCursor(new Cursor(Cursor.HAND_CURSOR));
            this.setForeground(Color.BLUE);
        }
    
        public HyperLabel(String text, String URL) {
            super(text);
            this.setURL(URL);
            this.addMouseListener(this);
        }
    
        public void mouseClicked(MouseEvent e){
    [COLOR="DarkOrchid"]        try{
                String command = "start " + this.URL;
                Process process = Runtime.getRuntime().exec("cmd /c \"" + command + "\"");
            } catch (Exception exception){
                System.out.println("Exception caught : " + exception.getMessage());
            }
    [/COLOR]    }
    
        public void mouseEntered(MouseEvent e) {
        }
    
        public void mouseExited(MouseEvent e) {
        }
    
        public void mousePressed(MouseEvent e) {
        }
    
        public void mouseReleased(MouseEvent e) {
        }
        
        public void paint(Graphics graphis){
            super.paint(graphis);
            graphis.setColor(this.getForeground());
            graphis.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
        }
    
    }
    And an example of how one would use a HyperLabel
    processes.Main.java
    Java Code:
    package processes;
    
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.Font;
    import javax.swing.JFrame;
    
    /**
     * Demonstates the usage of a hyperlink label
     * @author Tim
     */
    public class Main extends JFrame{
        private HyperLabel lblHyper;
        public Main() {
            super("Processes");
            this.setSize(200, 70);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setLocationByPlatform(true);
            this.setLayout(new FlowLayout());
            lblHyper = new HyperLabel("Google", "http:\\www.google.com");
            this.add(lblHyper);
            this.setVisible(true);
        }
        
        public static void main(String[] args) {
            new Main();
        }
        
    }
    Quote Originally Posted by Mir
    Sir i hope this time you do something for me
    Mir, Eranga was trying to help you. He wanted your input on the matter. I gave you a solution because it allowed me to learn how to start processes using java. If you want to know more a about the purple section of code, or any other section, then ask. Otherwise, please mark this thread is solved. :)

    Thank you Eranga ;)
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  15. #35
    Niveditha's Avatar
    Niveditha is offline Senior Member
    Join Date
    May 2008
    Posts
    307
    Rep Power
    7

    Default

    Search in google about mouseListener in Java Mir, it will give u alot of examples....
    To finish sooner, take your own time....
    Nivedithaaaa

  16. #36
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Quote Originally Posted by tim View Post
    Hello Mir

    Using Google is a skill that we learn through experience. Look at this site if you want to learn more. I used Google to research this topic and I found what I needed. Then I learned what the content meant and I applied it. Here is my solution based on the Windows operating system:
    processes.HyperLabel.java
    Java Code:
    package processes;
    
    import java.awt.Color;
    import java.awt.Cursor;
    import java.awt.Graphics;
    import java.awt.event.*;
    import javax.swing.JLabel;
    
    /**
     * HyperLabel is an extension of the JLabel class that allows the user to
     * open a new browser at the specified URL
     * @author Tim
     */
    public class HyperLabel extends JLabel implements MouseListener {
        private String URL = "http:\\www.google.com";
    
        public String getURL() {
            return URL;
        }
    
        public void setURL(String URL) {
            this.URL = URL;
            this.setCursor(new Cursor(Cursor.HAND_CURSOR));
            this.setForeground(Color.BLUE);
        }
    
        public HyperLabel(String text, String URL) {
            super(text);
            this.setURL(URL);
            this.addMouseListener(this);
        }
    
        public void mouseClicked(MouseEvent e){
    [COLOR="DarkOrchid"]        try{
                String command = "start " + this.URL;
                Process process = Runtime.getRuntime().exec("cmd /c \"" + command + "\"");
            } catch (Exception exception){
                System.out.println("Exception caught : " + exception.getMessage());
            }
    [/COLOR]    }
    
        public void mouseEntered(MouseEvent e) {
        }
    
        public void mouseExited(MouseEvent e) {
        }
    
        public void mousePressed(MouseEvent e) {
        }
    
        public void mouseReleased(MouseEvent e) {
        }
        
        public void paint(Graphics graphis){
            super.paint(graphis);
            graphis.setColor(this.getForeground());
            graphis.drawLine(0, this.getHeight() - 1, this.getWidth(), this.getHeight() - 1);
        }
    
    }
    And an example of how one would use a HyperLabel
    processes.Main.java
    Java Code:
    package processes;
    
    import java.awt.Color;
    import java.awt.FlowLayout;
    import java.awt.Font;
    import javax.swing.JFrame;
    
    /**
     * Demonstates the usage of a hyperlink label
     * @author Tim
     */
    public class Main extends JFrame{
        private HyperLabel lblHyper;
        public Main() {
            super("Processes");
            this.setSize(200, 70);
            this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
            this.setLocationByPlatform(true);
            this.setLayout(new FlowLayout());
            lblHyper = new HyperLabel("Google", "http:\\www.google.com");
            this.add(lblHyper);
            this.setVisible(true);
        }
        
        public static void main(String[] args) {
            new Main();
        }
        
    }
    Mir, Eranga was trying to help you. He wanted your input on the matter. I gave you a solution because it allowed me to learn how to start processes using java. If you want to know more a about the purple section of code, or any other section, then ask. Otherwise, please mark this thread is solved. :)

    Thank you Eranga ;)
    Thxs both of you(Erange And Windows processes)

    When click on
    Java Code:
    google
    link then web page not open error is

    Java Code:
    The page cannot be displayed

  17. #37
    Mir
    Mir is offline Senior Member
    Join Date
    Mar 2008
    Posts
    447
    Rep Power
    7

    Default

    Hi Windows processes

    can i use JLabel in place of HyperLabel..

  18. #38
    daGame is offline Member
    Join Date
    May 2008
    Posts
    24
    Rep Power
    0

    Default Wtf

    Quote Originally Posted by Mir View Post
    Hi Windows processes
    Who the fc*k is windows processes?

  19. #39
    tim's Avatar
    tim
    tim is offline Senior Member
    Join Date
    Dec 2007
    Posts
    435
    Rep Power
    7

    Default My name and Retry

    Hello Mir.
    Quote Originally Posted by Mir
    Hi Windows processes
    On the Forums, my name is Tim.
    Quote Originally Posted by daGame
    Who the fc*k is windows processes?
    Swearing, daGame, degrades our Forums and I do not agree with the usage of such language on Java Forums. Mir made a simple mistake as we are all human.
    Quote Originally Posted by Mir
    can i use JLabel in place of HyperLabel..
    In Java, if you want a GUI component to behave differently than normal, then you must derive a new component from it. It is different from other languages, say Visual Basics or Pascal, where new methods are added for new events for different components. That is why I created HyperLabel. The HyperLabel will handle any special events, a click in this example, without the knowledge of the user. This is called encapsulation, which is another reason I did this.
    Quote Originally Posted by Mir
    Java Code:
    The page cannot be displayed
    Try changing the URL to
    Java Code:
    http://www.google.com
    If this doesn't work then the problem is elsewhere. However, it is strange that you got an error, because it works fine on my machine. ;)

    Good luck Mir :D
    Eyes dwelling into the past are blind to what lies in the future. Step carefully.

  20. #40
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

    Default

    Mir, you got lots of explanation on this. As Tim, Neviditha says I'm trying to help you. I have exact code you want with me. Because I have already done those kind of things thousand times in my life up to now. I can just copy-paste the code here. But that's not the point here in our community.

    Forum is a place discuss some matters/issues with friends all over the world. So you can gather wast knowledge from there. Because people have different levels of knowledge in the field. Just asking code/help like you Mir, it's not good.

    So try all suggestions you have. That code given by Tim working extremely fine. So the problem is in your side.

Page 2 of 5 FirstFirst 1234 ... LastLast

Similar Threads

  1. Replies: 0
    Last Post: 04-01-2008, 04:14 PM
  2. Hide hyperlink address on status bar
    By simon in forum JavaServer Pages (JSP) and JSTL
    Replies: 2
    Last Post: 07-24-2007, 10:34 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •