JLabel Image Icon lost after added to JLayeredPane

This is probably that is relatively trivial:
I have a created a simple class that extends a JPanel
Within the JPanel I add a JLayeredPane
Within the JLayeredPane I add two JLabels
The two JLabels are image placeholders (set using the *.setIcon method)
Images are set in the JLabels using a public method setImage (for each label respectively)
In the super class that invokes this, the object (myPanel) with the JPanel shows the panel fine along with the JLayeredPane, anyways this is the problem say "myPanel" calls the method setImage (myPanel.setImage...), the image is set in the JLabel componenent in the JLayeredPane but it seems to get erased when a windows goes over!
What am I doing wrong?
Thank you for your time.

import java.awt.*;
import javax.swing.*;
public class Layer_Test extends JFrame {
    public Layer_Test() {
        setTitle("Layer Test");
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        setSize(400,300);
        setLocationRelativeTo(null);
        getContentPane().add(new MyPanel(), BorderLayout.CENTER);
    public static void main(String args[]) {
        new Layer_Test().setVisible(true);
class MyPanel extends JPanel{
    MyPanel(){
        layeredPane = new JLayeredPane();
        label_1 = new JLabel();
        label_2 = new JLabel();
        layeredPane.setPreferredSize(new Dimension(300, 200));
        label_1.setIcon(new ImageIcon(MYPATH+"toolbarButtonGraphics\\general\\About16.gif"));
        label_1.setBounds(0, 0, 16, 16);
        layeredPane.add(label_1, new Integer(1));
        label_2.setIcon(new ImageIcon(MYPATH+"toolbarButtonGraphics\\general\\Copy16.gif"));
        label_2.setBounds(0, 100, 16, 16);
        layeredPane.add(label_2, new Integer(2));
        add(layeredPane);
    private JLabel label_1, label_2;
    private JLayeredPane layeredPane;
    private final String MYPATH = "C:\\Documents and Settings\\Uhres Andr�\\Mes documents\\";
}

Similar Messages

  • Image not appearing after adding adjustment layer?

    My image layer isn't showing after adding an adjustment layer. I'm trying to turn a JPG picture of a nuclear explosion into a 3D/Camera effect.
    I've added one solid layer below the JPG which is just grey. The JPG is in the middle. The adjustment layer is on top, with Colorama Get phase/Add phase from alpha channel. Plus turbulnce display added.
    Whats going on? Or am I meant to do something else to the JPG first?

    I figured out what was wrong- it just didn't appear in the static preview, but it was fine when I clicked composition>Preview. Is this how it looks normally?
    I was attempting to make a weird 3D spinning pictures of nuclear explosions and bombs which panned/zoomed in and out of the images.

  • Bug Report: Page # and Icon Lost After Rename

    I love the new file management features in version 10.3 but I noticed some problems right away.
    After renaming a document, the current page position is lost and the document opens at page 1.  This first one I renamed was a 400-page book and this was a bit annoying.  I realize this is consistent with the desktop version which does not save the page position, but it is inconsistent with the iPad behavior for opening and closing documents.  A fix or a warning should be implemented.
    Also lost is the document icon, which reverts to a generic Reader logo.  This is more of a cosmetic thing.  I noticed the icon does not get restored after opening the document.  It seems necessary to scroll down to page 2 for the icon to refresh.

    Here is  the bug report page:
    https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

  • MDT image deployment fails after adding applications

    I've been trying to use MDT (ie deployment workbench 6.2.5019.0) to build and deploy images for quite some time now, and I am having a lot of difficulty deploying images to target computers.  I've successfully built a reference image in a VM with all
    the Win7 updates.  I can deploy that image to HP z820 workstations while injecting drivers.  Then I've tried two ways of adding applications, capturing that image and then re-deploying it to other target machines.
    First, I run a standard client task sequence that will deploy and capture an image to a target machine.  I put in a suspend command in the task sequence.  I can then add applications and then restart the task sequence.  If I don't add applications,
    and I just let the task sequence do it's magic, inject drivers, add any remaining Windows updates, and then just resume, MDT will capture the image.  I can then add it to my deployment share and then deploy it back to my target machine that it came from
    or any other similar target.  On the other hand, if I add all my applications during the suspend, MDT will capture the image, but subsequent deployments of the image will always fail on the target machine during Windows setup.
    Second, I can deploy the reference image to a target, let the sequence finish, add the apps, then run a sysprep and capture task sequence.  I finally got that to work.  I have an image with apps that I can deploy.  However, I go to a target
    machine that image was deployed to, I added for example Office and Winzip.  Then I run the same sysprep and capture sequence, capture the image, and when I deploy that image back, it hangs while setup is installing devices.
    Why am I having so much trouble just adding applications to an image that deployed perfectly fine before, but once I add apps, I can no longer use the same task sequences to capture and deploy?  These same task sequences will capture and deploy the
    image without the apps, but not with the apps.  I don't get it.
    So, what's so special about adding applications, and also can anyone give me a good reference for troubleshooting deployment issues where sysprep and setup fail for whatever reason?

    Hmmm... Applications should not cause hangs when installing drivers. In fact NOTHING should cause a hang like that... except for a bad driver. Go back and go through you driver manifest with a fine tooth comb and find the bad driver. That may include removing
    all of your 3rd party drivers.
    Keith Garner - keithga.wordpress.com

  • Songs lost after adding/changing playlist

    My girlfriend has a ipod mini formatted for windows usage.
    I have a g4 powermac. From the start there no problems whatsoever, everything was configurated perfectly so that the ipod could be connected to windows and mac machines.
    The last time something strange happened. I made some new playlists on the ipod and moderated one by adding some songs. The next day she told me that several songs were missing at random in a couple playlists. Other songs were skipped through like they were 0 second duration.
    What is the problem here and how can I solve it?

    I'm on windows, and have exactly the same problem.The program won't add any more songs after 30 have been added. I have tried to change the playlist's name, that didn't help.I've deleted the playlist and created one with the same name, but the problem still persists. It's really annoying because none of my other playlists have this issue.

  • Mystery: GridBagLayout on Panel1 lost after adding Panel1 on Panel1

    This is puzzling me.
    The buttons b1 and b2 should appear at the bottom because "c.anchor=GridBagConstraints.PAGE_END;"
    Instead it appears at the centre. The problem only appears when Panel containing the GridBagLayout is added to another Panel.
    If anyone knows the answer to this?...............Is it a bug?
    using java SDK1.4.
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    public class TestPanel extends JPanel {
    public TestPanel() {
    super();
    setBorder(BorderFactory.createTitledBorder("p"));
    GridBagLayout glayout = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    JPanel p1 = new JPanel();
    Dimension size = new Dimension(100,300);
    p1.setPreferredSize(size);
    p1.setBorder(BorderFactory.createTitledBorder("p1"));
    p1.setLayout(glayout);
    JButton b1 = new JButton("b1");
    JButton b2 = new JButton("b2");
    addComponent(p1, glayout, constraints, b1, 0, 0, 1, 1);
    addComponent(p1, glayout, constraints, b2, 1, 0, 1, 1);
    add(p1);
    private static void createAndShowGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("buttons suppose to be at bottom of Panel");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    TestPanel newContentPane = new TestPanel();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    frame.pack();
    frame.setVisible(true);
    private void addComponent(JPanel p, GridBagLayout g, GridBagConstraints c,
    Component component, int row, int column, int width, int height )
    c.gridx= column;
    c.gridy=row;
    c.gridwidth=width;
    c.gridheight=height;
    c.fill=GridBagConstraints.NONE;
    c.anchor=GridBagConstraints.PAGE_END; ///Why anchoring not working?
    g.setConstraints(component, c);
    p.add( component );
    public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }

    Found the problem. forgot the weights. Thanks.
    import javax.swing.*;
    import javax.swing.border.*;
    import java.awt.*;
    public class TestPanel extends JPanel {
    public TestPanel() {
    super(new GridLayout(0,1));
    setBorder(BorderFactory.createTitledBorder("p"));
    GridBagLayout glayout = new GridBagLayout();
    GridBagConstraints constraints = new GridBagConstraints();
    JPanel p1 = new JPanel();
    Dimension size = new Dimension(100,300);
    p1.setPreferredSize(size);
    p1.setBorder(BorderFactory.createTitledBorder("p1"));
    p1.setLayout(glayout);
    JButton b1 = new JButton("b1");
    JButton b2 = new JButton("b2");
    setLayout(new GridBagLayout());
    addComponent(p1, glayout, constraints, b1, 0, 0, 1, 1, 0, 0);
    addComponent(p1, glayout, constraints, b2, 1, 0, 1, 1, 1, 1);//adding weights
    add(p1 );
    private static void createAndShowGUI() {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame("buttons suppose to be at bottom of Panel");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    TestPanel newContentPane = new TestPanel();
    newContentPane.setOpaque(true);
    frame.setContentPane(newContentPane);
    frame.pack();
    frame.setVisible(true);
    private void addComponent(JPanel p, GridBagLayout g, GridBagConstraints c,
    Component component, int row, int column, int width, int height,
    int weighty, int weightx)
    c.gridx= column;
    c.gridy=row;
    c.gridwidth=width;
    c.gridheight=height;
    c.anchor=GridBagConstraints.NORTHWEST;
    c.weighty = weighty; //added................
    c.weightx= weightx; //added....
    p.add(component, c);
    public static void main(String[] args) {
    javax.swing.SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    createAndShowGUI();
    }

  • Components disappeared after adding the image in.....

    Hello everyone,
    I add a image in my home page that is in swing .As soon as I add that image the components in another page disappeared.(Componenets like textField ,Label).But when I click on that page, those pages appears. I want to appear all those pages at the first time as they are working before adding the image .
    Please tell me the solution on my ID or provide the solution over here.
    Thanks
    Vivek Kumar Gupta

    wht do u mean by pages.. ??
    and I should suggest you to use..
    validate();
    after adding images..

  • 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);
    }

  • Lost sound in some film clips when finishing project.  Using iMovie 11, after adding music to photo section, could not get sound back in 2 film clips at end of movie.  Beginning clips ok. How do I restore sound? Thx.

    Lost sound in some film clips when finishing project.  Using iMovie 11, after adding music to photo section, could not get sound back in 2 film clips at end of movie.  Beginning clips ok. How do I restore sound? Thx.

    Everything in your project will be exported when you use the share menu.
    If you want to export only half, I suggest that you
    1) Select the project in the Project Library.
    2) Click FILE/DUPLICATE PROJECT
    3) Give the duplicate a name, like Project A snippet.
    4) Open the duplicate project in the Project editor and delete the segments that you do not need.
    5) Then Share.
    You mentioned surrounding a portion of the clip you were editing in Yellow. Once you do this, you should right-click and then select either DELETE SELECTION, TRIM TO SELECTION, or one of the other options available. That is a key tool in editing.
    You mentioned MPEG Streamclip. I agree that MPEG Streamclip is a great tool.

