How can I use a layer system of images, boxes, lines etc

Hi,
I trying to develop a map system which can have layers added and removed from screen at request.
I have a basic map picture which I would like to add a grid structure to which can be added and removed by the click of a JMenuItem.
My code looks like this:
package simulator.gui;
import java.awt.*;
import java.awt.image.*;
import java.io.*;
import javax.imageio.*;
public class DrawMap extends Component {
     private static final long serialVersionUID = 1L;
     private BufferedImage map;
    public void paint(Graphics g) {
         Graphics2D g2 = (Graphics2D) g;
        g2.drawImage(map, simulator.values.Constants.originX, simulator.values.Constants.originY, null);
        g2.drawRect(simulator.values.Constants.originX, simulator.values.Constants.originY, simulator.values.Constants.mapWidth,simulator.values.Constants.mapHeight);
    public DrawMap() {
//       try {
//           map  = ImageIO.read(new File(simulator.values.Constants.map));
//       } catch (IOException e) {
    public Dimension getPreferredSize() {
        if (map == null) {
             return new Dimension(100,100);
        } else {
           return new Dimension(map.getWidth(), map.getHeight());
}I add the map to the window using this.add(new DrawMap());I want to have more methods such as DrawGrid() and DrawCircle() which get called separately from the DrawMap() method.
But when these get called they clear the screen and I can't get the over-layed effect I want.
Is there a solution to this?
I don't mind ever if I have to change most of my code.
Please help - it's for my final year project and this is just the basics of it!!!
Thanks,
- Kevin

There is quite a bit of information about using layers. Here is one:
http://java.sun.com/developer/Books/2dgraphics/chapter6.html
Just do some searching for more.
The question is not really suitable for forum answers, you need to do some research, study, and experimentation.

Similar Messages

  • How can we use two Discovery Systems in same network

    Hi Experts,
       I have two discovery systems with me and both of them have same SID and host name. As per the Discovery Systems configuration document we should not change any settings.
    Now I have a requirement like use one discovery system for R3 & BW and the other one for XI, EP and AII.
    Could any one tell the best approach to get it done?
    Thanks in advance
    Regards,
    Siva

    Hi Siva,
    the blog you found was created based on version 2 of the SAP Discovery system.
    For version 3 there is the option to adjust the host name according to your needs during the system set-up. You can read the details in the [Quick Guide|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/801dd54d-dd37-2a10-eca7-94bce2de28bc].
    Hope that helps,
        rAimund

  • How can I use external CSS, JavaScript and Images in PeopleSoft Portal?

    I am developing a website and I need to put my CSS, JavaScript and IMG files in a folder on the server that can be used by my HTML objects.
    Where should I put the images? How do I get the HTML objects can read these images?
    I've tried several things like:
    <link rel="stylesheet" href="<%=psCtxPath%><%=psHome%>\MyStyleSheet.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="\portal\MyStyleSheet.css" rel="stylesheet" type="text/css">
    <link rel="stylesheet" href="\ps\images\portal_pa\MyStyleSheet.css" rel="stylesheet" type="text/css">

    Hi Jim!
    Yes, I am using the HTML Object Application Designer. Below is my HTML:
    <html>
    <head>
      <title>My Portal</title>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <script language='javascript' src='/jscript/MyJavaScript.js'></script>
      <link rel="stylesheet" href="/css/MyStyleSheet.css" rel="stylesheet" type="text/css">
    </head>
    <body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" bottommargin="0" rightmargin="0" marginwidth="0" marginheight="0">
    <img src="/images/MyLogo.jpg"/>
    </body>
    </html>
    But, the portal is not reading my css, js and images.

  • How can I use my previous Sparse Disk Image Bundle?

    I just got a new MacBook Pro, with Mountain Lion.
    I used to backup to a Time Capsule, using Time Machine. When I configure Time Machine to start backing up to that Time Capsule again, it creates a new backup (a new Sparse Disk Image Bundle) alongside the old one, instead of using the old one to continue backing up.
    How can I get Time Machine to use the old backup file and not create a new one?
    TM

    That would have happened automatically if you had transferred your data from the backup of the old machine in Setup Assistant.
    To make it happen now is difficult. You can try the instructions on this page:
    "Reconnecting" to your backups

  • How can I use or convert a imaq image to plot images back on waveform graph

    Hi
    I am currently opening and manipulating (rotate and resize) a PNG image using IMAQ Vision in LabView 8.2.1 This works well and I can display the Image on the front panel using a IMAQ Image Control.
    In addition to this I would now like to display the image as a background on waveformgraph. I can do this with the original PNG file by reading it and then flatten it to a pixmap ie make it a Picture but this is of little use as I need to use the manipulated IMAQ image.
    Therefor I would like to know how to convert the manipulted IMAQ Image to right Picture Format (without resaving) in order to use it on the PlotImages.Back property node of a wavefrom graph.
    I very much welcome your suggestions as I feel it should be easy yet can not seem to solve it. Thank you for your time!!!

    Hi Randall
    Apologies for replying somewhat late but I have been out of the office for a few days.
    Your suggestions and code helped me greatly and led to solving my query so thank you for that.
    There is one more thing (well many many more but I will place new posts for those  however that you might be able to answer for me.
    Following your suggestion to use the image to array function I searched through more examples and found the code that did exactly what I wanted to do. Please see attached.
    In this code a For loop is used to add 65793 to the color table. It works very well but I do not know why it is used exactly. Can you exlplain? I also realize I never made it clear that I use grayscale PNG files rather then color images.
    Thanks again for your excellent help, it is much appreciated.
    Attachments:
    IMAQ_8-bit_to_picture v1.vi ‏15 KB
    Test Image.png ‏42 KB

  • How can i use AdobeSpellingFramework.swc library to draw squiggly line below word for RichEditable?

    Written in Squiggly Release Notes:
    AdobeSpellingFramework.swc
    A class that facilitates the drawing of squiggly lines below words for various text components.
    Im not using squiggly spell check egine bcause it is not supporting arabic language.
    Rest of the work i have completed, i just want to draw squiggly lines below word.
    Please help me.....Thanks

    Did you ever get an answer for this ?

  • How can utilize/use  the extended space in system.img ?

    Hello Guru's
    In Oracle VM , How can utilize/use the extended space in system.img ?
    a) Increased the system.img size using the following command:
    # dd if=/dev/zero bs=1M count=12960 >> /OVS/running_pool/18_test1/System.img
    b) Verified the added size of system.img file at OVS server.
    # ls -lh System.img
    -rw-r--r-- 1 root root 19G Feb 9 20:58 System.img
    c) Started GVM and additional size/memory is not shown ?
    # df -m
    Filesystem 1M-blocks Used Available Use% Mounted on
    /dev/xvda2 3984 2292 1652 59% /
    /dev/xvda1 92 12 75 14% /boot
    tmpfs 512 0 512 0% /dev/shm
    + Tried working with resizefs , resize2fs , cmd did not work.
    (GVM is created using Oracle provided template)
    + am i missing anything ?
    Oracle VM Setup Detail:
    oracle-logos-4.9.17-7ovs
    enterprise-linux-ovs-5-0.17
    ovs-release-2.2-0.17
    ovs-utils-1.0-33
    kernel-ovs-2.6.18-128.2.1.4.9.el5
    ovs-agent-2.3-29
    Thanks in advance for your help.
    Best Regards
    Basu

    I am not positive what you did is going to work, but it seems like you did the equivalent of imaging a small disk on a bigger disk. In that case, the first thing to do is update the partition table with fdisk. Start with fdisk -l in the vm for general information about the disk. Hopefully, the additional space will show. Then, work with fdisk to use the extra space. The easiest is to add a partition, then a file system on it. It is also possible to expand the last partition (you might have to delete it first), then expand what is on it (may be RAID, LVM, or the file system), layer by layer. As usual with fdisk, you run the risk of thrashing it all, so you may want to practice on a copy first. Obviously, the extra space can only be added to the last partition of the small disk.
    If the situation is more complex, you may have to boot a VM with both the small disk and the big disk at the same time. If you boot the VM off of an iso DVD image, you can then shell out, then run fdisk to partition the big disk the way you want, then use dd to copy the partitions you want in the order you want from the small disk. I am pretty sure not all combinations will work, but you get the idea. You can then take the small disk out, and boot off of the big disk.
    Come to think of it, you might just be better off with adding more space as a second virtual disk. You would then be free to partition/format it the way you want without messing with the first disk. Linux is so good with disk management, so many options.
    As a general statement, though, I like to put some distance between the high level file systems and the low level disk partitions, so I use LVM (Logical Volume Manager).
    Best of luck, keep us posted.

  • How can i use my smart TV as a second monitor for my Power mac (2010) via HDMI cable? i've made the connection but no options show in system prefs display.

    How can i use my smart TV as a second monitor for my Power mac (2010) via HDMI cable? i've made the connection but no options show in system prefs display.
    the computer:Mac Pro, Mac OS X (10.9.5), 2 x 2.66 Ghz 6-Core intel Xeon
    the TV: LG Smart tv

    The Mac uses a highly-parameterized universal Driver for every display. The parameters are set at certain times when a query is sent to your display. The display MUST answer with its name and capabilities, or the screen stays dark. A TV set that is off or "not paying attention" because it is set to a different port when the query occurs will rarely answer, and so will often remain dark.
    You can use tools in the System Report to see whether your display has been detected at all. If it has, the report will look something like this, but its name will appear:
    The times when the query is sent are:
    • at Startup
    • at wake from sleep
    • when the Mac-end of the cable is inserted
    • when using the Option ( Detect Displays ) button in displays preferences

  • How can I use system call in kernel loadable module?

    Hi,
    I want to use system call (shmat, mmap,...) in kernel module.
    When kernel module is loaded, it cause system error (undefined symbol name 'shmat', 'mmap').
    How can I use system call in kernel module ?
    Thanks in advance.
    david joo

    You cannot use system calls in the kernel modules.
    Read 'Writing Device Drivers' answerbook - it lists the set of interfaces (known as DDI/DDK) that are supposed to be used instead.
    Hope this helps...
    --I.

  • My camera does not work after I restored the system, how can I use it again?

    My camera does not work after I restored the system, how can I use it again?
    Thank you for your help!

    Did try to restore "as new device" without using the backup after that?
    Did you try to reset the phone by holding the sleep and home button until the Apple logo coes back again?

  • Before downloading lion, i want to backup my computer with time machine and a G-DRIVE Slim.  But how can i use time machine to only backup my system once?

    Just wondering, how can i use time machine to only backup my system once? Just this once and not on a weekly basis?

    Upgrade. My three year old Mac Pro and year old MacBook Pro have no problem. Both seem faster.
    And there's your problem reading entirely subjective views on forums, from people that might or might not have decently maintained systems, good operating practices, or whatever.... 
    Strangely, when most companies issue new software, it is because they believe (and believe they have checked) that it is better than the previous version.

  • How can i use my ipad3 as a complite navigation system(greek lang) without need wifi or 4g engaged?

    How can i use my ipad3 as a complite navigation system(greek lang) without need wifi or 4g engaged?

    With the wifi-only model, yes you will need an external GPS with it. A few have been mentioned on here in the past but I can't remember the names of them - you could try either searching here for them, or just do a search on the internet for iPad compatible GPS devices (I'm not sure how many work with it).

