Page 4 of 5 FirstFirst ... 2345 LastLast
Results 61 to 80 of 92
  1. #61
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

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

    Default

    Quote Originally Posted by Eranga View Post
    So, that what you want to do right? Open the web page.
    Both open web page and Outlook...But according label click.When i click on WebPage label then open web page and when i click on outlook label then open outlook..

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

    Default

    Quote Originally Posted by Eranga View Post
    So, that what you want to do right? Open the web page.
    Sir i am in big problem..If you want to listen my problem regarding programing then i will told you....

  4. #64
    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

    So do it two labels. Seems to me you have called both events(web page and outlook) in the same label. Is it?

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

    Default

    Quote Originally Posted by Eranga View Post
    So do it two labels. Seems to me you have called both events(web page and outlook) in the same label. Is it?
    Yes sir..I have two label

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

    Default

    Quote Originally Posted by Eranga View Post
    So do it two labels. Seems to me you have called both events(web page and outlook) in the same label. Is it?
    Sir if you don't miend then i want to ask something rellated to code...

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

    Default

    Quote Originally Posted by Mir View Post
    Sir if you don't miend then i want to ask something rellated to code...
    Sir may i ask some question..

  8. #68
    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

    Quote Originally Posted by Mir View Post
    Yes sir..I have two label
    If you have two labels, and if you implemented two events in two labels separately it should work. Still you get the same result, that mean somewhere in your code, referring the same label or any issue.

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

    Default

    Quote Originally Posted by Eranga View Post
    If you have two labels, and if you implemented two events in two labels separately it should work. Still you get the same result, that mean somewhere in your code, referring the same label or any issue.
    No sir i add only one event mouseClicked(MouseEvent e).And i have no idea which event i add for next label.

  10. #70
    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

    That's the case. You have to use one click event for each component. That means you need two events for two labels.

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

    Default

    Quote Originally Posted by Eranga View Post
    That's the case. You have to use one click event for each component. That means you need two events for two labels.
    Yes sir i think so..But how can i add this..

  12. #72
    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

    I don't know what you are talking about. You have already done it for one component. Still you can't do the same thing for the other?

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

    Default

    Quote Originally Posted by Eranga View Post
    I don't know what you are talking about. You have already done it for one component. Still you can't do the same thing for the other?
    Sorry sir i will do..

    Thxs for help

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

    Default

    Hello Sir

    I was start new question title is Unexpected Error .I havn't understand why it work like that.Plz see my code.I was post there sir...

    Plz help me

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

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

    Default

    Quote Originally Posted by Eranga View Post
    Where you post your code?
    in the forum(new java forum) new topic name is Unexpected Error.And there i post i code..

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

    Default

    Quote Originally Posted by Eranga View Post
    Where you post your code?
    Question is

    Unexpected Error
    Hi all

    I am in big problem.When i run the code every thing is work fine.But when i run exe of this code then i am facing problem.What happen when i click on About Dialog then exe close autometically.All other menu is working..

    If any one need my code of About Dialog then i will give..


    here is code
    Java Code:
    package main;
    import java.awt.*;
    import javax.swing.*;
    import java.awt.event.*;
    import java.awt.Color;
    import java.awt.Cursor;
    import java.awt.Graphics;
    import javax.swing.JLabel;
    
    /*
     *
     * AboutDlg
     *
     */
    public class AboutDlg extends JDialog implements MouseListener 
    {
    	  private String URL = "http://www.yahoo.com";
    	  
    	  private String Email = "abc@yahoo.com";
    	  
    	  
    	  
    	public String getURL() {
            return URL;
         
    
        }
    	
    	  public void setURL(String URL) {
    	        this.URL = URL;
    	      
    	    }
    	  
    	  public void setEmail(String URL) {
    	        this.Email = Email;
    	        
    	    }
    	  
    	  
    	 
    	  
    
    	public AboutDlg(Frame parent)
    	{
    		super();
    		 
      
    	    JLabel Dru =  new JLabel( "                                      Email : abc@yahoo.com" , JLabel.LEFT);
    
    	     JLabel Drw =  new JLabel( "                                          http://www.yahoo.com" , JLabel.LEFT);
    	     
    	   
    	     AboutDlg.setDefaultLookAndFeelDecorated(true);
    	     
    	     this.setURL(URL);
    	     Drw.addMouseListener(this);
    	     Drw.setCursor(new Cursor(Cursor.HAND_CURSOR));
    	     Drw.setForeground(Color.BLUE);
    	     
    	     this.setEmail(Email);
    	     Dru.addMouseListener(this);
    	     Dru.setCursor(new Cursor(Cursor.HAND_CURSOR));
    	     Dru.setForeground(Color.BLUE);
    	     
    	    
    	
    	  	     
    	      Font f3= new Font("Terminal", Font.PLAIN, 12);
    	      
    	      
    	      
    	
    	      Dru.setFont(f3);
    	      Drw.setFont(f3);
    	      
    	     
    		setTitle( "About" ) ;
    	
    		setContentPane( new MyPanel() ) ;
    
    	    getContentPane().setLayout(new FlowLayout());   
    	   
    		
    	    
    	
    	
    		getContentPane().add(Drw );
    		getContentPane().add(Dru );
    		getContentPane().add( new Button("   OK   "));
    		
    
    
    		
    		setSize( 300 ,225 ) ;
    
    	
    		Point fatherLocation = parent.location();
    		move(fatherLocation.x + 150,fatherLocation.y + 200);
    		show();
    
    	}
    	
    	
    	 public void mouseClicked(MouseEvent e){
    	        try{
    	            String command = "start " + this.URL;
    	            Process process = Runtime.getRuntime().exec("cmd /c \"" + command + "\"");
    	          //Following line works as it should.
    	            
    	            Runtime.getRuntime().exec("cmd.exe /c start mailto:abc@yahoo.com");
    	    	
    
    	            
    	            
    	            
    	        } catch (Exception exception){
    	            System.out.println("Exception caught : " + exception.getMessage());
    	        }
    	    }
    	 
    	
    	 
    	 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);
    	    }
    
    	
    	public class MyPanel extends JPanel {
    		private Image img ;
    		public MyPanel() {
    			setLayout( new BorderLayout() ) ;
    			img = new ImageIcon("logod.jpg").getImage() ;
    		
    			if( img == null ) {
    				System.out.println( "Image is null" );
    				System.exit( 1 ) ;
    			}
    			if( img.getHeight(this) <= 0 || img.getWidth( this ) <= 0 ) {
    				System.out.println( "Image width or height must be +ve" );
    				System.exit( 2 ) ;
    			}
    		}
    		public void drawBackground( Graphics g ) {
    			int w = getWidth() ;
    			int h = getHeight() ;
    			int iw = img.getWidth( this ) ;
    			int ih = img.getHeight( this ) ;
    			for( int i = 0 ; i < w ; i+=iw ) {
    				for( int j = 0 ; j < h ; j+= ih ) {
    					g.drawImage( img ,0,9 , this ) ;
    				}
    						}
    		
    		}
    		protected void paintComponent(Graphics g) {
    			super.paintComponent(g);
    			Color underline = getForeground();
    
    			g.setColor(underline);
    
    			drawBackground( g ) ;
    		}
    	}
    	
    	
    
    	public boolean action (Event evt, Object arg)
    	{
    		if (evt.target instanceof Button)
    		{
    			hide();
    			dispose();
    			return true;
    		}
    		return false;
    	}
    	
    
    	private boolean updateDB()
    	{
    		
    		hide();
    		dispose();
    		return true;
    	}
    	public boolean handleEvent (Event event) 
    	{
    		switch (event.id) {
    		case Event.WINDOW_DESTROY:
    			dispose();
    			return true;
    		default:
    			return super.handleEvent(event);
    		}
    	}
    
    
    
    
    }

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

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

    Default

    Quote Originally Posted by Eranga View Post
    Where you post your code?
    Quote Originally Posted by Eranga View Post
    I don't get such an exception there.
    Sir what happen..My code is run well but when i make .exe then i am getting problem.

    Sir i also found where is error but i am not abel to think why it is showing error..

    Can you help becouse it's a real problem for me..

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

Page 4 of 5 FirstFirst ... 2345 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 04-01-2008, 05: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, 11: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
  •