  • Adding image icons to a list.

    Hi,
    I am using BB JDE 4.7 and BB 8800 device.
    I am developing a sample app to add the image icons to the list. I am using the following code.
           list = new List("Demo",Choice.IMPLICIT,strItems,imageArray);
    the image array has the list of icons as
                    Image iconRed = Image.createImage("/img/Red.png");
                    Image iconGreen = Image.createImage("/img/Green.png");
                    Image[] imageArray = new Image[] { iconGreen, iconRed, iconGreen };
    "Red.png" and "Green.png" are present in the img folder.
    I have added the icon files in the project properties under Resources tab.
    I tried to build the app it is successful and I had generated the .alx file and when I tried to install it on the device, it does not install.
    What could be the problem, am I doing any mistake here in the code... ?
    Can anyone help me on this. pls....
    Thanks in Advance,
    Regards,
    Sreelatha.

    As mentions switching is not an option.
    I put some more time on it and found that there would be the
       e.DrawDefault = true;
    what would help. I'm thinking of only drawing the one subItem (in the wanted column) I need my self and the rest should be as default. But if I go with:
          private void DrawItem(object sender, DrawListViewItemEventArgs e)
             e.DrawDefault = true;
    the DrawSubItem event is never fired! And my approach like this does not help ...
    Is there another way to get there with not drawing everything in DrawItem my self?
    privatevoid DrawSubItem(object sender, DrawListViewSubItemEventArgs e)
             if (e.SubItem.Tag != null)
                Rectangle rectangle = new Rectangle(e.Bounds.X, e.Bounds.Y, 30, 30);
                e.Graphics.DrawImage((Image)e.SubItem.Tag, rectangle);
             else
                e.DrawDefault = true;

