![]() |
|
#1
|
|||
|
|||
Load image problem, need help!!!Hi i have been given a task at school, this is the task:
Design and implement a GUI program that will allow a user to load and display one of 2 images. The images should be of your own choosing. You should provide a text area to display the images. You should provide three buttoms, two of the buttons will load the images and the third will clear the text area. So far I have been able to do the GUI with the textarea and the three buttons, but i have no idea how to load the image after the button is pressed If any one knows please help me, I hane only few more days to complete the task thanx in advance |
|||
|
#2
|
||||
|
||||
Re: Load image problem, need help!!!Please see the Guidelines Thread
especially #1, and check 1.A This will be help us help you since we have no way to tell if you are using AWT, SWING, etc. Start with that, and we'll go from there. __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#3
|
|||
|
|||
Re: Load image problem, need help!!!I am using swing and iam prohramming in Editplus
|
|
#4
|
|||
|
|||
Re: Load image problem, need help!!!i can post the source code what i have so far, do you need it?
thanx for the reply |
|
#5
|
||||
|
||||
Re: Load image problem, need help!!!Sure, go ahead. I don't need it, but the sole purpose is to help you along.
__________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! |
|
#6
|
|||
|
|||
Re: Load image problem, need help!!!well some of the things were some test so maybe they are pointless
You also need to put into one folder with images called img and img2 but the GUI should work without them anyway JAVA Code:
Last edited by cable_guy_67 : 13-Aug-2006 at 16:50.
Reason: Please surround your Java code with [java] ... [/java]
|
|
#7
|
||||
|
||||
Re: Load image problem, need help!!!Ok, you have the right idea, but just need some minor modifications.
1. move the JTextArea declaration out of the constructor to have class scope. 2. keep the 'image' declaration at class scope [where it already is now], but move the assignment portion (the image to show) to the button's actionPerformed() call. 3. after assigning the image, call textArea.repaint(). Basically, for 2 & 3, the actionPerformed() will have two statements: one that assigns the image, and the other does the repaint to update the textArea. The only part I have not covered is clearing. I'll leave that little bit for you to do; however, if you run into problems, just post back with your updated code. (place it between java tags [see the bottom of post #6]). __________________
Use the force...read the source!! WYCIWYG -- what you code is what you get! Last edited by TurboPT : 14-Aug-2006 at 10:40.
|
Recent GIDBlog
Not selected for officer school by crystalattice
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| display problem in firefox and opera | batrsau | Web Design Forum | 4 | 09-Dec-2005 03:18 |
| GIM gidedit - a fltk fluid resize project | cable_guy_67 | FLTK Forum | 2 | 01-Jun-2005 15:00 |
| Display filesystem to load a file and drawing an image | maveganzones | FLTK Forum | 3 | 07-Apr-2005 11:15 |
| serious problem with my PC,Local Security Policy cant load | codavid | Computer Software Forum - Windows | 14 | 31-Mar-2005 11:17 |
| Checking source codes of image, audio and video files | onauc | C Programming Language | 5 | 26-Feb-2005 21:47 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The