Location of Icon in JLabel

I am writing an application that responds to a mouse click in a JLabel. This Icon has to move as the window resizes (as default in GridLayout). Despite this I need to be able to translate clicking on the top corner of the ImageIcon to clicking on (0,0).
I know that this top corner will be red, so I could search the JLabel for the first pixel of that color. I'm not sure how to do that though.
If there is an easier way to figure out where the top corner of a particular icon in a label is, though, it would be greatly appreciated.
Thanks in advance,
Sarah

This is the function from BasicLabelUI that is used to position the icon.
iconR is the icon Rectangle.
    protected String layoutCL(
        JLabel label,                 
        FontMetrics fontMetrics,
        String text,
        Icon icon,
        Rectangle viewR,
        Rectangle iconR,
        Rectangle textR)
        return SwingUtilities.layoutCompoundLabel(
            (JComponent) label,
            fontMetrics,
            text,
            icon,
            label.getVerticalAlignment(),
            label.getHorizontalAlignment(),
            label.getVerticalTextPosition(),
            label.getHorizontalTextPosition(),
            viewR,
            iconR,
            textR,
            label.getIconTextGap());
    }This is the call to this method:
        JLabel label = (JLabel)c;
        String text = label.getText();
        Icon icon = (label.isEnabled()) ? label.getIcon() : label.getDisabledIcon();
        if ((icon == null) && (text == null)) {
            return;
        FontMetrics fm = SwingUtilities2.getFontMetrics(label, g);
        Insets insets = c.getInsets(paintViewInsets);
        paintViewR.x = insets.left;
        paintViewR.y = insets.top;
        paintViewR.width = c.getWidth() - (insets.left + insets.right);
        paintViewR.height = c.getHeight() - (insets.top + insets.bottom);
        paintIconR.x = paintIconR.y = paintIconR.width = paintIconR.height = 0;
        paintTextR.x = paintTextR.y = paintTextR.width = paintTextR.height = 0;
        String clippedText =
            layoutCL(label, fm, text, icon, paintViewR, paintIconR, paintTextR);

Similar Messages

  • HT4528 I recently downloaded the newest software and now my Iphone 4s shows the location services Icon is on all the time.  How can I change this back to what we originally had or is there a fix for this?

    When I downloaded the most recent software update the location services Icon showed up even thought I was not running any programs.  Is this something new and is it going to drain my battery?  This was not happening before the download.  I am told I have to just turn off the location services biut I do use them on a daily basis and it seems to be a pain to have to shut if off everytime.  Does anyone know how to fix this or am I just screwed until I upgrade the phone?

    Hi Avahhava,
    Welcome to the Support Communities!
    As a first step, I would suggest restarting and/or resetting the iPhone:
    iOS: Turning off and on (restarting) and resetting
    http://support.apple.com/kb/HT1430
    If you have tried those two things, refer to page 146 in the iPhone User Guide to Reset All Settings:
    iPhone User Guide
    manuals.info.apple.com/MANUALS/1000/MA1565/en_US/iphone_user_guide.pdf
    Cheers,
    - Judy

  • I can't locate an icon...

    ...I can't locate an icon for the "YouTube to MP3 1.2.3" ("Video2MP3.net") add-on...?
    Thank you.

    hello, please note that addons are developed independently from mozilla & we can't give support for each of them. many user comments on the addon page for "YouTube to MP3" also state that they are having problems, so you might consider this extension generally broken. have look around for alternatives at addons.mozilla.org instead.

  • Location service icon keeps appearing on iPhone4

    I am not sure since which app i've installed, my iPhone4 keeps location service icon displays on the menu bar for ever.
    I've quitted all background processes or restart the phone, but the icon is still there.
    Is that because i enable find my phone?

    chagel wrote:
    The icon keeps appearing when I enable location service for Google Latitude, and it's gone after I disable this app.
    This is how it's supposed to work, after you close the app using location services, the icon should be gone again.

  • Location services icon blinks on even when no notifications are being used also recently used services should have a purple arrow but mine is grey

    My location indicator icon on the tool bar seems to blink on randomly even when I have not used any services.  Also when I do use a service I am not seeng the purple icon in the pricacy-location services appearing next to the recently used icon it seems to stay grey.  Any ideas?  Is this a bug perhaps?

    I experience the same thing today.  After hanging up from a regular phone call, I noticed the location services icon showing on the status screen of my phone for a split second.  I always have my location services off.  I checked my privacy settings and there was no record of any program using the location services.  What is going on Apple?  I was in a familar and secure WiFi network.  Is location services secretly turning on thru wifi? 

  • HT1975 How can I reset the gray location services icon that apears next to the app that used my location services in the past 24 hours? Or better yet is there a way to track how many times it's been doing it in the past 24 hours?

    My boyfriend likes to check up on me by using find my iPhone app. Sometimes I feel he goes overboard and would like to know how often he is watching me. The gray icon is always there because he watches me every day, but if there is a way to reset it do that I can check it time after time and see if he watched me again since the last time I checked. Or is there a way or an app that tracks how many times a devise has been tracked? I don't want to change my password because I like knowing that if I get lost in the woods he would find me :)) I just want to know his often he is watching me.

    Understood.  However, the point that I'm trying to make is that it's not the WiFi access point's security that's in question, it's having your phone's WiFi in an always-on mode that's in question.  It's simple: if your phone's WiFi is on, then it is both discoverable and hackable... even when it's not connected to a WiFi network or access point.  Here's an article about a drone in London that was created to hack smartphone WiFi signals (and hackers have been doing what this drone does for years):
    http://money.cnn.com/2014/03/20/technology/security/drone-phone/
    The point is that it's not  secure to have your phone's WiFi in an always-on mode.  It would be better for privacy and security if Apple made WiFi location aware so that it is only enabled when you are at a trusted location (e.g. your home or office).  Or, at least give us the option of location aware WiFi so that each user can determine the best mode for their phone:
    (1) Always-On (current default - not secure and many privacy issues).
    (2) Trusted mode (only on at trusted locations).
    (3) Off.

  • Icon in JLabel

    I tried to add a JLabel on a Panel(of Border Layout). The icon in the Label is not shown. Same problem occurs when I tried to add a JButton, I can see only the text not the icon. I tried different iconTextGap values also. The icons doesn't showup

    Actually Iam using Forte4j, I add my controls in the form itself and set the properties also through form.
    jLabel1.setIcon (new javax.swing.ImageIcon ("F:\\try_panel_glcanvas\\src\\images\\logo.gif"));
    added to java.awt.Panel ,
    myTitleBar.add (jLabel1, java.awt.BorderLayout.WEST);
    regards

  • Custom Icon in JLabel - center?

    I have a custom Icon that I am placing in a JLabel, but I can't get it to be centered!
    I can put an ImageIcon in the JLabel, and it will be centered, but my custom Icon doesn't seem to follow the setVerticalAlignment/setHorizontalAlignment properties.
    I am using java 1.3.1.
    Any suggestions?

    The first thing I would do is check the frame of the custom icon to see if it is bigger than the picture...that could be the problem.

  • Can't locate Bonjour icon on Internet Explorer or in Programs list

    Hello Guys
    Downloaded the file BonjourSetup.exe and run it. Got indication that "installed successfuly"
    Now I can't locate the Program icon not on the "PROGRAMS" neither in the windows explorer 7 which I use, even not on the desktop
    Can some one advise ?

    Hi Hashley
    I realy appreciate your time and answer
    I followed your instructions with out dissabling the anty virus...
    I managed to find the Bonjoure in the view toolbars (using XP with IE7
    Yet I can't make the connection between my iPhone and PC...
    I am sure I made something wrong...
    I followed the instructions in the iFiles application ant typed: http://Abraham-Levys-iPhone.local:8080 but no result (here I should see that iPhone is connected to the PC and then to upload files
    Do you have any idea ?
    Do you use the iFiles application ?
    Again thanks for your patience with Me
    Abraham, Israel

  • Heavyweight object of an Icon and JLabel

    Hi there,
    I would like to know how can I create a heavyweight object that has a JLabel and an Icon and then add it to a JFrame. this heavyweight object would be something like this
    public class TestObject extends JPanel
    ..public TestObject( String LabelName )
    ....theLabel = new JLabel( LabelName );
    ....add( theIcon ); // I cant add the Icon here, because it's not a Component
    ....add( theLabel );
    ..private JLabel theLabel;
    ..private Icon theIcon = new ImageIcon( "littleIcon.gif" );
    Thanks,
    Andre

    Using the following class I could draw a JLabel that has an ImageIcon, but it doesn't matter what the value of the horizontalAlignment ( LEFT, CENTER, RIGHT, LEADING or TRAILING ) the icon was always at the left side and the string at the right. Is there a way to put the Icon on the top and the String at the button of the Label?
    public class TestObject extends JPanel
    public TestObjectent( String LabelName )
    theIcon = new ImageIcon( "littleIcon.gif" );
    theLabel = new JLabel( LabelName theIcon, SwingConstants.TRAILING );
    add( theLabel );
    private Icon theIcon;
    private JLabel theLabel;
    Thanks,
    Andre

  • Location of Text in JLabel

    Hi, I want to retrieve the location co-ordinates from a JLabel.
    I know that JLabel.getPreferredSize() gets the size of the actual text but I also need to know where in the JLabel the text is located.
    This is because I want to create an image out of it and need specified co-ordinates (x,y,width,height).
    //Considerate

    The preferred size of the label is equal to the size of the text plus the insets of the label. Use the getInsets() method.

  • Draw image icon on JLabel

    Does anyone know how I can paint an icon on an already existing JLabel image without having the original image disappear partially or completely?
    The way I have it set up right now is that the original image listens to MouseListener, and displays information on a textArea when I click on the map.
    What I wish to do is to display an icon on the map image whenever I click on it.
    I'm a rather amateur with Java, and don't know how to make interfaces interact with eachother, no matter how hard I try. I need to know if I can add something to my current code to get what I want. I have had tried to interact different classes with eachother, but I haven't been getting what I wanted. Please help me out!
    I know how to display the icon on another panel, and make it move. but not on the same panel on the original picture.
    Here's my code:
    package screem.netrol.communication.event;
    * @author Nazli
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.Component;
    import java.awt.Image;
    import java.awt.Color;
    import javax.swing.*;
    import javax.swing.ImageIcon;
    import java.net.*; // For class URL.
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.border.TitledBorder;
    import javax.swing.event.MouseInputAdapter;
    import java.applet.*;
    public class MyMapPanel extends JPanel implements DataTurbineListener, MouseListener, ImageObserver
    final static String newline = "\n";
    JTextArea textArea; //= new JTextArea();
    public static String url;
    public static ImageIcon ic;
    public static ImageIcon ic2 = new ImageIcon("http://www-jkn.ee.uec.ac.jp/tnklab/96/nakazawa/icons/colorball/small/BALL120.gif");
    public static JLabel mapArea;
    //public static JApplet mapArea;
    //public static File output = new File("results.txt");
    public static boolean showPoint;
    public static int x;
    public static int y;
    private BufferedImage bufImg ;
    private Image smallImg ;
    int w;
    int h;
    /*public static BufferedImage bufImg ;
    public static Image smallImg ; */
    /* GeneralPath path;
    final int PAD = 20;
    final int N = 8; */
    public static MyJFrame f;
    public MyMapPanel() {}
    public MyMapPanel(ImageIcon ic)
    super(new FlowLayout (FlowLayout.CENTER, 0,0));
    textArea = new JTextArea();
    setImageIcon(ic);
    textArea.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    add(scrollPane);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize(new Dimension(700,100));
    //getContentPane().add(new MyPanel(), BorderLayout.CENTER);
    //addMouseListener( new MusClk() ) ;
    protected class MusClk extends MouseAdapter {
    public void mouseClicked ( MouseEvent musEvt ) {
    if( musEvt.getX() > bufImg.getWidth() || musEvt.getY() > bufImg.getHeight() ) {
    return ;
    Graphics g = bufImg.getGraphics() ;
    int w = smallImg.getWidth( null ) ;
    int h = smallImg.getHeight( null ) ;
    g.drawImage( smallImg , musEvt.getX() - w / 2 , musEvt.getY() - h / 2 , null ) ;
    MyMapPanel.this.repaint( musEvt.getX() - w / 2 , musEvt.getY() - h / 2 , w , h ) ;
    public ImageIcon getImageIcon()
    setImageIcon(ic);
    return ic;
    public void setImageIcon(ImageIcon ic)
    //MyPanel panel = new MyPanel();
    try{
    URL u = new URL(url);
    ic = new ImageIcon(u);
    } catch (MalformedURLException e) {
    System.out.println (e);
    mapArea = new JLabel(ic, JLabel.CENTER);
    add(mapArea);
    mapArea.addMouseListener(this);
    try {
    URL u = new URL(url);
    ic = new ImageIcon(u);
    } catch (MalformedURLException e){
    System.out.println(e);
    mapArea = new JApplet();
    add(mapArea);
    mapArea.addMouseListener(this); */
    /* public void setMouseEvent(MouseEvent e)
    x = e.getX();
    y = e.getY();
    showPoint = true;
    protected void paintComponent(Graphics g){ }
    public void dataTurbineOutputEvent(DataTurbineEvent event){}
    public void dataTurbineInputEvent(DataTurbineEvent event){}
    public void mouseReleased(MouseEvent e){}
    public void mousePressed(MouseEvent e) { }
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) { }
    public void mouseClicked(MouseEvent e)
    //setMouseEvent(e);
    //System.out.println("x="+x+" y="+y);
    showPoint = true;
    ImageIcon icon = new ImageIcon("C:/Documents and Settings/Nazli/My Documents/My Pictures/ball.gif");
    w = icon.getIconWidth();
    h = icon.getIconHeight();
    bufImg = new BufferedImage(w , h , BufferedImage.TYPE_INT_RGB ) ;
    Graphics g = bufImg.getGraphics();
    g.drawImage( icon.getImage() , 0 , 0 , null ) ;
    //MyMapPanel.this.repaint(e.getX() - w / 2 , e.getY() - h / 2 , w , h ) ;
    /*Point p = e.getPoint();
    Rectangle tag;
    final int SIDE = 6;
    tag = new Rectangle(0, 0, SIDE, SIDE);
    float x = e.getX();
    float y = e.getY();
    tag.setLocation(p.x - SIDE/2, p.y - SIDE/2);
    if(tag.contains(p.x,y))
    showPoint = true;
    setPoint(p);
    //System.out.println("e.getX="+e.getX()+""+"e.getY="+e.getY());
    saySomething("Position in pixels:(" + e.getX() + ", " + e.getY() + ")", e);
    String s1 = computeLatLong(e.getX());
    String s2 = computeLatLong(e.getY());
    saySomething("Position in Lat/Long: (" + s1 + ", " + s2 + ")", e);
    //g.drawImage(img, e.getX(), e.getY(), this);
    //DrawImage d = new DrawImage();
    //public void mouseClicked ( MouseEvent musEvt ) {
    //DrawImage d = new DrawImage();
    void saySomething(String eventDescription, MouseEvent e)
    textArea.append(eventDescription + " detected on " + e.getComponent().getClass().getName() + "." + newline);
    textArea.setCaretPosition(textArea.getDocument().getLength());
    public String computeLatLong(double d)
    double d1;
    double seconds;
    double minutes;
    double m;
    double s;
    String rval;
    d1 = d - Math.floor(d);
    seconds = d1 / 3600;
    minutes = seconds / 60;
    m = minutes - Math.floor(minutes);
    s = m * 60; //minutes converted to seconds
    rval = (int)Math.floor(d) + "deg " + (int)minutes + "' " + (int)s + '"';
    return rval;
    public MyJFrame getFrame()
    return f;
    public static void main(String[] args) throws IOException {
    //DrawImage d = new DrawImage();
    System.out.println("x="+x+" y="+y);
    ArrayList file = new ArrayList();
    File input = new File("lat_lon.txt");
    FileReader in = new FileReader(input);
    File output = new File("archive3.txt");
    FileWriter out = new FileWriter(output);
    //FileWriter in2 = new FileWriter(input);
    FileOutputStream outdata = new FileOutputStream(output);
    PrintStream p = new PrintStream(outdata);
    BufferedReader br = new BufferedReader(in, 4096);
    BufferedWriter bw = new BufferedWriter(new FileWriter("lat_lon.txt", true));
    String line; //each line in input file
    String s=null; //Main string containing points information, to be written to the output file
    while ((line = br.readLine()) != null )
    file.add(line);
    StringTokenizer st = new StringTokenizer(line,";");
    while(st.hasMoreTokens())
    s = st.nextToken();
    p.println(s);
    p.println("FINISHED DATA TRANSFER");
    p.println("\n");
    bw.write("DATA TRANSFERRED TO OUTPUT FILE");
    bw.newLine();
    bw.flush();
    p.close();
    //pops up the input dialogue window for the user to enter the image URL
    url = JOptionPane.showInputDialog(null,"Provide image URL:\n","Map Image", JOptionPane.PLAIN_MESSAGE);
    MyMapPanel panel = new MyMapPanel();
    if(url != null)
    panel.setImageIcon(ic);
    MyMapPanel mp = new MyMapPanel(ic);
    MyPanel panel2 = new MyPanel();
    //MyMapPanel mp2 = new MyMapPanel();
    JFrame jf = new JFrame();
    f = new MyJFrame(700,400);
    f.getContentPane().add(mp);
    //f.getContentPane().add(panel2);
    public static class MyJFrame extends JFrame {
    // Constructor.
    public MyJFrame (int width, int height)
    // Set the title and other frame parameters.
    this.setTitle ("GPS Map");
    this.setResizable (true);
    this.setSize (width, height);
    // Create and add the panel.
    MyMapPanel panel = new MyMapPanel();
    //MyPanel p = new MyPanel();
    //this.getContentPane().add (panel);
    this.getContentPane().add(panel);
    // Show the frame.
    this.setVisible (true);
    }

    Hi,
    I'm sorry that I didn't use the buttons to make the code readable for you. and I'm sure you don't want to hear how hectic my mind has been for the past few weeks, so I'm not going to explain why I didn't pay attention to the formatting. Although, I think it could have been possible to address my mistake in a less aggressive manner.
    Here's my code in a better readable format. I appreciate your advice, it looks so much better now. I'd very much appreciate it if you can go over it.
    In regards to your previous solution, I have to say that I've tried it before, but it hasn't worked for me, possibly because I'm not sure how to use it.
    * @author Nazli
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.Component;
    import java.awt.Image;
    import java.awt.Color;
    import javax.swing.*;
    import javax.swing.ImageIcon;
    import java.net.*; // For class URL.
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    import java.io.*;
    import java.util.*;
    import java.awt.event.*;
    import java.awt.geom.*;
    import javax.swing.border.TitledBorder;
    import javax.swing.event.MouseInputAdapter;
    import java.applet.*;
    public class MyMapPanel extends JPanel implements DataTurbineListener, MouseListener, ImageObserver
    final static String newline = "\n";
    JTextArea textArea; //= new JTextArea();
    public static String url;
    public static ImageIcon ic;
    public static ImageIcon ic2 = new ImageIcon("http://www-jkn.ee.uec.ac.jp/tnklab/96/nakazawa/icons/colorball/small /BALL120.gif");
    public static JLabel mapArea;
    //public static JApplet mapArea;
    //public static File output = new File("results.txt");
    public static boolean showPoint;
    public static int x;
    public static int y;
    private BufferedImage bufImg ;
    private Image smallImg ;
    int w;
    int h;
    /*public static BufferedImage bufImg ;
    public static Image smallImg ; */
    /* GeneralPath path;
    final int PAD = 20;
    final int N = 8; */
    public static MyJFrame f;
    public MyMapPanel() {}
    public MyMapPanel(ImageIcon ic)
    super(new FlowLayout (FlowLayout.CENTER, 0,0));
    textArea = new JTextArea();
    setImageIcon(ic);
    textArea.setEditable(false);
    JScrollPane scrollPane = new JScrollPane(textArea);
    add(scrollPane);
    scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrollPane.setPreferredSize(new Dimension(700,100));
    //getContentPane().add(new MyPanel(), BorderLayout.CENTER);
    //addMouseListener( new MusClk() ) ;
    protected class MusClk extends MouseAdapter {
    public void mouseClicked ( MouseEvent musEvt ) {
    if( musEvt.getX() > bufImg.getWidth() || musEvt.getY() > bufImg.getHeight() ) {
    return ;
    Graphics g = bufImg.getGraphics() ;
    int w = smallImg.getWidth( null ) ;
    int h = smallImg.getHeight( null ) ;
    g.drawImage( smallImg , musEvt.getX() - w / 2 , musEvt.getY() - h / 2 , null ) ;
    MyMapPanel.this.repaint( musEvt.getX() - w / 2 , musEvt.getY() - h / 2 , w , h ) ;
    public ImageIcon getImageIcon()
    setImageIcon(ic);
    return ic;
    public void setImageIcon(ImageIcon ic)
    //MyPanel panel = new MyPanel();
    try{
    URL u = new URL(url);
    ic = new ImageIcon(u);
    } catch (MalformedURLException e) {
    System.out.println (e);
    mapArea = new JLabel(ic, JLabel.CENTER);
    add(mapArea);
    mapArea.addMouseListener(this);
    try {
    URL u = new URL(url);
    ic = new ImageIcon(u);
    } catch (MalformedURLException e){
    System.out.println(e);
    mapArea = new JApplet();
    add(mapArea);
    mapArea.addMouseListener(this); */
    /* public void setMouseEvent(MouseEvent e)
    x = e.getX();
    y = e.getY();
    showPoint = true;
    protected void paintComponent(Graphics g){ }
    public void dataTurbineOutputEvent(DataTurbineEvent event){}
    public void dataTurbineInputEvent(DataTurbineEvent event){}
    public void mouseReleased(MouseEvent e){}
    public void mousePressed(MouseEvent e) { }
    public void mouseEntered(MouseEvent e) {}
    public void mouseExited(MouseEvent e) { }
    public void mouseClicked(MouseEvent e)
    //setMouseEvent(e);
    //System.out.println("x="+x+" y="+y);
    showPoint = true;
    ImageIcon icon = new ImageIcon("C:/Documents and Settings/Nazli/My Documents/My Pictures/ball.gif");
    w = icon.getIconWidth();
    h = icon.getIconHeight();
    bufImg = new BufferedImage(w , h , BufferedImage.TYPE_INT_RGB ) ;
    Graphics g = bufImg.getGraphics();
    g.drawImage( icon.getImage() , 0 , 0 , null ) ;
    //MyMapPanel.this.repaint(e.getX() - w / 2 , e.getY() - h / 2 , w , h ) ;
    /*Point p = e.getPoint();
    Rectangle tag;
    final int SIDE = 6;
    tag = new Rectangle(0, 0, SIDE, SIDE);
    float x = e.getX();
    float y = e.getY();
    tag.setLocation(p.x - SIDE/2, p.y - SIDE/2);
    if(tag.contains(p.x,y))
    showPoint = true;
    setPoint(p);
    //System.out.println("e.getX="+e.getX()+""+"e.getY="+e.getY());
    saySomething("Position in pixels:(" + e.getX() + ", " + e.getY() + ")", e);
    String s1 = computeLatLong(e.getX());
    String s2 = computeLatLong(e.getY());
    saySomething("Position in Lat/Long: (" + s1 + ", " + s2 + ")", e);
    //g.drawImage(img, e.getX(), e.getY(), this);
    //DrawImage d = new DrawImage();
    //public void mouseClicked ( MouseEvent musEvt ) {
    //DrawImage d = new DrawImage();
    void saySomething(String eventDescription, MouseEvent e)
    textArea.append(eventDescription + " detected on " + e.getComponent().getClass().getName() + "." + newline);
    textArea.setCaretPosition(textArea.getDocument().getLength());
    public String computeLatLong(double d)
    double d1;
    double seconds;
    double minutes;
    double m;
    double s;
    String rval;
    d1 = d - Math.floor(d);
    seconds = d1 / 3600;
    minutes = seconds / 60;
    m = minutes - Math.floor(minutes);
    s = m * 60; //minutes converted to seconds
    rval = (int)Math.floor(d) + "deg " + (int)minutes + "' " + (int)s + '"';
    return rval;
    public MyJFrame getFrame()
    return f;
    public static void main(String[] args) throws IOException {
    //DrawImage d = new DrawImage();
    System.out.println("x="+x+" y="+y);
    ArrayList file = new ArrayList();
    File input = new File("lat_lon.txt");
    FileReader in = new FileReader(input);
    File output = new File("archive3.txt");
    FileWriter out = new FileWriter(output);
    //FileWriter in2 = new FileWriter(input);
    FileOutputStream outdata = new FileOutputStream(output);
    PrintStream p = new PrintStream(outdata);
    BufferedReader br = new BufferedReader(in, 4096);
    BufferedWriter bw = new BufferedWriter(new FileWriter("lat_lon.txt", true));
    String line; //each line in input file
    String s=null; //Main string containing points information, to be written to the output file
    while ((line = br.readLine()) != null )
    file.add(line);
    StringTokenizer st = new StringTokenizer(line,";");
    while(st.hasMoreTokens())
    s = st.nextToken();
    p.println(s);
    p.println("FINISHED DATA TRANSFER");
    p.println("\n");
    bw.write("DATA TRANSFERRED TO OUTPUT FILE");
    bw.newLine();
    bw.flush();
    p.close();
    //pops up the input dialogue window for the user to enter the image URL
    url = JOptionPane.showInputDialog(null,"Provide image URL:\n","Map Image", JOptionPane.PLAIN_MESSAGE);
    MyMapPanel panel = new MyMapPanel();
    if(url != null)
    panel.setImageIcon(ic);
    MyMapPanel mp = new MyMapPanel(ic);
    MyPanel panel2 = new MyPanel();
    //MyMapPanel mp2 = new MyMapPanel();
    JFrame jf = new JFrame();
    f = new MyJFrame(700,400);
    f.getContentPane().add(mp);
    //f.getContentPane().add(panel2);
    public static class MyJFrame extends JFrame {
    // Constructor.
    public MyJFrame (int width, int height)
    // Set the title and other frame parameters.
    this.setTitle ("GPS Map");
    this.setResizable (true);
    this.setSize (width, height);
    // Create and add the panel.
    MyMapPanel panel = new MyMapPanel();
    //MyPanel p = new MyPanel();
    //this.getContentPane().add (panel);
    this.getContentPane().add(panel);
    // Show the frame.
    this.setVisible (true);
    }

  • Location Services icon comes on frequently, iOS6 / iPhone 5 ...

    I see it come on often, for no apparent reason. But usually goes off again after a few seconds.
    Seems to happen nearly every time I press the round hardware button to wake-up the phone.
    I've disabled location services for all but a few apps that obviously need it, and none of them are running now. And I've even disabled LS for most system services.
    I've restarted the phone with no apparent change. I don't recall this behavior with the 4S on iOS 5.x.
    Any ideas or guesses?
    Thanks in advance,
    Chris

    Interesting. I think I might have found the culprit. Looks like it was the iOS6 Passport app.
    Looking back I updated the Starbucks app a few days ago. At the time it asked me if I wanted to sync it with Passport. I said "sure." And the LS icon has been coming on frequently ever since, even though Passport wasn't technically running.
    I turned off LS for the Passport app and haven't seen the behavior since.
    Lesson learned.  ;-)

  • Missing location services icon from the first page (ios 6)

    Everything was fine after upgrading to ios 6, but after I used the cellular data the location services disappeared from the first page of settings instead appeared personal hotspot.This is normal or this is a bug and how can I restore everything as it was?

    Ding Ding Ding, we have a winner!  Thanks so much Steve A.  Double tapping the Home button does toggle the player controls on and off from the lock screen.
    I was hoping it would be something simple like that.
    Just wondering, is that functionality explained somewhere?  As I wrote in my first post I did several searches to come up with a fix or explanation for this issue.
    Cheers.
    Shawn

  • Any way to update the location of icons on the pages?

    I have 9 pages of apps and have recently uninstalled about 20 apps. Now there are a lot of empty spaces in my pages. I hate that because when I download a new app it goes on the first empty space instead of on the last page. Is there any way to make all the existing icons take up the empty spaces without having to manually move each one?

    Hello skatrdude19,
    Welcome to the Discussions Boards,
    While there is no way to just have the icons fill the empty spaces, you do have a reset option that will accomplish it.
    Go to Settings > General > Reset.
    You'll see the option to Reset Home Screen Layout.
    Resetting it will fill in those empty spaces, but the arrangement of the resulting icons may require some manual re-arranging to get the icons to the pages you want, and it's not a reversible reset. Once you reset the Home Page layout, you will have to re-arrange icons manually.
    Hope that helps,
    Charles H.

Maybe you are looking for

  • Very slow load times on EXS24 instruments?

    Hi everyone - I have a troublesome problem.. At the moment this only seems to happen garage band instruments loaded in exs24 When I try to load instruments from garageband i get to enjoy the spinning wheel and about 3 minutes of load time [and this w

  • HKey error message when downloading Adobe reader 9

       When trying to download the newest Adobe Reader I keep getting this error message...HKey_local_machine\software\microsoft\windows\current version\run\optional\components\Imail.   verify you have sufficient access to that key.  What does it mean?  

  • KM document iview transport & the document transport in KM.

    We are EP 7.0 SP 18. I have created a KM document iview in dev system and set the Path to document porperty of the document iview to guid of a document in KM. Transported both the iview and KM content to QA system,  epa and kmc files. The iview fails

  • Anitha

    Hi friends please send answers to these questions 1.SAP Methodology mean 2.Implementation mean 3.Down payments mean& Type 4. Reconciliation Account mean 5.Parking & Holding Documents mean 6.Open item & Line item means 7.Sample & Recurring Documents m

  • Hi all, Have a problem, Please let me know urgently.

    Hi All,         I have a scenario like characteristic is having lengh 50.Now I want to create a hierarchy for this characteristic. But Hirarchy allows maximum lengh 32chrs only. So could you please let me know how to create a hirarchy for this charac