  • Images lost after ppr when configured through CDN - jdev 12c

    Hi
    I configured CDN in adf-config.xml , the images are loaded fine when the page loads initially but when we do the ppr on any region that has images, the images are lost and instead of getting it from the base resource uri configured , it looks with in the application. Any idea what is going wrong ?
    Jdevleoper 12.1.3.0.0.
    Thank you
    Ranjith

    <adf-uri-rewrite-config xmlns="http://xmlns.oracle.com/adf/rewrite/config">
        <resource-uris>
          <base-resource-uri uri="http://10.25.245.50:7101/StaticContent/"
                             secure-uri="https://10.25.245.50:7101/StaticContent/">
            <match-pattern>^/.*/resources/images/.*\.png$</match-pattern>
            <match-pattern>^/.*/resources/images/.*\.png\?ln=images$</match-pattern>
          </base-resource-uri>
        </resource-uris>
      </adf-uri-rewrite-config>

  • Image Icon with JAR

    Hi,
    I would like to replace the standard coffee cup window icon with a custom image for a stand-alone Swing application, all packaged as a JAR file. As a quick test, I wrote the following:
    package me.swinginfo1;
    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    public class IconWindow extends JFrame {
         public IconWindow() {
              this.setSize(300, 200); //set the window size
              this.setLocationRelativeTo(null); //centers window on screen
              this.setTitle("Window with Icon"); //set the window title
              this.setDefaultCloseOperation(EXIT_ON_CLOSE); //end the program when window closed
              java.net.URL imageURL = this.getClass().getResource("images/red_circle.png");
              this.setIconImage(new ImageIcon(imageURL).getImage());
         * Executes Swing window... no arguments.
         public static void main(String[] args) {
              IconWindow myWindow = new IconWindow();
              myWindow.setVisible(true);
    When I run this class from the IDE (Eclipse, in this case), the program runs fine, and my icon image appears in the corner of the window as desired. However, when I package the program into a JAR, the JAR will not execute. My method of packaging is simply to use File -> Export -> JAR.
    Note: if I comment out the two lines related to the Icon Image, then the JAR executes as expected (but without my custom image icon, of course).
    I am concerned that perhaps the resource folder containing the image is not being included in the JAR. Is there an easy way to check this? Or is there something else I am doing wrong?
    Thanks!

    Thanks for the information atmguy. After checking the jar contents, I found that my resource files (the "red_circle.png" in this case) were not being packaged into the jar. It looks like the reason for this was that I had just added the directory to my project "src" directory by hand, rather than importing the files with Eclipse. Thus, when I packaged the jar using Eclipse, it was unaware of the resource files and therefore did not include them in the jar.
    Also, I found that in Windows a handy way of quickly viewing jar files is to rename the jar as a .zip, and then just explore the zip file. (As mentioned here: http://en.kioskea.net/faq/sujet-556-to-see-the-content-of-a-jar-file).
    The jar now executes as expected. Thanks!

  • Image icon on internal frame disappearing and re-appearing

    I have just upgraded to jdk 1.4.1-b21 from 1.4.0_01-b03 and have noticed that after adding an Internal Frame to a desktop and moving the mouse over the image icon in the left hand corner the image disappears. The image re-appears again, once I presume, when the desktop and its frames are repainted.
    Is this a bug or has something changed between the two jdk's.
    Thanks.
    Steve.

    Hi,
    I attempted the Disk Utility Repair but it did not work.
    So I disabled the application 'StickyWindows' and this resolved the problem.
    Hope this helps.

  • JPG Image Icons imported from OS 9.1 stay tiny in OS 10.4.8 finder windows

    The icons of nearly ten thousand jpg images that I transferred via AppleTalk from my old PowerPC (OS 9.1) to my new iMac (OS 10.4.8) appear tiny in finder windows. [The problem seems to be unique to jpg image files, since other transfered items, such as folders, documents, and tiff image icons, behave normally on the new system.]
    I have no problem with new images that have been created or saved on the iMac; they behave properly, adjusting from 16x16 to 128x128. However, all old (transferred) images in the same finder window remain tiny, no matter how I adjust the settings in View > Show View Options.
    I have discovered an unsatisfactory, tedious, image-by-image workaround. By opening a single old image and chosing "Save As…" I can save the image as a new jpg; then the icon will behave like other newly created images. Unfortunately, once the image is newly saved, I lose important data about the original image, such as Date Created.
    How can I "update" the old jpg image icons (transferred from OS 9.1 via AppleTalk) so they will behave like the newer icons, without losing old image data and having to resave the images one by one?
    iMac 2GHz Intel Core Duo   Mac OS X (10.4.8)   (previously, PowerPC 8500/120, OS 9.1)

    you need to trash the current version of IPhoto, just the application, leave all libraries intact, throw te iPhoto into the trash and up date, it wil ask you after install what libraries you want to install. Your choice, latsest is always my chioce. Do all the iPhoto updates before this step, as the download could have been corrupted. Hapened to me on my wifes nachine 10.7.3., which would have been certain death for me. After the re-install it will ask you which library to install, I always pick the latest, but you can put in others  as well.
    Good luck, because if I lost those files, I'd be pushing uo Daisys about now.
    There might be someone who knows a better wat too do this, and there is software to help ypu recover your data.(Data Resue, ClamEx)
    Hope tuis helps

  • OSX Lion jpeg 'preview' images are blurry after altering them

    When i edit a photograph in photoshop (cs3/cs4 etc, it doesnt matter which version) the preview of that image goes blurry after its saved. The image is the full res still and hasnt lost any quality but when i have the icons that are of a large size they appear really blurry and 'low-res'
    I know its a small gripe but it makes things difficult as a photographer when im trying to organise images that perhaps look similar or i want to see as a whole set.

    Hello, sorry, I don't know the cure for this, but as a photographer you might have a look at Tr-Catalog, where you can choose the size thumbnail/icon/detail...
    http://www.tri-edre.com/english/tricatalog.html

Maybe you are looking for

  • HELP! Macbook will not wake!  Please help!

    +2.0ghz 13.3 Macbook Aluminum from OCT 2008 (MB466LL)+ +OS: Leopard 10.5.8+ Issue: Computer will boot, but will immediately go into some type of soft sleep mode. If I press the power button to wake it from sleep, it will attempt to wake by flickering

  • Is there a different application for ichat?

    Is there app that is used to I.M on a macbook like an a update of ichat because it seems people dont you ichat on there macbooks anymore.....

  • Problem with SRM Business Partner enhancement using EEWB.

    Hello Gurus, I am doing Business Partner Enhancement using EEWB. basically adding new tab with few data fields. After using EEWB, the new tab hasbeen generated automatically and BP is creating successfully and data is stored in tables. But in the cus

  • Why we use Setup Table.

    Hi All, Can u plz tell me why do we use setup table and what is flow of data from R/3 2 BI? Please search the forum before posting a thread Edited by: Pravender on Sep 16, 2010 11:45 AM

  • User specific authorisation for VA01/VA02/VA03 transaction

    Hi Friends, I have specific requirement i.e for eg Sales order created by one user id say X should not be viewd by other user id Y and only user Id X can change his Sales order and vice versa. Is there any standard solution for this requirement. Plea