How to set an image as background for a jPanel in an applet

hi,
I want to set an image as background for a jPanel component in an applet. I am using netbeans environment. I found that to set an image as a background for a jPanel is not possible. Could someone help me .
Thanks in advance,
Joshua

public class ImagePanel extends JPanel
    private Image image = null;
    public void setImage(Image image)
        this.image = image;
    protected void paintComponent(Graphics g)
        super.paintComponent(g);
        g.drawImage(this.image, 0, 0, this);
}Adjust to taste.

Similar Messages

  • How to set icon image in jstudio for my application

    Dear friends,
    I developed one application in jstudio.And need to set an special icon for my application.While i download my application in to mobile. The icon should be displayed in the mobile.To show my application as unique from other applications.But i dont know how to set an icon for my application. If any one find answer please reply as soon as possible.
    Thank you

    Java Studio Enterprise per se does not support creating applications for mobile devices. I gues you used NetBeans Mobility Pack for that. Therefore, please refer to http://mobility.netbeans.org/ for more information. Thanks.
    Here is a FAQ entry, which, as far as I understand answers your question: http://www.netbeans.org/kb/faqs/j2me-mobility.html#FaqJ2MESpecifyMidletIcon

  • How to set an image pattern as backround for a Shape + Copy shapes

    1.)
    Is there any way to set an image as background for a geometry shape (eg. Shapes.AddTriangle) similar like setting a 'Brush#' as background with LDShapes.BrushGradientShape ??
    In the image below, eg. the yellow triangle is a rectangular image shape with transparent regions, and therefor can with 'LDShapes.GetAllShapesAt(mouseX,mouseY)'
    also be accessed/grabbed in its transp. regions eg. green or red points etc., etc, aso.. and not only in the filled 3angular area, while a real 3angular geometry shape (like on the left side) would NOT (here only
    inside the triangle area itself). I tried 'LDShapes.SetImage' but this is for image shapes/controls and did'nt work here.
    Or maybe anyone has a better solution for a more natural looking wooden 'Brush' (as alternative for a real triangle shape with gradient).
    2.)
    Is there a way to copy an existing shape/control (with its basic properties like color, text, size, vertices count, ..) to another, like LDImage.Copy does for images ??
    eg. i can simply copy an array and an image from one variable to an other variable, like
    ' arr1 copied to arr2
    arr1 = "1=1;2=2;3=4;4=8;5=16;6=32;"
    arr2 = arr1
    TextWindow.WriteLine(arr2)
    TextWindow.WriteLine(arr1)
    or
    ' img1 copied to img2 (ImageList1)
    GraphicsWindow.Show()
    img1 = ImageList.LoadImage("picPath")
    img2 = img1
    GraphicsWindow.DrawImage(img2,50,50)
    GraphicsWindow.DrawImage(img1,200,200)
    but following does'nt work
    ' Ellipse1/Text1/Image1/Button1/...  is just an object with two names: shp1 and shp2
    GraphicsWindow.Show()
    shp1 = Shapes.AddEllipse(10,10)        'or Shapes.AddText("ABC") or Shapes.AddImage("picPath") or Controls.AddButton("Demo",0,0)
    Shapes.Move(shp1, 100,100)
    shp2 = shp1
    Shapes.Move(shp2, 50,50)
    Shapes.Move(shp1, 200,200)
    Not so important (only for interest), but maybe anyone has a trick for this, to copy such objects instead of creating them new.

    Yep, that made the rest of my whole day!! Works excelllent in the demo, and i'm just replacing all the  Image<->Triangle commands. Wonderfulll & thanks a lot, LitDev. (enjoint the sb sample in your Test-DL :-))
    PS:
    Controls.SetTextBoxText(Controls.AddTextBox(10,10), "Enter your name here...")
    Controls.AddButton(".. then press the Button", 180,10)
    LDGraphicsWindow.Capture("","")
    GraphicsWindow.Clear()
    GraphicsWindow.DrawImage("ImageList1", 0,0)

  • How to set a image as a background in a frame

    How to set a image as a background in a frame

    The following code works well in Notepad command prompt but it is not working on netbeans
    I want to set a background image in a frame(awt or swings ny will do) or a panel through netbeans
    1. import java.awt.*;
    2. import java.awt.event.*;
    3.
    4. public class ImageFrame extends Frame
    5. { 
    6. private ImageCanvas c;
    7. private Image i;
    8. ImageFrame( Image i )
    9. { 
    10. this.i = i;
    11. c = new ImageCanvas( i );
    12. add( c );
    13. }
    14.
    15. public static void main( String[] args )
    16. { 
    17. Toolkit tk = Toolkit.getDefaultToolkit();
    18.
    20. Image im = tk.getImage( "WashuChan.gif" );
    21. ImageFrame f = new ImageFrame( im );
    22. f.addWindowListener( new WindowAdapter()
    23. { 
    24. public void windowClosing( WindowEvent e )
    25. {  
    26. System.exit( 0 );
    27. }
    28. } );
    29. f.setSize( 300, 300 );
    30. f.show();
    31. }
    32.
    33. private class ImageCanvas extends Canvas
    34. { 
    35. Image i;
    36.
    37. public ImageCanvas( Image i )
    38. { 
    39. this.i = i;
    40. }
    41.
    42. public void paint( Graphics g )
    43. { 
    44. g.drawImage( i, 0, 0, this );
    45. }
    46.
    47. public Dimension getPreferredSize()
    48. { 
    49. int w = i.getWidth( this );
    50. int h = i.getHeight( this );
    51. return new Dimension( w, h );
    52. }
    53. }
    54. }

  • 6300 How to set ringtones/images/photos

    Please tell me how to set ringtones/images/photos to individual contacts/numbers. If you have more than one number for a contact can you set up each one separately. ie home/mobile/office etc.
    Thanks
    Solved!
    Go to Solution.

    to perform all the mentioned operations(expect assigning different tones to different numbers of the same contact,which isn't possible,as already indicated in the previous post)you need to move the contact to the phone memory. now what you can do is copy all the contacts to the phone memory as well.then after that you can set all the options for the your contacts.
              but, after copying the contacts to phone memory,the contact list will have two entries to the same contact(of both the memories).If you don't want them in that manner then you can configure the current memory in Contacts->Settings and set that option as 'Phone'.But this will now be the default memory for your new contact,so be careful!! Still any doubts??
    Was this post of some help? Click 'Kudos' star on the right hand side of this post. Your gesture will be highly appreciated!

  • How to Set A Default Start Time For New Events In Calendar?

    How to Set A Default Start Time For New Events In Calendar?

    John,
    Thanks for that suggestion - could not get it to work. However, I did manage a different approach. I finally determined the sequence of events in terms of how the various events and listeners fire (I think).
    Basically, the CalendarActivityListener fires, followed by the listener associated with the Calendar object's Create facet, followed finally by the CalendarEventListener - the final is where the TriggerEvent is available and then finally, control is passed to the popup/dialog in the Create facet. So, my approach of trying to set/get the TriggerDate in the user's HTTP session was doomed to failure because it was being get before it had been set :(
    Anyway, I ended up adding a bit of code to the CalendarEvent listener - it grabs the current BindingContext, navigates through the DCBindingContainer to derive an Iterator for the ViewObject which drives the calendar and then grabs the currently active row. I then do a few tests to make sure we're working with a "new" row because I don't want to alter start & end dates associated with an existing calendar entry and then I define the Start and End dates to be the Trigger Date.
    Works just fine. Snippet from the listener follows
    BindingContext bindingContext = BindingContext.getCurrent();+
    *if ( bindingContext != null )    {*+
    DCBindingContainer dcBindings = (DCBindingContainer) bindingContext.getCurrentBindingsEntry();+
    DCIteratorBinding iterator = dcBindings.findIteratorBinding("EventsView1Iterator");+
    Row currentRow = iterator.getCurrentRow();+
    if ( currentRow.getAttribute("StartDate") == null)+
    currentRow.setAttribute("StartDate", calendarEvent.getTriggerDate());+
    if (currentRow.getAttribute("EndDate")==null)+
    currentRow.setAttribute("EndDate", calendarEvent.getTriggerDate());+
    *}*

  • How to set a default colour & thickness  for rectangle in preview?

    How to set a default colour & thickness for rectangle(annotation) in preview ? Because every time that I choose for example red and thickness 1 it reverts to orange and 3 next time .

    Doesn't appear to be a default setting. Peruse the webpage for Secrets at http://secrets.blacktree.com/ for a possible setting.

  • How to set a new SCSI number for a second drive?

    How to set a new SCSI number for a second drive?
    Walter

    Walter,
    This web site gives a good diagram:
    http://www.hitachigst.com/hdd/support/dpes/dpesjum.htm
    On a Quantum hard disk drive - they were the original equipment manufacturer (OEM) hard drive provider for Apple, you will see three or four pairs of pins on the green circuit board. They are labled:
    AO . .
    A1 . .
    A2 . .
    If no pins are connected, you have SCSI ID Zero This was the standard setting from the factory.
    If you short out the pins beside AO .__. , you have designated SCSI ID One.
    If you short out the pins beside A1 .__. , you have designated SCSI ID Two.
    If you short out the pins beside A2 .__. , you have designated SCSI ID Four.
    These values can be added together to get other SCSI IDs. If you have a jumper beside AO AND A1, that will add up to SCSI ID Three.
    Some of the quantum drives used tiny black plastic jumpers with tiny metal contacts. I have yet to find a store that sells the tiny ones. I get my larger jumpers from old PC motherboards that are being thrown away. A small piece of aluminum foil will work as a jumper in a pinch. Just make sure it soed not fall off and short something else out!
    Jim
    PS
    CD-ROM drives are set at the factory as ID 3. Internal drives are set at ID 0. I set my external SCSI drive at SCSI 1 so it does not conflict with the internal drive. Internal Zip drives are set at ID 5 and external Zip drives let you choose between 5 and 6. I set my burners at ID 4. Come up with a master plan for your devices like scanners and burners. Apple System Profiler will give you info on the device ID. If the computer fails to boot, turn off all but one SCSI device and make sure of its ID. Then check each subsequent device by powering up only one device at a time while booting from a CD at ID #3.

  • How to set up different ring tone for Facetime

    how to set up different ring tone for Facetime

    I don't think that on an iPhone that FaceTime has a separate setting, you can only set a ringtone (which will apply to phone calls) via Settings > Sounds, or set different tones for different contacts via the Contacts app - but you can't have a separate sound for FaceTime

  • How to set a default Billing type for a particular Delivery type

    Dear All,
    How to set a default billing type for a particular delivery type.
    My requirement is, we are creating delivery for a Stock Transport Order. Delivery type is NL and the Purchase order type is UB.
    When we are creating Billing, it should take Billing type "ZSTO" by default, which is the customised Billing type.
    Where we have to do this setting?
    In case of normal sales order, this control will be available in the Sales order document types.
    In case STO, how to set a default billing type for a delivery type (NL).
    Regards,
    Rajesh

    There is a customization available here no default or hard coded
    Normally in a sales doc type we mention which billing type system has to pick
    If the billing happens from a PO which billing type system will take depends on the controls set in the areas mentioned below
    Go to your delivery type OVLK (say your delivery type is NL)
    In that there is a field called default order qty in the order reference tab (say if you maintained DL there)
    This DL is called PSEUDO order type
    Then in VOV8 for DL based on the billing types mentioned ,system will take the billing doc
    For delivery related billing say if you mention say ZF8 in the details of DL in VOV8(provided you have created ZF8)
    Then while you bill the delivery doc of NL system will take ZF8
    For intercompany delivery you can create ZIV billing type also Pure customization
    PO is linked to delivery type ( MM spro settings)--Del type linked to order (pseudo) type---in order type (pseudo) we mention the billing types. Here the flow is bit different that pure SD flow
    Though the invoice is crated by manually putting customized Biiling Type and A/Cing doc also generated, but in the VF04 still system shows the same deliveries pending with Billing Type (F2).
    This manual is not reqd if the said assignments are done properly
    Hope it can assist you.
    Thanks & Regards
    JP
    Edited by: J Prakash on Jun 23, 2010 4:05 PM

  • HT201684 In Yosemite this no longer works, has anyone figured this out? How to set a custom default umask for all applications?

    In Yosemite this no longer works, has anyone figured this out? How to set a custom default umask for all applications?
    I've tried everything to get a custom umask set for all apps. It just seems impossible...
    Is there a replacement for launchd-user.conf?

    Please file a bug report: https://bugreport.apple.com
    I am sure this is something that got lost, like environment variables, in the Yosemite/iOS merger.

  • How to set the default settment rule for the same kind project.

    hi experts:
       the project of the same kind of the project profile have the same settment rule to one account (G/L).
    how to set the default settment rule for the project of  this kind of the project profile.
    regards

    Hi,
      You need to define the settlement profile and allocation structure.
    next you need to define the  Strategy for settlement rule.
    navigation-PS> costs> automatic and periodic allocations> settlement> Settlement rule for WBS
    --> Define strategy for settlement rule.
    Select the strategy and click on settings. in that new entries, check the Acc Assg element, enter Settlement profile and mention accass category as reposnsible cost center.
    Save this transaction.
    Now create a project assgin responsible costcenter for the WBS element in the project buider and save the transaction.
    Now run CJB2 transaction for the project, settlement rule will generated automatically.
    even you can configure the same for profitability segment.
    Rgds
    Sudhir Reddy

  • How to set ORACLE_HOMES on Windows 2000 for 11i

    How to set ORACLE_HOMES on Windows 2000 for 11i
    As am newbie on windows.
    Its very urgent.

    To set ORACLE_HOME on Windows:
    C:\> set ORACLE_HOME=<location>
    i.e.
    C:\> set ORACLE_HOME=d:\oracle\proddb\10.2.0
    To verify:
    echo %ORACLE_HOME%
    In Apps 11i, you do not have to set it manually, just source the environment file and this will set all environment variables for you.
    - To source the application env file, run envshell.cmd under %APPL_TOP%
    - To source the database env file, run <SID>_<hostname>.cmd under %RDBMS_ORACLE_HOME%

  • How to set upper and lower limit for service notification in SPRO

    Hello everyone,
    Good morning....!!
    I am new to SAP PM and to SCN as well.
    I have a question on Service notification user status.
    I  have notification profile configured in SAP as below:
    Status no      Status          Short text              Lower limit          Upper limit
    5                  REGD          Registered                1                          70
    10                PCKS            Pack sent                  1                          70
    20                APRC            Application received  1                        70
    etc..
    I want the statusesto be set as  navigation should only allow to go back one by one...like from APRC -->PCKS not to REGD.From PCKS -->REGD etc..not vice versa.
    Can enayone explain me to how to set lower and upper limits for these according ot the above requirement.
    for more details please check my attachment.
    Thanks in advance..!!
    Regards,
    Sudha.

    Once you change the status to previous status, just save the order. Then again open the order & try to change the user status.
    Just I made replica of your profile. I could able to change (even without saving the order).

  • How to set up an iTunes account for my new ipad?

    How to set up an iTunes account for my new ipad?

    If you already have an iTunes account, simply use that. You do not need a new account.
    Open the iTunes app on the iPad. Go to the bottom of the screen and tap Sign in.

Maybe you are looking for