  • How can I use my software CD to fix operational system's problems?

    the cd that came with the MacBook, how can I use it to fix problems with the OS, but not deleting the files that I have ?

    You can boot up off of the CD and run Disk Repair including Repair Permissions or Verify Disk. Other than that, there aren't many choices From Apple for "fixing problems" from the CD as such.. unless you call reinstalling the OS "fixing problems".
    Alternatively, if Safari is slow you can "reset Safari" from the Safari pull-down menu.
    You can also download the 10.6.8 Snow Leopard Combo upgrade and reistall that from your desktop.
    You can also let you rmachine run over night and let the S/L utilities run automatically at night.. no intervention on your part.
    Genreally speaking there isn't really that much a user can actively do to "fix things".. however, suggest you keep all the software on your machine current. You can go to support and see all the 10.6.8 software updats availale. Be careful nto to download the "server" software for 10.6.8 though.
    Niel gave a great suggestin... always back-up your user files.

  • How can i use my new iphone 5 in my car system?

    how can i use my iphone 5 in my vehicle with my existing wide plug??

    You never said that in your original post and my crystalball is cloudy today.
    What does it do with the adapter?
    Allan

  • How can i use param in my select query ( see code)

    Hi ,
    I need to use the param instead of hardcoding the value in the select query , when i did that it is working .
    I think the limit of args is only till the end of main and my select query is in a method called Load() .
    How can i use the param in my select query .
    public static void main(String[] args){
    name = args[0];
    class= args[1];
    new Load();
    }//end of main
    public Load()
              try {
                   Class.forName(JDBC_DRIVER);
                   connection = DriverManager.getConnection(DATABASE_URL,"username","pw");
                   statement = connection.createStatement();
                   //First Query : pin and ticket number
                   ResultSet resultSet = statement.executeQuery("SELECT pin , ticketnumber from airport ,year where "+                                                                      "year.year_name= Here i need to use the param (instead of hardcoding) and year.class_year= Here too i need to use param");
    }// end of method Load()Edited by: 1sai on Sep 24, 2008 7:34 AM
    Edited by: 1sai on Sep 24, 2008 7:35 AM

    Might I suggest you change the structure of your program to the following:
    public class Load {
      private Connection conn;
      private PreparedStatement statement;
      public Load(String sql) {
        init(sql);
      protected void init(String sql) throws Exception {
        Class.forName(JDBC_DRIVER);
        conn = DriverManager.getConnection(DATABASE_URL, "username", "pw");
        statement = conn.prepareStatement(sql);
      public ResultSet execute(String p1, String p2) throws Exception {
        statement.setString(1, p1);
        statement.setString(2, p2);
        return statement.executeQuery();
      public void close() throws Exception {
        if (statement != null)
          statement.close();
        statement = null;
        if (conn != null)
          conn.close();
        conn = null;
      public static void main(String[] args) throws Exception {
        String sql = args[0];
        String param1 = args[1];
        String param2 = args[2];
        Load load = new Load(sql);
        ResultSet rs = load.execute(param1, param2);
        while (rs.next())
          System.out.println(rs.get(0));
        rs.close();
        load.close();
    }This allows you to use the same "Load" object for multiple queries with different parameters.
    I do not recommend you actually use the code above in any sort of production application. You should really take a look at Spring Framework along with an ORM tool like Hibernate or Ibatis to simplify your DAO layer.
    Hope this helps,
    David

Maybe you are looking for