I start to do it but that what all what i can do"i need big help"

i post last day abut need for code for my project but i just could to do thise code with the help that i got bcz i don't know how to do more& i don't have time with my other projects so i hope that there is eny one have ready look like this simple paint program he will save my life
this is me mail [email protected]
//first part
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class CustomPanelTest extends JFrame {
private JPanel buttonPanel;
private CustomPanel myPanel;
private JButton circle, square, oval;
public CustomPanelTest()
super("Paint Program");
myPanel = new CustomPanel();
myPanel.setBackground(Color.white);
square = new JButton("Square");
square.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
myPanel.draw(CustomPanel.SQUARE);
oval = new JButton("Oval");
oval.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
circle = new JButton("Circle");
circle.addActionListener(
new ActionListener() {
public void actionPerformed(ActionEvent e)
myPanel.draw(CustomPanel.CIRCLE);
buttonPanel = new JPanel();
buttonPanel.setLayout( new GridLayout(1,2));
buttonPanel.add(circle);
buttonPanel.add(oval);
buttonPanel.add(square);
Container c = getContentPane();
c.add( myPanel, BorderLayout.CENTER);
c.add(buttonPanel, BorderLayout.NORTH);
setSize(600,300);
show();
public static void main(String args[])
CustomPanelTest app = new CustomPanelTest();
app.addWindowListener(
new WindowAdapter() {
public void windowClosing(WindowEvent e)
System.exit(0);
//second part
class CustomPanel extends JPanel {
public final static int CIRCLE = 1, SQUARE = 2;
private int shape;
private int x[]=new int[7], y[]=new int[7];
private int t=0;
public void paintComponent(Graphics g)
super.paintComponent(g);
if(shape == CIRCLE)
g.fillOval(x[0], y[0], (x[1]-x[0]), (y[1]-y[0]));
else if (shape == SQUARE)
g.fillRect(x[0], y[0], (x[1]-x[0]), (y[1]-y[0]));
private class MouseClickedHandler extends MouseAdapter {
public void mousePressed( MouseEvent e)
x[0] = e.getX();
y[0] = e.getY();
public void mouseReleased( MouseEvent e)
x[1] = e.getX();
y[1] = e.getY();
if ((x[1]-x[0]) < 0)
t=x[1];
x[1]=x[0];
x[0]=t;
if ((y[1]-y[0]) < 0)
t=y[1];
y[1]=y[0];
y[0]=t;
repaint();
public void draw( int s)
shape = s;
repaint();
hi all I need ready code for a simple paint program today for me ics projct
plz give me a halp on this give me what you have with you and it is so good if it look like this :
Design a GUI based drawing Java application that works like a simple paint program
1-There should be a number of buttons for choosing different shapes to draw. For example, there should be a button for rectangle. If user presses the rectangle button, then he can draw a rectangle using mouse. Similarly, there should be a button for each shape(rectangle, circle, ellipse, and line etc.
2-The shapes can be filled with different colors.
3-There should be option of moving .
4- There should also be three menus including File, Shape, and Color menu.
i. File menu can have menu items New and Exit. If user selects New, the drawing area will be cleared and all shapes will be erased.
ii. Shape menu will serve the same purpose as of feature 2 described above. It will have menu items for drawing all the different shapes. For example, there will be menu item for rectangle; so user can draw a rectangle by selecting the menu item for rectangle.
iii. Color menu will serve the same purpose as of feature 3 described above. It will have menu items for all the colors which are shown in color buttons. The user can select a color from this menu and then click inside a shape to fill it with the selected color.

add this constructor to CustomPanel
public CustomPanel()
  addMouseListener(new MouseClickedHandler());
}

Similar Messages

  • TS3899 iphone 4 mail --blank screen like it's stuck.  i can see the "pad/pencil" in the lower right screen to start a new email, but that's all.  any ideas? thanks!

    on my iPhone 4, I can't get mail.  THere is a blank screen, like it's stuck.  I can see the "pad/pencil" in the lower right corner to start a new message, but that's it.
    Any ideas?

    Try a reset: Simultaneously hold down the Home and On buttons until the device shuts down. Ignore the off slider if it appears. Once shut down is complete, if it doesn't restart on it own, turn the device back on using the On button. In some cases it also helps to double click the Home button and close all apps from the tray before doing the reset.
    Try deleting and re-adding the account to the Phone.

  • Can't forward/reply or write/send an email. Can open and read but that is all. Can't close that page. Have to shut down and start over. Frustrating!

    If I want to forward an email, I hit forward, type in the name, tab to start writing something and am unable to do so. The page is outlined with tiny dots (as if it were perforated). When I try to close it down, a small box appears asking if I want to --Discard - Save as a Draft - Continue Writing -- It makes no difference which one I click on, none work. I have to close completely and open my email to continue reading my emails but that is all I can do.
    If I use Chrome as my browser, everything works fine. However, I like Firefox (other than your recent support of gay/lesbians - which is why my husband quit using Firefox and maybe I will too, now!)

    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes

  • I have been having trouble getting my email on my iPad. It started when I brought it to the US on vacation (I live in London and my email provider is Virgin Media). It worked once since I returned, but that is it. I can send emails, but can't get them

    I have been having trouble getting my email on my iPad2.
    It started when I brought it to the US on vacation (I live in London and my email provider is Virgin Media). It worked once since I returned, but that is it.
    I can send emails, but can't get them.
    Any ideas, people?

    Hi Kharels
    Just posted this reply to 2 others with same sort of question:
    I have the same issue as i have my own email address and only want to use.
    There are two ways around this annoying problem. The first is to set up your own domain email account alongside your iCloud one, and when you go to send each email tap on From and you get a choice of emails addresses to reply from... ie your own domain or the iCloud one.  This is tedious though.
    The other is to set up your iCloud email as normal, then create a new one altogether. Choose 'Other' when creating this new account. Then put for the incoming server mail.me.com, along with your user name and password. For the outgoing server put the server you want to use - ie your own domain one. This is therefore a hybrid account and does work.
    Now switch off the email for iCloud (leaving on Calendar, Address Book etc). Switch on the email for your hybrid account (which of course is iCloud incoming as well).
    Providing you have directed your own domain email address to your me.com one, you will find the iPhone should behave itself and you can use the folders etc and these will synch with your Mac ok.
    Hope this work for you - let us know.
    Simon

  • I'm looking for a digital picture frame that is compatible with the iPhone 5 and 4S.  I was looking at the Panasonic MW-20 but from what I can see I don't think it is.  Any information would be great!  Looking to buy a replacement frame for Christmas.

    I'm looking for a digital picture frame that is compatible with the iPhone 5 and 4S.  I was looking at the Panasonic MW-20 but from what I can see I don't think it is.  Any information would be great.  Looking to buy a replacement for Christmas.  Thanks!

    Hi - the new lightning connector on the iPhone 5 has an authentication chip so very few 3rd party manufacturers have come out with compatible devices - so I doubt that you will find a frame that works for both phones - however Apple has come out with 2 apapters - one is a cable and one is a direct 30 pin to lightning device - you would have to check out each frame to see if one of these might work - I looked at the Panasonic and it looks promising but I would check the return policy of anything that you buy in a case it doesn't work.

  • Wiped our old iPad 1 clean, now can't install iOS from iTunes.  iTunes does not "see" the devise.  Tried uninstalling and installing iTunes on laptop.  Also bought new USB cable.  The iPad is charging, but that's all it does.

    Wiped our old iPad 1 clean, now can't install iOS from iTunes using laptop PC (W Vista).  iTunes does not "see" the device.  Tried uninstalling and installing iTunes on laptop.  Also bought new USB cable.  The iPad is charging, but that's all it does.  Just want to get it operating again for browsing and e-reading.

    OK.  You merely erased the content and settings.  The IOS is still there.
    If it has NEVER been jailbroke, here are some standard repair procedures.  From what you've already stated, my guess is that you'll end up with Recovery Mode described in the last paragraph.
    First, try a system reset.  It cures many ills and it's quick, easy and harmless...
    Hold down the on/off switch and the Home button simultaneously until you see the Apple logo.  Ignore the "Slide to power off" text if it appears.  You will not lose any apps, data, music, movies, settings, etc.
    If the Reset doesn't work, try a Restore.  Note that it's nowhere near as quick as a Reset.  It could take well over an hour!  Connect via cable to the computer that you use for sync.  From iTunes, select the iPad/iPod and then select the Summary tab.  Follow the on-screen directions for Restore and be sure to say "yes" to the backup.  You will be warned that all data (apps, music, movies, etc.) will be erased but, as the Restore finishes, you will be asked if you wish the contents of the backup to be copied to the iPad/iPod.  Again, say "yes."
    At the end of the basic Restore, you will be asked if you wish to sync the iPad/iPod.  As before, say "yes."  Note that that sync selection will disappear and the Restore will end if you do not respond within a reasonable time.  If that happens, only the apps that are part of the IOS will appear on your device.  Corrective action is simple -  choose manual "Sync" from the bottom right of iTunes.
    If you're unable to do the Restore (or it doesn't help), go into Recovery Mode per the instructions here.  You WILL lose all of your data (game scores, etc,) but, for the most part, you can redownload apps and music without being charged again.  Also, read this.

  • TS1587 iMac will not boot. Monitor lights up with squiggly little lines, but that's all. Help??

    My iMac 24" inte will not boot. Monitor lights up with squiggly little lines, but that's all. Help??

    Can you run Apple Hardware Test.  In you case it is not so much to see what it finds but to see whether you can boot it at all.
    Or try a safe boot.
    It may be time to take to apple for repair.

  • After Firefox opens, I cannot relocate it to the right or left, I can resize but that is all?

    Question
    After Firefox opens, I cannot relocate it to the right or left, I can re-size the webpage but that is all? everything else seems fine? Just will not move from where it opens?
    Help
    Thanks
    Tom

    Try:
    *http://kb.mozillazine.org/Corrupt_localstore.rdf
    Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance/Themes).
    *Don't make any changes on the Safe mode start window.
    *https://support.mozilla.org/kb/Safe+Mode

  • I bought the CC for a month it was $9.99 I downloaded CC but now what apps can I get is it lightroom and Photoshop?

    I bought the CC for a month it was $9.99 I downloaded CC but now what apps can I get is it lightroom and Photoshop?

    That is the photography plan, if you want more programs you need the full CC plan.

  • I have a iPad were I have opened I tunes match ect linked to my pc I have since found my old ipod classic which I have loads of music on but that was all linked to a mac which I don't have anymore, is there anyway I can sync them both

    I have a iPad were I have opened I tunes match ect linked to my pc I have since found my old ipod classic which I have loads of music on but that was all linked to a mac which I don't have anymore, is there anyway I can sync them both without loosing my music, if I plug my ipod into PC it won't read it

    You need to transfer the music from your iPod on to your iTunes library on your PC, since that is where you are currently syncing and where you are signed into iTunes Match.  It doesn't matter that you were previously syncing it with a Mac, and you won't need to reinstall iTunes on your PC.  But you will have to use 3rd party software such as Touch Copy to transfer any music not purchased from the iTunes store from your iPod to your iTunes library.  Here's another guide on this, which is shoter and you may find easier to follow: Syncing to a "New" Computer or replacing a "crashed" Hard Drive.  Also, if you're using iTunes 11, go to View>Show Sidebar.  This will make it easier to follow along with these guides.

  • I was able to copy all my files from my Time Capsule, but that is all they are...files. How do I get my new Mac Mini to emulate my other Mac?

    I was able to copy all my files from my Time Capsule, but that is all they are...files. How do I get my new Mac Mini to emulate my other Mac?

    Doggiemommie,
    Copying files is not a good idea.
    The "other Mac" was backed up onto Time Capsule using the Time Machine. On your new Mac you should restore the old user - rather than copy files manually.
    This usually happens during the initial setup of the new computer or you can do it later using Migration Assistant.
    Please note, it is possible to damage backup file on the Time Capsule when you browse it and copy files manually.
    Hope this explains.
    TZ

  • I put my new iPhone into iTunes for the first time, and chose to back it up to the iTunes i had on my iPod, but that made all my contacts on my sim card disappear, how can i get these contacts back?

    i put my new iPhone into iTunes for the first time, and chose to back it up to the iTunes i had on my iPod, but that made all my contacts on my sim card disappear, how can i get these contacts back?

    Have a read here...
    https://discussions.apple.com/message/18409815?ac_cid=ha
    And See Here...
    How to Use Multiple iDevices with One Computer

  • I downloaded the 30 day free trial of Photoshop on 9/11, but have not been able to open it, or even find it on my computer.  I do have the Adobe Create Cloud icon, and when I click it it list PS as downloaded and lets me access tutorials, but that is all.

    I downloaded the 30 day free trial of Photoshop on 9/11, but have not been able to open it, or even find it on my computer.  I do have the Adobe Create Cloud icon, and when I click it it list PS as downloaded and lets me access tutorials, but that is all.
    Please let me know how to open and use PS.
    Homer Guy

    Hi Homerguy,
    If you are using Mac, please open the finder window click on go and choose applications and try to launch Photoshop from there.
    If windows, please navigate to C:\Program Files\Adobe\Adobe Photoshop CC 2014 and double click on the Photoshop.exe file.
    Thanks

  • I heard there was a security breach in Java installed in Macs and that there is a patch to fix it.  But that's all I know.  Is there more info available?

    I heard there was a security breach in Java installed in Macs and that there is a patch to fix it, but that's all I know.  Does anyone know how to fix it?

    There isn't a patch for a computer running Leopard .
    Leopard and earlier users see recommendations at: https://discussions.apple.com/thread/3872491

  • SCRIPTER PLUG-IN ; looks like you cannot do more that what you can do with the environment !

    Hello
    I am very interested of this possibility to develop the equivalent of the Cubase VST expression Map to drive VSL articulation changes
    I have read that the score have been re-wrote ! is this true ?
    Reading the manual I did not find that it was possible to convert score events (staccato, legato ...) into a midi command to be send to VSL
    Also you cannot work on note length.
    Looks like you cannot do more that what you can do with the environment !
    I hope I am wrong and that this is missing in the manual
    Best
    Cyril

    APPLE, can you reply ?
    Depending of your answer I will buy or not buy Logic X

Maybe you are looking for

  • Negative Balance in Opening Stock & Closing Stock

    Dear Experts,                     Below the query which i used to get the Opening Stock,Purchase,Issue,Return and closing stock. Here i face some problem that i get negative inventory for some items and the same has been checked in inventory audit re

  • NoClassdefFound Problem using EJB as web service client

    Hello there, I am trying to use a MDB as a web service client. The architecture, briefly is in the form of a java program communicating with a MDB via JMS, the MDB gets the data from some external server via SOAP. I am using JBuilder to generate the

  • How to get data from a second page?

    Hi guys, I have the first page, where I have a button, which will navigate to the second page to let user make some choices. After the user makes the choices, user will click a button to get back. How can I pass the choices back to the first page? Re

  • My iPod isn't transmitting any sound

    So I picked up my iPod, and it got snagged on another powercord, it fell on the padded leather recliner, no biggie. So I picked it up, popped in my headphones, and hit play... no audio. So I pulled them off, and noticed that altough it may be annoyin

  • Bootcamp + Eve Online

    Well im not sure if this will get much love here but I'm going to try anyways. I got windows finally working on my mac pro last night and promptly installed the only game that I ever play, Eve Online. With everything at default the game seems to be r