Creating image using swing

Hi,
I want to create a image of the data in a tabular format.Can we create image using swing. or i require any other api for it.
Can any one help me.
Thanks in advance!!

1. create a TableModel populated with your data
2. create a JTable based on that model
3. get the preferred size of that table
4. create a BufferedImage of the same size
5. get the Graphics of that image
6. set the JTable's size to its preferred size
7. pass the Graphics object to the table's paint() method
8. dispose the Graphics object

Similar Messages

  • Create Image using MDT 2013

    Hi ,
    I am quite new for MDT 2013. I have recently installed MDT 2013 in my Windows Server 2012.
    Now , I do have about 10 physical machine with different hardware specification inside. I have installed Windows 8.1 with all required software in it and now I want to distribute the same image in all 10 another physical machine.
    Can anyone provide me the steps to implement this...
    Do I need to create the image using image x software and then use it as a standard image to be deploy it in rest of the systems..
    Thank you...

    I was getting exact same error.
    here is what I did to fix it.
    You need to do all this in a virtual envinronment.
    1- import Windows 8.1 x64 from the DVD and add it to your listed os in MDT
    2- create standard task sequence and select the OS you imported in step one. you need to add suspend to your TS ( look it up on how to )
    3- For some reason WinPe x64 bit kept giving error during deployment so I used WinPe x86.
    4- import Winpe x86 boot.wim into your WDS if you use Pxe boot or create a boot disk from the ISO and boot your VM from it.
    5- deploy windows 8.1 x64 to your VM ,make sure to select " capture image ".
    make all the necessary changes when windows is installed  and MDT  suspends the deployment, take snapshot of your VM , and then cintinue the deployment to finish the capture.
    6- import the new captured image into MDT
    7- creates new standard TS or modify your existing one to deploy the newly captured image.
    8- update your deployment share and start the deployment of your new image.

  • Programmatically creating VM from already created image using Java

    Hello.
    I am writing a Java program to create VMs from already created VM images. I was able to create through the web portal.
    I am using the API given here http://msdn.microsoft.com/en-us/library/jj157194.aspx
    The request sent is
    <?xml version="1.0" encoding="UTF-8"?>
    <Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Name>mltestdeploy</Name>
    <DeploymentSlot>Production</DeploymentSlot>
    <Label>ZGVwbG95bWVudF9tbHRlc3RkZXBsb3k=</Label>
    <RoleList>
    <Role>
    <RoleName>mltesthost</RoleName>
      <RoleType>PersistentVMRole</RoleType>
    <VMImageName>ml-centos-image</VMImageName>
    </Role>
    </RoleList>
    </Deployment>
    "ml-centos-name" is an existing image with that name and I have used this to create another VM from this image.
    I have already created the required cloud service as required by this API.
    I am getting error 400 with text as "Bad Request". This means some parameter is wrong.
    Any help is very much appreciated.
    -Siva

    Now instead of the VMImageName, I used SourceImageName as given in the example.
    The XML body now looks like
    <Deployment xmlns="http://schemas.microsoft.com/windowsazure" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <Name>mltestdeploy</Name>
    <DeploymentSlot>Production</DeploymentSlot>
    <Label>ZGVwbG95bWVudF9tbHRlc3RkZXBsb3k=</Label>
    <RoleList>
    <Role>
    <RoleName>mltesthost</RoleName>
    <RoleType>PersistentVMRole</RoleType>
    <ConfigurationSets>
    <ConfigurationSet i:type="LinuxProvisioningConfigurationSet">
    <ConfigurationSetType>LinuxProvisioningConfiguration</ConfigurationSetType>
    <HostName>mltesthost</HostName>
    <UserName>mladmin</UserName>
    <UserPassword>password</UserPassword>
    <DisableSshPasswordAuthentication>false</DisableSshPasswordAuthentication>
    </ConfigurationSet>
    </ConfigurationSets>
    <OSVirtualHardDisk>
    <MediaLink>http://portalvhds7dplkth082kmh.blob.core.windows.net/vhds/1v5wpayu.pwl201404160535060424.vhd</MediaLink>
    <SourceImageName>ml-centos-image</SourceImageName>
    </OSVirtualHardDisk>
    </Role>
    </RoleList>
    </Deployment>
    Even now I get the same 'Bad Request' error.
    Is there any way to find out which element is causing this Bad Request error? Thanks

  • Create image using diagonal lines of varying widths

    Hi, sorry if I haven't explained what I need to do correctly, I'm sure the picture will explain better. I know I could use multiple masks stacked on top of each other or some similar method, but I'm looking for something less convoluted and neater. Any ideas?
    [IMG]http://i40.tinypic.com/34g6hxh.png[/IMG]

    secretsoundz,
    The bottom lines in the images seem to end at right angles, whereas the others semm to be cut along the shapes they form, so the latter may very well have been made with Clipping masks.
    The right solution may depend on whether you wish to have different or corresponding line endings.

  • Can't use Swing in my java application

    I installed J2SE 5 Update 4 on my machine and was trying my hands on creating GUI using swing. I kept getting the error message: "Package javax,swing not found in import".
    I have the statement: import javax.swing.*; in my code so I don't what to do again.
    Thanks

    I think your best bet is to try uninstalling and installing Java again. Your problem could be something small, however you wull eaist less time to re-install everything, then to try searching for the problem.
    btw-What Development tool do you use? Just in case you may try to check whether it could be a problem of the ide (It should not be however), just check with another Ide, and see if the same happens. If yes, then follow my first advise, I think it would take you less time.

  • Use Swing to create the toolbar of Netscape 6

    I want to use swing to create the toolbar which is smiliar to the toolbar of Netscape 6. The followings are the properties:
    1)the buttons with no borders
    2)which click on it, the border appear
    3)there is a horizontal line in the buttons
    4)there is a icon at the lest hand side
    5)set the background color manually (can the image of the icon be transperant?)
    Hope that you can suggest some methods for such properties if you have idea! Thanks for help!
    Stephen

    try using the JToolBar provided by Swing.
    U can either add Abstract action or JButton which can have an icon and a label,or anything, as it is a container.

  • Create a new Buffered Image using Raster and ColorModel

    Sorry , I crosspost this message,because no one reply.
    Recently,I write a programme combining C++ and Java .
    The C++ part create a array containing image data in form of BI_RGB and biBitCount==32.
    The java part create a image using Raster and ColorModel like this:
       static int[] data ;
       DataBuffer db = new DataBufferInt(data, data.length);
       WritableRaster wr =Raster.createPackedRaster(db, 1024,768, 32, null);
       ColorModel cm = new DirectColorModel(32,0xff0000,0x00ff00,0x0000ff);
       img = new BufferedImage(cm, wr, false, null);But it doesn't work .
    it report this:
    Exception in thread "main" java.lang.IllegalArgumentException: Raster sun.awt.im
    age.SunWritableRaster@dff3a2 is incompatible with ColorModel DirectColorModel: r
    mask=ff0000 gmask=ff00 bmask=ff amask=0
    at java.awt.image.BufferedImage.<init>(BufferedImage.java:549)
    at monitor.test.Perform2.main(Perform2.java:39)

    hey epico
    compiles & runs 4 me
    see javadocs for SinglePixelPackedSampleModel
    import java.awt.image.*;
    public class Tester {
    DataBuffer db;
    WritableRaster wr;
    ColorModel cm;
    BufferedImage im;
    int[] data;
    int[] masks;
    int w = 768;
    int h = 576;
      public Tester() {
        data = new int[768*576];
        for (int i = 0;i < w*h ;i++ ) {
          data[i] = 0;
        masks = new int[3];
        masks[0] = 0xff0000;
        masks[1] = 0x00ff00;
        masks[2] = 0x0000ff;
        db = new DataBufferInt(data,data.length);
        SinglePixelPackedSampleModel sm = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,w,h,masks);
        cm = new DirectColorModel(32,0xff0000,0x00ff00,0x0000ff);
        wr = Raster.createWritableRaster(sm,db,null);
        im = new BufferedImage(cm,wr,false,null);
      public static void main(String[] args) {
        Tester tester1 = new Tester();
    }

  • Problem in creating 1 image using differnt images

    Dear Fellows I want to create an image by using different images in byte array format. Images may be transparent or normal images. I want final result in byte array. I am using the following technique which is working fine but the problem with this technique is that it takes too much time to create an image. This is because I am using MediaTraker. If I delete the code of MediaTracker then program have undeterministic behavior i.e, sometimes it create the final image properly and sometimes nothing is displayed in final image.
    I need some help from you. If anyone of you know the technique to draw image using different images without using mediaTracker kindly let me know.
    Early replies will be appreciated
    // here is the sample code which i m using for creating image
    byte[] backgroundImage= // read 800 X 600 image from disk and convert it in to byte array
    byte[] image1 = // read 200 X 200 image from disk and convert it in to byte array
    byte[] transparentImage // read 300 X 300 transparent image from disk and convert it in to byte array
    Image img=null;
    Frame frame =new Frame();
    frame.addNotify();
    //creating BufferedImage object to store Final image
    BufferedImage requiredImage= new BufferedImage(800,600,BufferedImage.SCALE_SMOOTH);
    //get Graphics of BufferedImage created above
    Graphics2D g=(Graphics2D) requiredImage.getGraphics();
    ///// begin draw back ground image
    img=Toolkit.getDefaultToolkit().createImage(backgroundImage);
    try
    MediaTracker mt = new MediaTracker(frame);
    mt.addImage(img, 0); // adds image with ID 0
    mt.waitForID(0);
    }catch(Exception myex)
    myex.printStackTrace();
    //draw background starting from x=0, y=0 with 800 X 600 dimentions
    g.drawImage(img,0,0,800,600,null);
    ////////// end draw background image
    ////////// begin draw image1
    img=Toolkit.getDefaultToolkit().createImage(image1);
    try
    MediaTracker mt = new MediaTracker(frame);
    mt.addImage(img, 0); // adds image with ID 0
    mt.waitForID(0);
    }catch(Exception myex)
    myex.printStackTrace();
    //draw image1 starting from x=10, y=10 with 200 X 200 dimentions
    g.drawImage(img,10,10,200,200,null);
    //////////// end draw image1
    //////begin transparentImage
    img=Toolkit.getDefaultToolkit().createImage(backData);
    try
    MediaTracker mt = new MediaTracker(frame);
    mt.addImage(img, 0); // adds image with ID 0
    mt.waitForID(0);
    }catch(Exception myex)
    myex.printStackTrace();
    //draw transparentImage starting from x=400, y=0 with 300 X 300 dimentions
    g.drawImage(img,400,0,300,300,null);
    ///end draw transparent image
    byte []finalResult = //convert requiredImage into byte array;
    you can mail me the solution on my email address [email protected]
    thanks with best regards
    and waiting for someone to reply
    kamran zameer

    is there anyone on this forum to help me??????
    regards,
    kamran zameer

  • Problem in creating client side PDF with image using flex and AlivePD

    I need a favor I am creating client side PDF with image using flex and AlivePDF for a web based application. Images have been generated on that pdf but it is creating problem for large size images as half of the image disappeared from that pdf.I am taking the image inside a canvas . How do i control my images so that they come fit on that pdf file for any image size that i take.
    Thanks in advance
    Atishay

    I am having a similar and more serious problem. It takes a
    long time to execute, but even attaching a small image balloons the
    pdf to 6MB plus. After a few images it gets up to 20MB. These are
    100k jpeg files being attached. The resulting PDF is too large to
    email or process effectively. Does anyone know how to reduce
    size/processing?

  • How to create Image as Custom Property Type used in Configurable Web Part?

    I wanted to create custom configurable web part property for Image.
    Example - the screenshot of Image property used in Image web part is shown below:
    My goal is to create as many images as possible in custom configurable web part.
    I tried to write the code:
    [WebBrowsable(true),
    WebDisplayName("Example Photo"),
    WebDescription("Example Photo of the user"),
    Category("Custom User Profile"),
    Personalizable(PersonalizationScope.Shared)]
    public Image ExampleUserPhoto { get; set; }
    However, the result does not display Image configurable web part property.
    I wonder why the data type Image does not cause the custom web part to have Image configurable web part property.
    Other data types such as Boolean, Enum, Integer, String and DateTime can be used.
    How can I create Image as Custom Property Type used in Configurable Web Part?

    I have examined that context node __00 has been enhanced,and  has a class name  z___00. But  when I created a new attirubute by right click " Attributes" with wizard under context node __00.There is still  a error message "view is not enhaced or copied with wizard".
    But  when  I created a method  "getvaliation "  in the class of context node zcl__00, the attribute  'valiation' automatically created(at the same time the method "getvaliation' automatically  created for the attribute 'valiation') and I need not to create attibute 'validation' by wizard .  It seemed as if the problem is resloved. But when I make test for it in web ui .There is a runtime erro message.
    Do I need to make some configurations in  the business object layer  for the checkbox? but  the checkbox is only used as a flag  to decide whether a backgoud job is needed to be executed.
    Edited by: samhuman on Jun 22, 2010 10:31 AM

  • How do you create a disk image using Disk Copy?

    Hello,
    Is there any way you can create a disk image using Disc Copy? Is there a better way to create a Disk Image?
    I would like to burn two copies of a 4.2 gig folder on my mac. I usually insert a blank DVD-R and then the mac asks if I would like to prepare it at which point I click "yes". An icon of a DVD disk appears on the desktop and then I drag my files onto this icon. It takes a few moments to create the disc image and then I click "burn". However, after the disc is burned the disc image disappears and I have to start all over again if I want to make another copy.
    How can I save this disc image? If I could save the disc image, it would enable me to burn a second DVD right after the first without having to create the disk image all over again. This would save a lot if time.
    I am using OS 10.1.5
    Thank you for any suggestions

    Thanks Niel for the info about creating a Disk Image with the Disk Copy utility in OS 10.1.5
    That worked however when I insert a blank DVD-R, the disk image still has to be copied to the DVD-R buffer and then it can be burned. And so this doesn't really save any steps - the "copying into the buffer" step still has to occur whether or not you have created a disk image of your files. So creating a disk image doesn't really shorten the process of burning multiple copies of a DVD.
    I will try to describe the steps more clearly:
    Two of the three steps for creating a DVD (steps 2 and 3) are very time-consuming:
    1. put blank DVD into the drive (a DVD disk icon quickly appears)
    2. drag files onto this icon (this step takes a long time as the files are copied into the buffer)
    3. choose "burn" (the actual burning also takes a long time)
    I was hoping that when I create two or more DVDs of the same files, I could first create a Disk image so that when I create the second DVD, step 2 could be skipped. That does not seem to be the case - the disk image still has to be re-loaded. And so I think I will not bother with the Disk image idea - it doesn't seem to be necessary or helpful when burning DVDs to backup data.
    Thanks for your suggestion.

  • Trying to create images to be used in my game

    Here's my situation. I have 3 main parts of the game.
    0 - in play
    1 - level up
    2 - buy screen
    each one has its own basic images/text that don't change. I want to create Images with all that background stuff already on it to improve the efficiency of the drawing. So here's what I tried:
    private Image          back, shipImage, ship2Image;
    private Graphics     backG;
    private Graphics2D     g2d;
    private Image[]          gameStateBackGround = new Image[3];
    private Graphics2D[]     gameStateGraphics2D = new Graphics2D[3];
    //In init.  I know these graphics objects work because this is what I
    //started with but now I'm wanting to improve
    back = createImage(mapWidth,mapHeight);
    backG = back.getGraphics();
    g2d = (Graphics2D) backG;
    g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    shipImage = Toolkit.getDefaultToolkit().getImage(getClass().getResource("ship.png")).getScaledInstance(20, 30, Image.SCALE_SMOOTH);
    ship2Image = Toolkit.getDefaultToolkit().getImage(getClass().getResource("ship2.png")).getScaledInstance(55, 35, Image.SCALE_SMOOTH);
    //In a method called in init() to create the Images I desribed
    gameStateBackGround[in_play] = createImage(mapWidth,mapHeight);
    drawStarField(gameStateBackGround[in_play].getGraphics());
    gameStateGraphics2D[in_play] = (Graphics2D) gameStateBackGround[in_play].getGraphics();
    starBase.draw(gameStateGraphics2D[in_play]);
    //In my draw method
    gameStateBackGround[in_play] = createImage(mapWidth,mapHeight);
    drawStarField(gameStateBackGround[in_play].getGraphics());
    gameStateGraphics2D[in_play] = (Graphics2D) gameStateBackGround[in_play].getGraphics();
    starBase.draw(gameStateGraphics2D[in_play]);now before I just had that main stuff drawing to the graphics objects used for the whole applet, and it worked fine. What I want is to pre-draw them, and just slap that whole single image of the constant stuff to my area of gameStateBackGround[]. Am I off to the right start?
    Now my drawStarField method asks for a Graphics object, and that draws, and that actually shows. Now for the stuff that's using Graphics2D objects, that is NOT showing. So I think where my main problem is is in creating the Graphics2D objects correctly. This whole concept I'm using for creating objects may be horrid, but hey, that's where you guys come in :) Tell me where I've screwed up hehe. Thanks for the help!          

    oops I screwed up. After:
    //In my draw method
    [/code
    comesbackG.drawImage(gameStateBackGround[gameState], 0, 0, this);

  • Using Cap6, need to create menu screen that allows user to click a button, branch to other screens, and return to main menu. When returning to the main screen the button that was clicked will be grayed out or inactive.  How do I do this?  I created image

    I am trying to emulate a piece of equipment.  I need the user to be able to click on specific buttons that will take the user to another screen(s).  After viewing those screens the user will be directed back to the main screen where the user would know which buttons had been pressed and which still needed to be pressed.  I create image buttons with the 3 states - that worked except when the user returns the slide is reset and so the user does not see the 3rd state of the button.  How can I get that 3rd state to stay after user returns to the main screen? 

    Hi Elizabeth,
    Since I just did this morning what you are currently attempting to do, I thought I'd share my method.  I must provide a disclaimer and tell you that I am not an expert in Captivate advanced actions--like you, I am still figuring them out.  However, I am happy to share here anything I have learned thus far.
    First, here is what my initial slide looks like (see interaction slide below).  I created all of the icons (including the 'grayed out' icon on the second screenshot) in a few minutes using Adobe Illustrator. The icons have been imported as custom multi-state buttons so that I could have the desired effect when the user hovers over the image--the yellow 'explore' flag appears only when the mouse is over the icon. When the learner click either image, they are sent to the corresponding slide.  Once both slides are viewed, a 'continue' button will appear at the base of the screen (something I've not figured out--I sent an email to Lieve begging for some guidance). 
    The initial slide (interaction slide):
    Second, here is a depiction of what happens when the learner returns to the interactive slide from the content slide (see image below):  Once the learner visits the 'Battery Content' slide and then returns to the interaction slide, the images have changed.  The multi-state button is hidden (through the advanced action), the replacement image (the image with the completed banner over it) is shown, and a hidden click box to allow the user to return to the previously visited page (just in case they desire to do that) is "shown" to allow navigation since the button is no longer there (because it is magically hidden).
    Content Slide 1:
    Remember, there may be an easier way to do this in Captivate.  I am using Cp6 for this module.
    1. I created two user variables as follows
    Name: v_batteryExplore
    Value: 0
    Name: v_fuelExplore
    Value: 0
    2. I created an advanced action for each as shown below (showing only one--duplicate the first and change the names to match the content):
    Credit: I learned these steps from @Lilibiri and Dr. Pooja Jaisingh!
    I have also noticed that it matters where the buttons are located on the timeline.  It seems best to have buttons above all other content.  Not sure why, but I have had images not appear when I have not done this.
    And the last step you do not want to forget; you need to remember to tell Captivate to use the action.
    As a final note, remember that the elements you do not want to appear on the initial screen must not be initially visible.  Make sure to set them to invisible by removing the checkmark in the 'Visible in output' box located next to the button name.  In my case, the image of the completed battery and the invisible button to allow a revisit of content was initially hidden.  Here is a final screenshot of my timeline for this interaction.  I hope this information helps you!

  • How to create dvd/cd image using super drive in MacBook Air

    I have MacBook Air and also Apple Supper drive for the same. can u help me to find dvd/cd burrning and copy software. and also guide me "how to create dvd/cd image using super drive in MacBook Air"

    First to create a video DVD you need to use DVD authoring software like iDVD.  You can purchase it from the online Apple Store while supplies last.
    For creating a disk image use Disk Utility.
    To burn items to a CD or data DVD just insert the disc in the optical drive and drag those items onto the disc icon on the Desktop.  Then drag the disc icon to the Trash icon in the Dock which changes to a Burn icon.
    OT

  • Displaying Image using JLabel in swings

    I am not understanding how to display a image in swing using JLabel Component.
    I am writing in the following manner:
    // importing necessary packages
    in init() method
    public void init()
    Container cp= getContentPane()
    JLabel jl=new JLabel("Image",new ImageIcon("<image>.gif"),JLabel.CENTER);
    cp.add(jl);
    applet is running and only label msg is displaying but not the image.
    Please help me so that i can solve this problem.where the image is to be placed??and how it has to be included?
    Please provide me the solution.

    cp.add(new JLabel("Image",new ImageIcon(new java.net.URL (getCodeBase(),"Test.gif")),JLabel.CENTER));

Maybe you are looking for

  • Roller Coaster Tycoon 3; Is this item compatible with my MacBook Pro?

    Hello, I have a MacBook pro that uses OS X 10.7.3 (newest version of Lion) with 4 GBs of Ram. I am purchasing Atari's RollerCoaster Tycoon 3 Platinum for Mac from here: http://www.amazon.com/RollerCoaster-Tycoon-3-Platinum-Mac/dp/B0048XAVC2. Before I

  • C# Acrobat 8 vs. Acrobat 4

    Hi, I am currently switching the referenced DLL in a C# project from a prehistoric Acrobat 4 to an Acrobat 8 equivalent. My Question is what DLLdo I have to use now? Previously it used to be done like the following (using the ACRODISTXLib.dll): ACROD

  • Hide Sidecar files appearing after upgrade?

    How do you hide Sidecar files NOW appearing in NEF photo folder on desktop after Yosemite upgrade? In Adobe Bridge, you have option to hide sidecar files. Can't find a way to hide them from view in OS Finder folders.

  • Printing with Epson XP-950

    I use a Mac Book air operating on OSX 10.9.5 and Photoshop Elements 11 and print via a wired connection to an Epson XP-950 A3 Photo printer. All worked fine providing good quality prints across all size and paper quality range. Recently a change has

  • Internal Unit of Measurement

    Hello At the time of creating a shopping cart,the moment,UOM is selected ,I get the following error. "Internal Measurement Unit ZTO doesn´t exits in Spanish language" However,,just to clarify,this unit of measurement is maintained in backend as well